More STM32G0xx work, not complete.
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@12770 27425a3e-05d8-49a3-a47f-9c15f0e5edd8
This commit is contained in:
parent
dd492b39fb
commit
e69242273d
|
@ -99,19 +99,19 @@ include $(CHIBIOS)/os/license/license.mk
|
|||
# Startup files.
|
||||
include $(CHIBIOS)/os/common/startup/ARMCMx/compilers/GCC/mk/startup_stm32g0xx.mk
|
||||
# HAL-OSAL files (optional).
|
||||
#include $(CHIBIOS)/os/hal/hal.mk
|
||||
#include $(CHIBIOS)/os/hal/ports/STM32/STM32L4xx/platform.mk
|
||||
#include $(CHIBIOS)/os/hal/boards/ST_NUCLEO64_L476RG/board.mk
|
||||
#include $(CHIBIOS)/os/hal/osal/rt-nil/osal.mk
|
||||
include $(CHIBIOS)/os/hal/hal.mk
|
||||
include $(CHIBIOS)/os/hal/ports/STM32/STM32G0xx/platform.mk
|
||||
include $(CHIBIOS)/os/hal/boards/ST_NUCLEO64_G071RB/board.mk
|
||||
include $(CHIBIOS)/os/hal/osal/rt-nil/osal.mk
|
||||
# RTOS files (optional).
|
||||
#include $(CHIBIOS)/os/rt/rt.mk
|
||||
#include $(CHIBIOS)/os/common/ports/ARMCMx/compilers/GCC/mk/port_v7m.mk
|
||||
include $(CHIBIOS)/os/rt/rt.mk
|
||||
include $(CHIBIOS)/os/common/ports/ARMCMx/compilers/GCC/mk/port_v6m.mk
|
||||
# Auto-build files in ./source recursively.
|
||||
include $(CHIBIOS)/tools/mk/autobuild.mk
|
||||
# Other files (optional).
|
||||
#include $(CHIBIOS)/test/lib/test.mk
|
||||
#include $(CHIBIOS)/test/rt/rt_test.mk
|
||||
#include $(CHIBIOS)/test/oslib/oslib_test.mk
|
||||
include $(CHIBIOS)/test/lib/test.mk
|
||||
include $(CHIBIOS)/test/rt/rt_test.mk
|
||||
include $(CHIBIOS)/test/oslib/oslib_test.mk
|
||||
|
||||
# Define linker script file here
|
||||
LDSCRIPT= $(STARTUPLD)/STM32G071xB.ld
|
||||
|
|
|
@ -0,0 +1,266 @@
|
|||
/*
|
||||
ChibiOS - Copyright (C) 2006..2017 Giovanni Di Sirio
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
/*
|
||||
* This file has been automatically generated using ChibiStudio board
|
||||
* generator plugin. Do not edit manually.
|
||||
*/
|
||||
|
||||
#include "hal.h"
|
||||
#include "stm32_gpio.h"
|
||||
|
||||
/*===========================================================================*/
|
||||
/* Driver local definitions. */
|
||||
/*===========================================================================*/
|
||||
|
||||
/*===========================================================================*/
|
||||
/* Driver exported variables. */
|
||||
/*===========================================================================*/
|
||||
|
||||
/*===========================================================================*/
|
||||
/* Driver local variables and types. */
|
||||
/*===========================================================================*/
|
||||
|
||||
/**
|
||||
* @brief Type of STM32 GPIO port setup.
|
||||
*/
|
||||
typedef struct {
|
||||
uint32_t moder;
|
||||
uint32_t otyper;
|
||||
uint32_t ospeedr;
|
||||
uint32_t pupdr;
|
||||
uint32_t odr;
|
||||
uint32_t afrl;
|
||||
uint32_t afrh;
|
||||
} gpio_setup_t;
|
||||
|
||||
/**
|
||||
* @brief Type of STM32 GPIO initialization data.
|
||||
*/
|
||||
typedef struct {
|
||||
#if STM32_HAS_GPIOA || defined(__DOXYGEN__)
|
||||
gpio_setup_t PAData;
|
||||
#endif
|
||||
#if STM32_HAS_GPIOB || defined(__DOXYGEN__)
|
||||
gpio_setup_t PBData;
|
||||
#endif
|
||||
#if STM32_HAS_GPIOC || defined(__DOXYGEN__)
|
||||
gpio_setup_t PCData;
|
||||
#endif
|
||||
#if STM32_HAS_GPIOD || defined(__DOXYGEN__)
|
||||
gpio_setup_t PDData;
|
||||
#endif
|
||||
#if STM32_HAS_GPIOE || defined(__DOXYGEN__)
|
||||
gpio_setup_t PEData;
|
||||
#endif
|
||||
#if STM32_HAS_GPIOF || defined(__DOXYGEN__)
|
||||
gpio_setup_t PFData;
|
||||
#endif
|
||||
#if STM32_HAS_GPIOG || defined(__DOXYGEN__)
|
||||
gpio_setup_t PGData;
|
||||
#endif
|
||||
#if STM32_HAS_GPIOH || defined(__DOXYGEN__)
|
||||
gpio_setup_t PHData;
|
||||
#endif
|
||||
#if STM32_HAS_GPIOI || defined(__DOXYGEN__)
|
||||
gpio_setup_t PIData;
|
||||
#endif
|
||||
#if STM32_HAS_GPIOJ || defined(__DOXYGEN__)
|
||||
gpio_setup_t PJData;
|
||||
#endif
|
||||
#if STM32_HAS_GPIOK || defined(__DOXYGEN__)
|
||||
gpio_setup_t PKData;
|
||||
#endif
|
||||
} gpio_config_t;
|
||||
|
||||
/**
|
||||
* @brief STM32 GPIO static initialization data.
|
||||
*/
|
||||
static const gpio_config_t gpio_default_config = {
|
||||
#if STM32_HAS_GPIOA
|
||||
{VAL_GPIOA_MODER, VAL_GPIOA_OTYPER, VAL_GPIOA_OSPEEDR, VAL_GPIOA_PUPDR,
|
||||
VAL_GPIOA_ODR, VAL_GPIOA_AFRL, VAL_GPIOA_AFRH},
|
||||
#endif
|
||||
#if STM32_HAS_GPIOB
|
||||
{VAL_GPIOB_MODER, VAL_GPIOB_OTYPER, VAL_GPIOB_OSPEEDR, VAL_GPIOB_PUPDR,
|
||||
VAL_GPIOB_ODR, VAL_GPIOB_AFRL, VAL_GPIOB_AFRH},
|
||||
#endif
|
||||
#if STM32_HAS_GPIOC
|
||||
{VAL_GPIOC_MODER, VAL_GPIOC_OTYPER, VAL_GPIOC_OSPEEDR, VAL_GPIOC_PUPDR,
|
||||
VAL_GPIOC_ODR, VAL_GPIOC_AFRL, VAL_GPIOC_AFRH},
|
||||
#endif
|
||||
#if STM32_HAS_GPIOD
|
||||
{VAL_GPIOD_MODER, VAL_GPIOD_OTYPER, VAL_GPIOD_OSPEEDR, VAL_GPIOD_PUPDR,
|
||||
VAL_GPIOD_ODR, VAL_GPIOD_AFRL, VAL_GPIOD_AFRH},
|
||||
#endif
|
||||
#if STM32_HAS_GPIOE
|
||||
{VAL_GPIOE_MODER, VAL_GPIOE_OTYPER, VAL_GPIOE_OSPEEDR, VAL_GPIOE_PUPDR,
|
||||
VAL_GPIOE_ODR, VAL_GPIOE_AFRL, VAL_GPIOE_AFRH},
|
||||
#endif
|
||||
#if STM32_HAS_GPIOF
|
||||
{VAL_GPIOF_MODER, VAL_GPIOF_OTYPER, VAL_GPIOF_OSPEEDR, VAL_GPIOF_PUPDR,
|
||||
VAL_GPIOF_ODR, VAL_GPIOF_AFRL, VAL_GPIOF_AFRH},
|
||||
#endif
|
||||
#if STM32_HAS_GPIOG
|
||||
{VAL_GPIOG_MODER, VAL_GPIOG_OTYPER, VAL_GPIOG_OSPEEDR, VAL_GPIOG_PUPDR,
|
||||
VAL_GPIOG_ODR, VAL_GPIOG_AFRL, VAL_GPIOG_AFRH},
|
||||
#endif
|
||||
#if STM32_HAS_GPIOH
|
||||
{VAL_GPIOH_MODER, VAL_GPIOH_OTYPER, VAL_GPIOH_OSPEEDR, VAL_GPIOH_PUPDR,
|
||||
VAL_GPIOH_ODR, VAL_GPIOH_AFRL, VAL_GPIOH_AFRH},
|
||||
#endif
|
||||
#if STM32_HAS_GPIOI
|
||||
{VAL_GPIOI_MODER, VAL_GPIOI_OTYPER, VAL_GPIOI_OSPEEDR, VAL_GPIOI_PUPDR,
|
||||
VAL_GPIOI_ODR, VAL_GPIOI_AFRL, VAL_GPIOI_AFRH},
|
||||
#endif
|
||||
#if STM32_HAS_GPIOJ
|
||||
{VAL_GPIOJ_MODER, VAL_GPIOJ_OTYPER, VAL_GPIOJ_OSPEEDR, VAL_GPIOJ_PUPDR,
|
||||
VAL_GPIOJ_ODR, VAL_GPIOJ_AFRL, VAL_GPIOJ_AFRH},
|
||||
#endif
|
||||
#if STM32_HAS_GPIOK
|
||||
{VAL_GPIOK_MODER, VAL_GPIOK_OTYPER, VAL_GPIOK_OSPEEDR, VAL_GPIOK_PUPDR,
|
||||
VAL_GPIOK_ODR, VAL_GPIOK_AFRL, VAL_GPIOK_AFRH}
|
||||
#endif
|
||||
};
|
||||
|
||||
/*===========================================================================*/
|
||||
/* Driver local functions. */
|
||||
/*===========================================================================*/
|
||||
|
||||
static void gpio_init(stm32_gpio_t *gpiop, const gpio_setup_t *config) {
|
||||
|
||||
gpiop->OTYPER = config->otyper;
|
||||
gpiop->OSPEEDR = config->ospeedr;
|
||||
gpiop->PUPDR = config->pupdr;
|
||||
gpiop->ODR = config->odr;
|
||||
gpiop->AFRL = config->afrl;
|
||||
gpiop->AFRH = config->afrh;
|
||||
gpiop->MODER = config->moder;
|
||||
}
|
||||
|
||||
static void stm32_gpio_init(void) {
|
||||
|
||||
/* Enabling GPIO-related clocks, the mask comes from the
|
||||
registry header file.*/
|
||||
rccResetIOP(STM32_GPIO_EN_MASK);
|
||||
rccEnableIOP(STM32_GPIO_EN_MASK, true);
|
||||
|
||||
/* Initializing all the defined GPIO ports.*/
|
||||
#if STM32_HAS_GPIOA
|
||||
gpio_init(GPIOA, &gpio_default_config.PAData);
|
||||
#endif
|
||||
#if STM32_HAS_GPIOB
|
||||
gpio_init(GPIOB, &gpio_default_config.PBData);
|
||||
#endif
|
||||
#if STM32_HAS_GPIOC
|
||||
gpio_init(GPIOC, &gpio_default_config.PCData);
|
||||
#endif
|
||||
#if STM32_HAS_GPIOD
|
||||
gpio_init(GPIOD, &gpio_default_config.PDData);
|
||||
#endif
|
||||
#if STM32_HAS_GPIOE
|
||||
gpio_init(GPIOE, &gpio_default_config.PEData);
|
||||
#endif
|
||||
#if STM32_HAS_GPIOF
|
||||
gpio_init(GPIOF, &gpio_default_config.PFData);
|
||||
#endif
|
||||
#if STM32_HAS_GPIOG
|
||||
gpio_init(GPIOG, &gpio_default_config.PGData);
|
||||
#endif
|
||||
#if STM32_HAS_GPIOH
|
||||
gpio_init(GPIOH, &gpio_default_config.PHData);
|
||||
#endif
|
||||
#if STM32_HAS_GPIOI
|
||||
gpio_init(GPIOI, &gpio_default_config.PIData);
|
||||
#endif
|
||||
#if STM32_HAS_GPIOJ
|
||||
gpio_init(GPIOJ, &gpio_default_config.PJData);
|
||||
#endif
|
||||
#if STM32_HAS_GPIOK
|
||||
gpio_init(GPIOK, &gpio_default_config.PKData);
|
||||
#endif
|
||||
}
|
||||
|
||||
/*===========================================================================*/
|
||||
/* Driver interrupt handlers. */
|
||||
/*===========================================================================*/
|
||||
|
||||
/*===========================================================================*/
|
||||
/* Driver exported functions. */
|
||||
/*===========================================================================*/
|
||||
|
||||
/**
|
||||
* @brief Early initialization code.
|
||||
* @details GPIO ports and system clocks are initialized before everything
|
||||
* else.
|
||||
*/
|
||||
void __early_init(void) {
|
||||
|
||||
stm32_gpio_init();
|
||||
stm32_clock_init();
|
||||
}
|
||||
|
||||
#if HAL_USE_SDC || defined(__DOXYGEN__)
|
||||
/**
|
||||
* @brief SDC card detection.
|
||||
*/
|
||||
bool sdc_lld_is_card_inserted(SDCDriver *sdcp) {
|
||||
|
||||
(void)sdcp;
|
||||
/* TODO: Fill the implementation.*/
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief SDC card write protection detection.
|
||||
*/
|
||||
bool sdc_lld_is_write_protected(SDCDriver *sdcp) {
|
||||
|
||||
(void)sdcp;
|
||||
/* TODO: Fill the implementation.*/
|
||||
return false;
|
||||
}
|
||||
#endif /* HAL_USE_SDC */
|
||||
|
||||
#if HAL_USE_MMC_SPI || defined(__DOXYGEN__)
|
||||
/**
|
||||
* @brief MMC_SPI card detection.
|
||||
*/
|
||||
bool mmc_lld_is_card_inserted(MMCDriver *mmcp) {
|
||||
|
||||
(void)mmcp;
|
||||
/* TODO: Fill the implementation.*/
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief MMC_SPI card write protection detection.
|
||||
*/
|
||||
bool mmc_lld_is_write_protected(MMCDriver *mmcp) {
|
||||
|
||||
(void)mmcp;
|
||||
/* TODO: Fill the implementation.*/
|
||||
return false;
|
||||
}
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief Board-specific initialization code.
|
||||
* @todo Add your board-specific code, if any.
|
||||
*/
|
||||
void boardInit(void) {
|
||||
|
||||
}
|
|
@ -0,0 +1,799 @@
|
|||
/*
|
||||
ChibiOS - Copyright (C) 2006..2017 Giovanni Di Sirio
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
/*
|
||||
* This file has been automatically generated using ChibiStudio board
|
||||
* generator plugin. Do not edit manually.
|
||||
*/
|
||||
|
||||
#ifndef BOARD_H
|
||||
#define BOARD_H
|
||||
|
||||
/*===========================================================================*/
|
||||
/* Driver constants. */
|
||||
/*===========================================================================*/
|
||||
|
||||
/*
|
||||
* Setup for STMicroelectronics STM32 Nucleo64-G071RB board.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Board identifier.
|
||||
*/
|
||||
#define BOARD_ST_NUCLEO64_G071RB
|
||||
#define BOARD_NAME "STMicroelectronics STM32 Nucleo64-G071RB"
|
||||
|
||||
/*
|
||||
* Board oscillators-related settings.
|
||||
*/
|
||||
#if !defined(STM32_LSECLK)
|
||||
#define STM32_LSECLK 32768U
|
||||
#endif
|
||||
|
||||
#define STM32_LSEDRV (3U << 11U)
|
||||
|
||||
#if !defined(STM32_HSECLK)
|
||||
#define STM32_HSECLK 8000000U
|
||||
#endif
|
||||
|
||||
#define STM32_HSE_BYPASS
|
||||
|
||||
/*
|
||||
* MCU type as defined in the ST header.
|
||||
*/
|
||||
#define STM32G071xB
|
||||
|
||||
/*
|
||||
* IO pins assignments.
|
||||
*/
|
||||
#define GPIOA_PIN0 0U
|
||||
#define GPIOA_PIN1 1U
|
||||
#define GPIOA_LPUART1_TX 2U
|
||||
#define GPIOA_LPUART1_RX 3U
|
||||
#define GPIOA_PIN4 4U
|
||||
#define GPIOA_LED_GREEN 5U
|
||||
#define GPIOA_PIN6 6U
|
||||
#define GPIOA_PIN7 7U
|
||||
#define GPIOA_PIN8 8U
|
||||
#define GPIOA_PIN9 9U
|
||||
#define GPIOA_PIN10 10U
|
||||
#define GPIOA_PIN11 11U
|
||||
#define GPIOA_PIN12 12U
|
||||
#define GPIOA_SWDIO 13U
|
||||
#define GPIOA_SWCLK 14U
|
||||
#define GPIOA_PIN15 15U
|
||||
|
||||
#define GPIOB_PIN0 0U
|
||||
#define GPIOB_PIN1 1U
|
||||
#define GPIOB_PIN2 2U
|
||||
#define GPIOB_SWO 3U
|
||||
#define GPIOB_PIN4 4U
|
||||
#define GPIOB_PIN5 5U
|
||||
#define GPIOB_PIN6 6U
|
||||
#define GPIOB_PIN7 7U
|
||||
#define GPIOB_PIN8 8U
|
||||
#define GPIOB_PIN9 9U
|
||||
#define GPIOB_PIN10 10U
|
||||
#define GPIOB_PIN11 11U
|
||||
#define GPIOB_PIN12 12U
|
||||
#define GPIOB_PIN13 13U
|
||||
#define GPIOB_PIN14 14U
|
||||
#define GPIOB_PIN15 15U
|
||||
|
||||
#define GPIOC_PIN0 0U
|
||||
#define GPIOC_PIN1 1U
|
||||
#define GPIOC_PIN2 2U
|
||||
#define GPIOC_PIN3 3U
|
||||
#define GPIOC_PIN4 4U
|
||||
#define GPIOC_PIN5 5U
|
||||
#define GPIOC_PIN6 6U
|
||||
#define GPIOC_PIN7 7U
|
||||
#define GPIOC_PIN8 8U
|
||||
#define GPIOC_PIN9 9U
|
||||
#define GPIOC_PIN10 10U
|
||||
#define GPIOC_PIN11 11U
|
||||
#define GPIOC_PIN12 12U
|
||||
#define GPIOC_BUTTON 13U
|
||||
#define GPIOC_OSC32_IN 14U
|
||||
#define GPIOC_OSC32_OUT 15U
|
||||
|
||||
#define GPIOD_PIN0 0U
|
||||
#define GPIOD_PIN1 1U
|
||||
#define GPIOD_PIN2 2U
|
||||
#define GPIOD_PIN3 3U
|
||||
#define GPIOD_PIN4 4U
|
||||
#define GPIOD_PIN5 5U
|
||||
#define GPIOD_PIN6 6U
|
||||
#define GPIOD_PIN7 7U
|
||||
#define GPIOD_PIN8 8U
|
||||
#define GPIOD_PIN9 9U
|
||||
#define GPIOD_PIN10 10U
|
||||
#define GPIOD_PIN11 11U
|
||||
#define GPIOD_PIN12 12U
|
||||
#define GPIOD_PIN13 13U
|
||||
#define GPIOD_PIN14 14U
|
||||
#define GPIOD_PIN15 15U
|
||||
|
||||
#define GPIOF_OSC_IN 0U
|
||||
#define GPIOF_OSC_OUT 1U
|
||||
#define GPIOF_PIN2 2U
|
||||
#define GPIOF_PIN3 3U
|
||||
#define GPIOF_PIN4 4U
|
||||
#define GPIOF_PIN5 5U
|
||||
#define GPIOF_PIN6 6U
|
||||
#define GPIOF_PIN7 7U
|
||||
#define GPIOF_PIN8 8U
|
||||
#define GPIOF_PIN9 9U
|
||||
#define GPIOF_PIN10 10U
|
||||
#define GPIOF_PIN11 11U
|
||||
#define GPIOF_PIN12 12U
|
||||
#define GPIOF_PIN13 13U
|
||||
#define GPIOF_PIN14 14U
|
||||
#define GPIOF_PIN15 15U
|
||||
|
||||
/*
|
||||
* IO lines assignments.
|
||||
*/
|
||||
#define LINE_LPUART1_TX PAL_LINE(GPIOA, 2U)
|
||||
#define LINE_LPUART1_RX PAL_LINE(GPIOA, 3U)
|
||||
#define LINE_LED_GREEN PAL_LINE(GPIOA, 5U)
|
||||
#define LINE_SWDIO PAL_LINE(GPIOA, 13U)
|
||||
#define LINE_SWCLK PAL_LINE(GPIOA, 14U)
|
||||
#define LINE_SWO PAL_LINE(GPIOB, 3U)
|
||||
#define LINE_BUTTON PAL_LINE(GPIOC, 13U)
|
||||
#define LINE_OSC32_IN PAL_LINE(GPIOC, 14U)
|
||||
#define LINE_OSC32_OUT PAL_LINE(GPIOC, 15U)
|
||||
#define LINE_OSC_IN PAL_LINE(GPIOF, 0U)
|
||||
#define LINE_OSC_OUT PAL_LINE(GPIOF, 1U)
|
||||
|
||||
/*===========================================================================*/
|
||||
/* Driver pre-compile time settings. */
|
||||
/*===========================================================================*/
|
||||
|
||||
/*===========================================================================*/
|
||||
/* Derived constants and error checks. */
|
||||
/*===========================================================================*/
|
||||
|
||||
/*===========================================================================*/
|
||||
/* Driver data structures and types. */
|
||||
/*===========================================================================*/
|
||||
|
||||
/*===========================================================================*/
|
||||
/* Driver macros. */
|
||||
/*===========================================================================*/
|
||||
|
||||
/*
|
||||
* I/O ports initial setup, this configuration is established soon after reset
|
||||
* in the initialization code.
|
||||
* Please refer to the STM32 Reference Manual for details.
|
||||
*/
|
||||
#define PIN_MODE_INPUT(n) (0U << ((n) * 2U))
|
||||
#define PIN_MODE_OUTPUT(n) (1U << ((n) * 2U))
|
||||
#define PIN_MODE_ALTERNATE(n) (2U << ((n) * 2U))
|
||||
#define PIN_MODE_ANALOG(n) (3U << ((n) * 2U))
|
||||
#define PIN_ODR_LOW(n) (0U << (n))
|
||||
#define PIN_ODR_HIGH(n) (1U << (n))
|
||||
#define PIN_OTYPE_PUSHPULL(n) (0U << (n))
|
||||
#define PIN_OTYPE_OPENDRAIN(n) (1U << (n))
|
||||
#define PIN_OSPEED_VERYLOW(n) (0U << ((n) * 2U))
|
||||
#define PIN_OSPEED_LOW(n) (1U << ((n) * 2U))
|
||||
#define PIN_OSPEED_MEDIUM(n) (2U << ((n) * 2U))
|
||||
#define PIN_OSPEED_HIGH(n) (3U << ((n) * 2U))
|
||||
#define PIN_PUPDR_FLOATING(n) (0U << ((n) * 2U))
|
||||
#define PIN_PUPDR_PULLUP(n) (1U << ((n) * 2U))
|
||||
#define PIN_PUPDR_PULLDOWN(n) (2U << ((n) * 2U))
|
||||
#define PIN_AFIO_AF(n, v) ((v) << (((n) % 8U) * 4U))
|
||||
|
||||
/*
|
||||
* GPIOA setup:
|
||||
*
|
||||
* PA0 - PIN0 (input pullup).
|
||||
* PA1 - PIN1 (input pullup).
|
||||
* PA2 - LPUART1_TX (alternate 6).
|
||||
* PA3 - LPUART1_RX (alternate 6).
|
||||
* PA4 - PIN4 (input pullup).
|
||||
* PA5 - LED_GREEN (output pushpull maximum).
|
||||
* PA6 - PIN6 (input pullup).
|
||||
* PA7 - PIN7 (input pullup).
|
||||
* PA8 - PIN8 (input pullup).
|
||||
* PA9 - PIN9 (input pullup).
|
||||
* PA10 - PIN10 (input pullup).
|
||||
* PA11 - PIN11 (input pullup).
|
||||
* PA12 - PIN12 (input pullup).
|
||||
* PA13 - SWDIO (alternate 0).
|
||||
* PA14 - SWCLK (alternate 0).
|
||||
* PA15 - PIN15 (input pullup).
|
||||
*/
|
||||
#define VAL_GPIOA_MODER (PIN_MODE_INPUT(GPIOA_PIN0) | \
|
||||
PIN_MODE_INPUT(GPIOA_PIN1) | \
|
||||
PIN_MODE_ALTERNATE(GPIOA_LPUART1_TX) | \
|
||||
PIN_MODE_ALTERNATE(GPIOA_LPUART1_RX) | \
|
||||
PIN_MODE_INPUT(GPIOA_PIN4) | \
|
||||
PIN_MODE_OUTPUT(GPIOA_LED_GREEN) | \
|
||||
PIN_MODE_INPUT(GPIOA_PIN6) | \
|
||||
PIN_MODE_INPUT(GPIOA_PIN7) | \
|
||||
PIN_MODE_INPUT(GPIOA_PIN8) | \
|
||||
PIN_MODE_INPUT(GPIOA_PIN9) | \
|
||||
PIN_MODE_INPUT(GPIOA_PIN10) | \
|
||||
PIN_MODE_INPUT(GPIOA_PIN11) | \
|
||||
PIN_MODE_INPUT(GPIOA_PIN12) | \
|
||||
PIN_MODE_ALTERNATE(GPIOA_SWDIO) | \
|
||||
PIN_MODE_ALTERNATE(GPIOA_SWCLK) | \
|
||||
PIN_MODE_INPUT(GPIOA_PIN15))
|
||||
#define VAL_GPIOA_OTYPER (PIN_OTYPE_PUSHPULL(GPIOA_PIN0) | \
|
||||
PIN_OTYPE_PUSHPULL(GPIOA_PIN1) | \
|
||||
PIN_OTYPE_PUSHPULL(GPIOA_LPUART1_TX) | \
|
||||
PIN_OTYPE_PUSHPULL(GPIOA_LPUART1_RX) | \
|
||||
PIN_OTYPE_PUSHPULL(GPIOA_PIN4) | \
|
||||
PIN_OTYPE_PUSHPULL(GPIOA_LED_GREEN) | \
|
||||
PIN_OTYPE_PUSHPULL(GPIOA_PIN6) | \
|
||||
PIN_OTYPE_PUSHPULL(GPIOA_PIN7) | \
|
||||
PIN_OTYPE_PUSHPULL(GPIOA_PIN8) | \
|
||||
PIN_OTYPE_PUSHPULL(GPIOA_PIN9) | \
|
||||
PIN_OTYPE_PUSHPULL(GPIOA_PIN10) | \
|
||||
PIN_OTYPE_PUSHPULL(GPIOA_PIN11) | \
|
||||
PIN_OTYPE_PUSHPULL(GPIOA_PIN12) | \
|
||||
PIN_OTYPE_PUSHPULL(GPIOA_SWDIO) | \
|
||||
PIN_OTYPE_PUSHPULL(GPIOA_SWCLK) | \
|
||||
PIN_OTYPE_PUSHPULL(GPIOA_PIN15))
|
||||
#define VAL_GPIOA_OSPEEDR (PIN_OSPEED_HIGH(GPIOA_PIN0) | \
|
||||
PIN_OSPEED_HIGH(GPIOA_PIN1) | \
|
||||
PIN_OSPEED_MEDIUM(GPIOA_LPUART1_TX) | \
|
||||
PIN_OSPEED_MEDIUM(GPIOA_LPUART1_RX) | \
|
||||
PIN_OSPEED_HIGH(GPIOA_PIN4) | \
|
||||
PIN_OSPEED_HIGH(GPIOA_LED_GREEN) | \
|
||||
PIN_OSPEED_HIGH(GPIOA_PIN6) | \
|
||||
PIN_OSPEED_HIGH(GPIOA_PIN7) | \
|
||||
PIN_OSPEED_HIGH(GPIOA_PIN8) | \
|
||||
PIN_OSPEED_HIGH(GPIOA_PIN9) | \
|
||||
PIN_OSPEED_HIGH(GPIOA_PIN10) | \
|
||||
PIN_OSPEED_HIGH(GPIOA_PIN11) | \
|
||||
PIN_OSPEED_HIGH(GPIOA_PIN12) | \
|
||||
PIN_OSPEED_HIGH(GPIOA_SWDIO) | \
|
||||
PIN_OSPEED_HIGH(GPIOA_SWCLK) | \
|
||||
PIN_OSPEED_HIGH(GPIOA_PIN15))
|
||||
#define VAL_GPIOA_PUPDR (PIN_PUPDR_PULLUP(GPIOA_PIN0) | \
|
||||
PIN_PUPDR_PULLUP(GPIOA_PIN1) | \
|
||||
PIN_PUPDR_FLOATING(GPIOA_LPUART1_TX) | \
|
||||
PIN_PUPDR_FLOATING(GPIOA_LPUART1_RX) | \
|
||||
PIN_PUPDR_PULLUP(GPIOA_PIN4) | \
|
||||
PIN_PUPDR_FLOATING(GPIOA_LED_GREEN) | \
|
||||
PIN_PUPDR_PULLUP(GPIOA_PIN6) | \
|
||||
PIN_PUPDR_PULLUP(GPIOA_PIN7) | \
|
||||
PIN_PUPDR_PULLUP(GPIOA_PIN8) | \
|
||||
PIN_PUPDR_PULLUP(GPIOA_PIN9) | \
|
||||
PIN_PUPDR_PULLUP(GPIOA_PIN10) | \
|
||||
PIN_PUPDR_PULLUP(GPIOA_PIN11) | \
|
||||
PIN_PUPDR_PULLUP(GPIOA_PIN12) | \
|
||||
PIN_PUPDR_PULLUP(GPIOA_SWDIO) | \
|
||||
PIN_PUPDR_PULLDOWN(GPIOA_SWCLK) | \
|
||||
PIN_PUPDR_PULLUP(GPIOA_PIN15))
|
||||
#define VAL_GPIOA_ODR (PIN_ODR_HIGH(GPIOA_PIN0) | \
|
||||
PIN_ODR_HIGH(GPIOA_PIN1) | \
|
||||
PIN_ODR_HIGH(GPIOA_LPUART1_TX) | \
|
||||
PIN_ODR_HIGH(GPIOA_LPUART1_RX) | \
|
||||
PIN_ODR_HIGH(GPIOA_PIN4) | \
|
||||
PIN_ODR_LOW(GPIOA_LED_GREEN) | \
|
||||
PIN_ODR_HIGH(GPIOA_PIN6) | \
|
||||
PIN_ODR_HIGH(GPIOA_PIN7) | \
|
||||
PIN_ODR_HIGH(GPIOA_PIN8) | \
|
||||
PIN_ODR_HIGH(GPIOA_PIN9) | \
|
||||
PIN_ODR_HIGH(GPIOA_PIN10) | \
|
||||
PIN_ODR_HIGH(GPIOA_PIN11) | \
|
||||
PIN_ODR_HIGH(GPIOA_PIN12) | \
|
||||
PIN_ODR_HIGH(GPIOA_SWDIO) | \
|
||||
PIN_ODR_HIGH(GPIOA_SWCLK) | \
|
||||
PIN_ODR_HIGH(GPIOA_PIN15))
|
||||
#define VAL_GPIOA_AFRL (PIN_AFIO_AF(GPIOA_PIN0, 0U) | \
|
||||
PIN_AFIO_AF(GPIOA_PIN1, 0U) | \
|
||||
PIN_AFIO_AF(GPIOA_LPUART1_TX, 6U) | \
|
||||
PIN_AFIO_AF(GPIOA_LPUART1_RX, 6U) | \
|
||||
PIN_AFIO_AF(GPIOA_PIN4, 0U) | \
|
||||
PIN_AFIO_AF(GPIOA_LED_GREEN, 0U) | \
|
||||
PIN_AFIO_AF(GPIOA_PIN6, 0U) | \
|
||||
PIN_AFIO_AF(GPIOA_PIN7, 0U))
|
||||
#define VAL_GPIOA_AFRH (PIN_AFIO_AF(GPIOA_PIN8, 0U) | \
|
||||
PIN_AFIO_AF(GPIOA_PIN9, 0U) | \
|
||||
PIN_AFIO_AF(GPIOA_PIN10, 0U) | \
|
||||
PIN_AFIO_AF(GPIOA_PIN11, 0U) | \
|
||||
PIN_AFIO_AF(GPIOA_PIN12, 0U) | \
|
||||
PIN_AFIO_AF(GPIOA_SWDIO, 0U) | \
|
||||
PIN_AFIO_AF(GPIOA_SWCLK, 0U) | \
|
||||
PIN_AFIO_AF(GPIOA_PIN15, 0U))
|
||||
|
||||
/*
|
||||
* GPIOB setup:
|
||||
*
|
||||
* PB0 - PIN0 (input pullup).
|
||||
* PB1 - PIN1 (input pullup).
|
||||
* PB2 - PIN2 (input pullup).
|
||||
* PB3 - SWO (alternate 0).
|
||||
* PB4 - PIN4 (input pullup).
|
||||
* PB5 - PIN5 (input pullup).
|
||||
* PB6 - PIN6 (input pullup).
|
||||
* PB7 - PIN7 (input pullup).
|
||||
* PB8 - PIN8 (input pullup).
|
||||
* PB9 - PIN9 (input pullup).
|
||||
* PB10 - PIN10 (input pullup).
|
||||
* PB11 - PIN11 (input pullup).
|
||||
* PB12 - PIN12 (input pullup).
|
||||
* PB13 - PIN13 (input pullup).
|
||||
* PB14 - PIN14 (input pullup).
|
||||
* PB15 - PIN15 (input pullup).
|
||||
*/
|
||||
#define VAL_GPIOB_MODER (PIN_MODE_INPUT(GPIOB_PIN0) | \
|
||||
PIN_MODE_INPUT(GPIOB_PIN1) | \
|
||||
PIN_MODE_INPUT(GPIOB_PIN2) | \
|
||||
PIN_MODE_ALTERNATE(GPIOB_SWO) | \
|
||||
PIN_MODE_INPUT(GPIOB_PIN4) | \
|
||||
PIN_MODE_INPUT(GPIOB_PIN5) | \
|
||||
PIN_MODE_INPUT(GPIOB_PIN6) | \
|
||||
PIN_MODE_INPUT(GPIOB_PIN7) | \
|
||||
PIN_MODE_INPUT(GPIOB_PIN8) | \
|
||||
PIN_MODE_INPUT(GPIOB_PIN9) | \
|
||||
PIN_MODE_INPUT(GPIOB_PIN10) | \
|
||||
PIN_MODE_INPUT(GPIOB_PIN11) | \
|
||||
PIN_MODE_INPUT(GPIOB_PIN12) | \
|
||||
PIN_MODE_INPUT(GPIOB_PIN13) | \
|
||||
PIN_MODE_INPUT(GPIOB_PIN14) | \
|
||||
PIN_MODE_INPUT(GPIOB_PIN15))
|
||||
#define VAL_GPIOB_OTYPER (PIN_OTYPE_PUSHPULL(GPIOB_PIN0) | \
|
||||
PIN_OTYPE_PUSHPULL(GPIOB_PIN1) | \
|
||||
PIN_OTYPE_PUSHPULL(GPIOB_PIN2) | \
|
||||
PIN_OTYPE_PUSHPULL(GPIOB_SWO) | \
|
||||
PIN_OTYPE_PUSHPULL(GPIOB_PIN4) | \
|
||||
PIN_OTYPE_PUSHPULL(GPIOB_PIN5) | \
|
||||
PIN_OTYPE_PUSHPULL(GPIOB_PIN6) | \
|
||||
PIN_OTYPE_PUSHPULL(GPIOB_PIN7) | \
|
||||
PIN_OTYPE_PUSHPULL(GPIOB_PIN8) | \
|
||||
PIN_OTYPE_PUSHPULL(GPIOB_PIN9) | \
|
||||
PIN_OTYPE_PUSHPULL(GPIOB_PIN10) | \
|
||||
PIN_OTYPE_PUSHPULL(GPIOB_PIN11) | \
|
||||
PIN_OTYPE_PUSHPULL(GPIOB_PIN12) | \
|
||||
PIN_OTYPE_PUSHPULL(GPIOB_PIN13) | \
|
||||
PIN_OTYPE_PUSHPULL(GPIOB_PIN14) | \
|
||||
PIN_OTYPE_PUSHPULL(GPIOB_PIN15))
|
||||
#define VAL_GPIOB_OSPEEDR (PIN_OSPEED_HIGH(GPIOB_PIN0) | \
|
||||
PIN_OSPEED_HIGH(GPIOB_PIN1) | \
|
||||
PIN_OSPEED_HIGH(GPIOB_PIN2) | \
|
||||
PIN_OSPEED_HIGH(GPIOB_SWO) | \
|
||||
PIN_OSPEED_HIGH(GPIOB_PIN4) | \
|
||||
PIN_OSPEED_HIGH(GPIOB_PIN5) | \
|
||||
PIN_OSPEED_HIGH(GPIOB_PIN6) | \
|
||||
PIN_OSPEED_HIGH(GPIOB_PIN7) | \
|
||||
PIN_OSPEED_HIGH(GPIOB_PIN8) | \
|
||||
PIN_OSPEED_HIGH(GPIOB_PIN9) | \
|
||||
PIN_OSPEED_HIGH(GPIOB_PIN10) | \
|
||||
PIN_OSPEED_HIGH(GPIOB_PIN11) | \
|
||||
PIN_OSPEED_HIGH(GPIOB_PIN12) | \
|
||||
PIN_OSPEED_HIGH(GPIOB_PIN13) | \
|
||||
PIN_OSPEED_HIGH(GPIOB_PIN14) | \
|
||||
PIN_OSPEED_HIGH(GPIOB_PIN15))
|
||||
#define VAL_GPIOB_PUPDR (PIN_PUPDR_PULLUP(GPIOB_PIN0) | \
|
||||
PIN_PUPDR_PULLUP(GPIOB_PIN1) | \
|
||||
PIN_PUPDR_PULLUP(GPIOB_PIN2) | \
|
||||
PIN_PUPDR_PULLUP(GPIOB_SWO) | \
|
||||
PIN_PUPDR_PULLUP(GPIOB_PIN4) | \
|
||||
PIN_PUPDR_PULLUP(GPIOB_PIN5) | \
|
||||
PIN_PUPDR_PULLUP(GPIOB_PIN6) | \
|
||||
PIN_PUPDR_PULLUP(GPIOB_PIN7) | \
|
||||
PIN_PUPDR_PULLUP(GPIOB_PIN8) | \
|
||||
PIN_PUPDR_PULLUP(GPIOB_PIN9) | \
|
||||
PIN_PUPDR_PULLUP(GPIOB_PIN10) | \
|
||||
PIN_PUPDR_PULLUP(GPIOB_PIN11) | \
|
||||
PIN_PUPDR_PULLUP(GPIOB_PIN12) | \
|
||||
PIN_PUPDR_PULLUP(GPIOB_PIN13) | \
|
||||
PIN_PUPDR_PULLUP(GPIOB_PIN14) | \
|
||||
PIN_PUPDR_PULLUP(GPIOB_PIN15))
|
||||
#define VAL_GPIOB_ODR (PIN_ODR_HIGH(GPIOB_PIN0) | \
|
||||
PIN_ODR_HIGH(GPIOB_PIN1) | \
|
||||
PIN_ODR_HIGH(GPIOB_PIN2) | \
|
||||
PIN_ODR_HIGH(GPIOB_SWO) | \
|
||||
PIN_ODR_HIGH(GPIOB_PIN4) | \
|
||||
PIN_ODR_HIGH(GPIOB_PIN5) | \
|
||||
PIN_ODR_HIGH(GPIOB_PIN6) | \
|
||||
PIN_ODR_HIGH(GPIOB_PIN7) | \
|
||||
PIN_ODR_HIGH(GPIOB_PIN8) | \
|
||||
PIN_ODR_HIGH(GPIOB_PIN9) | \
|
||||
PIN_ODR_HIGH(GPIOB_PIN10) | \
|
||||
PIN_ODR_HIGH(GPIOB_PIN11) | \
|
||||
PIN_ODR_HIGH(GPIOB_PIN12) | \
|
||||
PIN_ODR_HIGH(GPIOB_PIN13) | \
|
||||
PIN_ODR_HIGH(GPIOB_PIN14) | \
|
||||
PIN_ODR_HIGH(GPIOB_PIN15))
|
||||
#define VAL_GPIOB_AFRL (PIN_AFIO_AF(GPIOB_PIN0, 0U) | \
|
||||
PIN_AFIO_AF(GPIOB_PIN1, 0U) | \
|
||||
PIN_AFIO_AF(GPIOB_PIN2, 0U) | \
|
||||
PIN_AFIO_AF(GPIOB_SWO, 0U) | \
|
||||
PIN_AFIO_AF(GPIOB_PIN4, 0U) | \
|
||||
PIN_AFIO_AF(GPIOB_PIN5, 0U) | \
|
||||
PIN_AFIO_AF(GPIOB_PIN6, 0U) | \
|
||||
PIN_AFIO_AF(GPIOB_PIN7, 0U))
|
||||
#define VAL_GPIOB_AFRH (PIN_AFIO_AF(GPIOB_PIN8, 0U) | \
|
||||
PIN_AFIO_AF(GPIOB_PIN9, 0U) | \
|
||||
PIN_AFIO_AF(GPIOB_PIN10, 0U) | \
|
||||
PIN_AFIO_AF(GPIOB_PIN11, 0U) | \
|
||||
PIN_AFIO_AF(GPIOB_PIN12, 0U) | \
|
||||
PIN_AFIO_AF(GPIOB_PIN13, 0U) | \
|
||||
PIN_AFIO_AF(GPIOB_PIN14, 0U) | \
|
||||
PIN_AFIO_AF(GPIOB_PIN15, 0U))
|
||||
|
||||
/*
|
||||
* GPIOC setup:
|
||||
*
|
||||
* PC0 - PIN0 (input pullup).
|
||||
* PC1 - PIN1 (input pullup).
|
||||
* PC2 - PIN2 (input pullup).
|
||||
* PC3 - PIN3 (input pullup).
|
||||
* PC4 - PIN4 (input pullup).
|
||||
* PC5 - PIN5 (input pullup).
|
||||
* PC6 - PIN6 (input pullup).
|
||||
* PC7 - PIN7 (input pullup).
|
||||
* PC8 - PIN8 (input pullup).
|
||||
* PC9 - PIN9 (input pullup).
|
||||
* PC10 - PIN10 (input pullup).
|
||||
* PC11 - PIN11 (input pullup).
|
||||
* PC12 - PIN12 (input pullup).
|
||||
* PC13 - BUTTON (input floating).
|
||||
* PC14 - OSC32_IN (input floating).
|
||||
* PC15 - OSC32_OUT (input floating).
|
||||
*/
|
||||
#define VAL_GPIOC_MODER (PIN_MODE_INPUT(GPIOC_PIN0) | \
|
||||
PIN_MODE_INPUT(GPIOC_PIN1) | \
|
||||
PIN_MODE_INPUT(GPIOC_PIN2) | \
|
||||
PIN_MODE_INPUT(GPIOC_PIN3) | \
|
||||
PIN_MODE_INPUT(GPIOC_PIN4) | \
|
||||
PIN_MODE_INPUT(GPIOC_PIN5) | \
|
||||
PIN_MODE_INPUT(GPIOC_PIN6) | \
|
||||
PIN_MODE_INPUT(GPIOC_PIN7) | \
|
||||
PIN_MODE_INPUT(GPIOC_PIN8) | \
|
||||
PIN_MODE_INPUT(GPIOC_PIN9) | \
|
||||
PIN_MODE_INPUT(GPIOC_PIN10) | \
|
||||
PIN_MODE_INPUT(GPIOC_PIN11) | \
|
||||
PIN_MODE_INPUT(GPIOC_PIN12) | \
|
||||
PIN_MODE_INPUT(GPIOC_BUTTON) | \
|
||||
PIN_MODE_INPUT(GPIOC_OSC32_IN) | \
|
||||
PIN_MODE_INPUT(GPIOC_OSC32_OUT))
|
||||
#define VAL_GPIOC_OTYPER (PIN_OTYPE_PUSHPULL(GPIOC_PIN0) | \
|
||||
PIN_OTYPE_PUSHPULL(GPIOC_PIN1) | \
|
||||
PIN_OTYPE_PUSHPULL(GPIOC_PIN2) | \
|
||||
PIN_OTYPE_PUSHPULL(GPIOC_PIN3) | \
|
||||
PIN_OTYPE_PUSHPULL(GPIOC_PIN4) | \
|
||||
PIN_OTYPE_PUSHPULL(GPIOC_PIN5) | \
|
||||
PIN_OTYPE_PUSHPULL(GPIOC_PIN6) | \
|
||||
PIN_OTYPE_PUSHPULL(GPIOC_PIN7) | \
|
||||
PIN_OTYPE_PUSHPULL(GPIOC_PIN8) | \
|
||||
PIN_OTYPE_PUSHPULL(GPIOC_PIN9) | \
|
||||
PIN_OTYPE_PUSHPULL(GPIOC_PIN10) | \
|
||||
PIN_OTYPE_PUSHPULL(GPIOC_PIN11) | \
|
||||
PIN_OTYPE_PUSHPULL(GPIOC_PIN12) | \
|
||||
PIN_OTYPE_PUSHPULL(GPIOC_BUTTON) | \
|
||||
PIN_OTYPE_PUSHPULL(GPIOC_OSC32_IN) | \
|
||||
PIN_OTYPE_PUSHPULL(GPIOC_OSC32_OUT))
|
||||
#define VAL_GPIOC_OSPEEDR (PIN_OSPEED_HIGH(GPIOC_PIN0) | \
|
||||
PIN_OSPEED_HIGH(GPIOC_PIN1) | \
|
||||
PIN_OSPEED_HIGH(GPIOC_PIN2) | \
|
||||
PIN_OSPEED_HIGH(GPIOC_PIN3) | \
|
||||
PIN_OSPEED_HIGH(GPIOC_PIN4) | \
|
||||
PIN_OSPEED_HIGH(GPIOC_PIN5) | \
|
||||
PIN_OSPEED_HIGH(GPIOC_PIN6) | \
|
||||
PIN_OSPEED_HIGH(GPIOC_PIN7) | \
|
||||
PIN_OSPEED_HIGH(GPIOC_PIN8) | \
|
||||
PIN_OSPEED_HIGH(GPIOC_PIN9) | \
|
||||
PIN_OSPEED_HIGH(GPIOC_PIN10) | \
|
||||
PIN_OSPEED_HIGH(GPIOC_PIN11) | \
|
||||
PIN_OSPEED_HIGH(GPIOC_PIN12) | \
|
||||
PIN_OSPEED_HIGH(GPIOC_BUTTON) | \
|
||||
PIN_OSPEED_HIGH(GPIOC_OSC32_IN) | \
|
||||
PIN_OSPEED_HIGH(GPIOC_OSC32_OUT))
|
||||
#define VAL_GPIOC_PUPDR (PIN_PUPDR_PULLUP(GPIOC_PIN0) | \
|
||||
PIN_PUPDR_PULLUP(GPIOC_PIN1) | \
|
||||
PIN_PUPDR_PULLUP(GPIOC_PIN2) | \
|
||||
PIN_PUPDR_PULLUP(GPIOC_PIN3) | \
|
||||
PIN_PUPDR_PULLUP(GPIOC_PIN4) | \
|
||||
PIN_PUPDR_PULLUP(GPIOC_PIN5) | \
|
||||
PIN_PUPDR_PULLUP(GPIOC_PIN6) | \
|
||||
PIN_PUPDR_PULLUP(GPIOC_PIN7) | \
|
||||
PIN_PUPDR_PULLUP(GPIOC_PIN8) | \
|
||||
PIN_PUPDR_PULLUP(GPIOC_PIN9) | \
|
||||
PIN_PUPDR_PULLUP(GPIOC_PIN10) | \
|
||||
PIN_PUPDR_PULLUP(GPIOC_PIN11) | \
|
||||
PIN_PUPDR_PULLUP(GPIOC_PIN12) | \
|
||||
PIN_PUPDR_FLOATING(GPIOC_BUTTON) | \
|
||||
PIN_PUPDR_FLOATING(GPIOC_OSC32_IN) | \
|
||||
PIN_PUPDR_FLOATING(GPIOC_OSC32_OUT))
|
||||
#define VAL_GPIOC_ODR (PIN_ODR_HIGH(GPIOC_PIN0) | \
|
||||
PIN_ODR_HIGH(GPIOC_PIN1) | \
|
||||
PIN_ODR_HIGH(GPIOC_PIN2) | \
|
||||
PIN_ODR_HIGH(GPIOC_PIN3) | \
|
||||
PIN_ODR_HIGH(GPIOC_PIN4) | \
|
||||
PIN_ODR_HIGH(GPIOC_PIN5) | \
|
||||
PIN_ODR_HIGH(GPIOC_PIN6) | \
|
||||
PIN_ODR_HIGH(GPIOC_PIN7) | \
|
||||
PIN_ODR_HIGH(GPIOC_PIN8) | \
|
||||
PIN_ODR_HIGH(GPIOC_PIN9) | \
|
||||
PIN_ODR_HIGH(GPIOC_PIN10) | \
|
||||
PIN_ODR_HIGH(GPIOC_PIN11) | \
|
||||
PIN_ODR_HIGH(GPIOC_PIN12) | \
|
||||
PIN_ODR_HIGH(GPIOC_BUTTON) | \
|
||||
PIN_ODR_HIGH(GPIOC_OSC32_IN) | \
|
||||
PIN_ODR_HIGH(GPIOC_OSC32_OUT))
|
||||
#define VAL_GPIOC_AFRL (PIN_AFIO_AF(GPIOC_PIN0, 0U) | \
|
||||
PIN_AFIO_AF(GPIOC_PIN1, 0U) | \
|
||||
PIN_AFIO_AF(GPIOC_PIN2, 0U) | \
|
||||
PIN_AFIO_AF(GPIOC_PIN3, 0U) | \
|
||||
PIN_AFIO_AF(GPIOC_PIN4, 0U) | \
|
||||
PIN_AFIO_AF(GPIOC_PIN5, 0U) | \
|
||||
PIN_AFIO_AF(GPIOC_PIN6, 0U) | \
|
||||
PIN_AFIO_AF(GPIOC_PIN7, 0U))
|
||||
#define VAL_GPIOC_AFRH (PIN_AFIO_AF(GPIOC_PIN8, 0U) | \
|
||||
PIN_AFIO_AF(GPIOC_PIN9, 0U) | \
|
||||
PIN_AFIO_AF(GPIOC_PIN10, 0U) | \
|
||||
PIN_AFIO_AF(GPIOC_PIN11, 0U) | \
|
||||
PIN_AFIO_AF(GPIOC_PIN12, 0U) | \
|
||||
PIN_AFIO_AF(GPIOC_BUTTON, 0U) | \
|
||||
PIN_AFIO_AF(GPIOC_OSC32_IN, 0U) | \
|
||||
PIN_AFIO_AF(GPIOC_OSC32_OUT, 0U))
|
||||
|
||||
/*
|
||||
* GPIOD setup:
|
||||
*
|
||||
* PD0 - PIN0 (input pullup).
|
||||
* PD1 - PIN1 (input pullup).
|
||||
* PD2 - PIN2 (input pullup).
|
||||
* PD3 - PIN3 (input pullup).
|
||||
* PD4 - PIN4 (input pullup).
|
||||
* PD5 - PIN5 (input pullup).
|
||||
* PD6 - PIN6 (input pullup).
|
||||
* PD7 - PIN7 (input pullup).
|
||||
* PD8 - PIN8 (input pullup).
|
||||
* PD9 - PIN9 (input pullup).
|
||||
* PD10 - PIN10 (input pullup).
|
||||
* PD11 - PIN11 (input pullup).
|
||||
* PD12 - PIN12 (input pullup).
|
||||
* PD13 - PIN13 (input pullup).
|
||||
* PD14 - PIN14 (input pullup).
|
||||
* PD15 - PIN15 (input pullup).
|
||||
*/
|
||||
#define VAL_GPIOD_MODER (PIN_MODE_INPUT(GPIOD_PIN0) | \
|
||||
PIN_MODE_INPUT(GPIOD_PIN1) | \
|
||||
PIN_MODE_INPUT(GPIOD_PIN2) | \
|
||||
PIN_MODE_INPUT(GPIOD_PIN3) | \
|
||||
PIN_MODE_INPUT(GPIOD_PIN4) | \
|
||||
PIN_MODE_INPUT(GPIOD_PIN5) | \
|
||||
PIN_MODE_INPUT(GPIOD_PIN6) | \
|
||||
PIN_MODE_INPUT(GPIOD_PIN7) | \
|
||||
PIN_MODE_INPUT(GPIOD_PIN8) | \
|
||||
PIN_MODE_INPUT(GPIOD_PIN9) | \
|
||||
PIN_MODE_INPUT(GPIOD_PIN10) | \
|
||||
PIN_MODE_INPUT(GPIOD_PIN11) | \
|
||||
PIN_MODE_INPUT(GPIOD_PIN12) | \
|
||||
PIN_MODE_INPUT(GPIOD_PIN13) | \
|
||||
PIN_MODE_INPUT(GPIOD_PIN14) | \
|
||||
PIN_MODE_INPUT(GPIOD_PIN15))
|
||||
#define VAL_GPIOD_OTYPER (PIN_OTYPE_PUSHPULL(GPIOD_PIN0) | \
|
||||
PIN_OTYPE_PUSHPULL(GPIOD_PIN1) | \
|
||||
PIN_OTYPE_PUSHPULL(GPIOD_PIN2) | \
|
||||
PIN_OTYPE_PUSHPULL(GPIOD_PIN3) | \
|
||||
PIN_OTYPE_PUSHPULL(GPIOD_PIN4) | \
|
||||
PIN_OTYPE_PUSHPULL(GPIOD_PIN5) | \
|
||||
PIN_OTYPE_PUSHPULL(GPIOD_PIN6) | \
|
||||
PIN_OTYPE_PUSHPULL(GPIOD_PIN7) | \
|
||||
PIN_OTYPE_PUSHPULL(GPIOD_PIN8) | \
|
||||
PIN_OTYPE_PUSHPULL(GPIOD_PIN9) | \
|
||||
PIN_OTYPE_PUSHPULL(GPIOD_PIN10) | \
|
||||
PIN_OTYPE_PUSHPULL(GPIOD_PIN11) | \
|
||||
PIN_OTYPE_PUSHPULL(GPIOD_PIN12) | \
|
||||
PIN_OTYPE_PUSHPULL(GPIOD_PIN13) | \
|
||||
PIN_OTYPE_PUSHPULL(GPIOD_PIN14) | \
|
||||
PIN_OTYPE_PUSHPULL(GPIOD_PIN15))
|
||||
#define VAL_GPIOD_OSPEEDR (PIN_OSPEED_HIGH(GPIOD_PIN0) | \
|
||||
PIN_OSPEED_HIGH(GPIOD_PIN1) | \
|
||||
PIN_OSPEED_HIGH(GPIOD_PIN2) | \
|
||||
PIN_OSPEED_HIGH(GPIOD_PIN3) | \
|
||||
PIN_OSPEED_HIGH(GPIOD_PIN4) | \
|
||||
PIN_OSPEED_HIGH(GPIOD_PIN5) | \
|
||||
PIN_OSPEED_HIGH(GPIOD_PIN6) | \
|
||||
PIN_OSPEED_HIGH(GPIOD_PIN7) | \
|
||||
PIN_OSPEED_HIGH(GPIOD_PIN8) | \
|
||||
PIN_OSPEED_HIGH(GPIOD_PIN9) | \
|
||||
PIN_OSPEED_HIGH(GPIOD_PIN10) | \
|
||||
PIN_OSPEED_HIGH(GPIOD_PIN11) | \
|
||||
PIN_OSPEED_HIGH(GPIOD_PIN12) | \
|
||||
PIN_OSPEED_HIGH(GPIOD_PIN13) | \
|
||||
PIN_OSPEED_HIGH(GPIOD_PIN14) | \
|
||||
PIN_OSPEED_HIGH(GPIOD_PIN15))
|
||||
#define VAL_GPIOD_PUPDR (PIN_PUPDR_PULLUP(GPIOD_PIN0) | \
|
||||
PIN_PUPDR_PULLUP(GPIOD_PIN1) | \
|
||||
PIN_PUPDR_PULLUP(GPIOD_PIN2) | \
|
||||
PIN_PUPDR_PULLUP(GPIOD_PIN3) | \
|
||||
PIN_PUPDR_PULLUP(GPIOD_PIN4) | \
|
||||
PIN_PUPDR_PULLUP(GPIOD_PIN5) | \
|
||||
PIN_PUPDR_PULLUP(GPIOD_PIN6) | \
|
||||
PIN_PUPDR_PULLUP(GPIOD_PIN7) | \
|
||||
PIN_PUPDR_PULLUP(GPIOD_PIN8) | \
|
||||
PIN_PUPDR_PULLUP(GPIOD_PIN9) | \
|
||||
PIN_PUPDR_PULLUP(GPIOD_PIN10) | \
|
||||
PIN_PUPDR_PULLUP(GPIOD_PIN11) | \
|
||||
PIN_PUPDR_PULLUP(GPIOD_PIN12) | \
|
||||
PIN_PUPDR_PULLUP(GPIOD_PIN13) | \
|
||||
PIN_PUPDR_PULLUP(GPIOD_PIN14) | \
|
||||
PIN_PUPDR_PULLUP(GPIOD_PIN15))
|
||||
#define VAL_GPIOD_ODR (PIN_ODR_HIGH(GPIOD_PIN0) | \
|
||||
PIN_ODR_HIGH(GPIOD_PIN1) | \
|
||||
PIN_ODR_HIGH(GPIOD_PIN2) | \
|
||||
PIN_ODR_HIGH(GPIOD_PIN3) | \
|
||||
PIN_ODR_HIGH(GPIOD_PIN4) | \
|
||||
PIN_ODR_HIGH(GPIOD_PIN5) | \
|
||||
PIN_ODR_HIGH(GPIOD_PIN6) | \
|
||||
PIN_ODR_HIGH(GPIOD_PIN7) | \
|
||||
PIN_ODR_HIGH(GPIOD_PIN8) | \
|
||||
PIN_ODR_HIGH(GPIOD_PIN9) | \
|
||||
PIN_ODR_HIGH(GPIOD_PIN10) | \
|
||||
PIN_ODR_HIGH(GPIOD_PIN11) | \
|
||||
PIN_ODR_HIGH(GPIOD_PIN12) | \
|
||||
PIN_ODR_HIGH(GPIOD_PIN13) | \
|
||||
PIN_ODR_HIGH(GPIOD_PIN14) | \
|
||||
PIN_ODR_HIGH(GPIOD_PIN15))
|
||||
#define VAL_GPIOD_AFRL (PIN_AFIO_AF(GPIOD_PIN0, 0U) | \
|
||||
PIN_AFIO_AF(GPIOD_PIN1, 0U) | \
|
||||
PIN_AFIO_AF(GPIOD_PIN2, 0U) | \
|
||||
PIN_AFIO_AF(GPIOD_PIN3, 0U) | \
|
||||
PIN_AFIO_AF(GPIOD_PIN4, 0U) | \
|
||||
PIN_AFIO_AF(GPIOD_PIN5, 0U) | \
|
||||
PIN_AFIO_AF(GPIOD_PIN6, 0U) | \
|
||||
PIN_AFIO_AF(GPIOD_PIN7, 0U))
|
||||
#define VAL_GPIOD_AFRH (PIN_AFIO_AF(GPIOD_PIN8, 0U) | \
|
||||
PIN_AFIO_AF(GPIOD_PIN9, 0U) | \
|
||||
PIN_AFIO_AF(GPIOD_PIN10, 0U) | \
|
||||
PIN_AFIO_AF(GPIOD_PIN11, 0U) | \
|
||||
PIN_AFIO_AF(GPIOD_PIN12, 0U) | \
|
||||
PIN_AFIO_AF(GPIOD_PIN13, 0U) | \
|
||||
PIN_AFIO_AF(GPIOD_PIN14, 0U) | \
|
||||
PIN_AFIO_AF(GPIOD_PIN15, 0U))
|
||||
|
||||
/*
|
||||
* GPIOF setup:
|
||||
*
|
||||
* PF0 - OSC_IN (input floating).
|
||||
* PF1 - OSC_OUT (input floating).
|
||||
* PF2 - PIN2 (input pullup).
|
||||
* PF3 - PIN3 (input pullup).
|
||||
* PF4 - PIN4 (input pullup).
|
||||
* PF5 - PIN5 (input pullup).
|
||||
* PF6 - PIN6 (input pullup).
|
||||
* PF7 - PIN7 (input pullup).
|
||||
* PF8 - PIN8 (input pullup).
|
||||
* PF9 - PIN9 (input pullup).
|
||||
* PF10 - PIN10 (input pullup).
|
||||
* PF11 - PIN11 (input pullup).
|
||||
* PF12 - PIN12 (input pullup).
|
||||
* PF13 - PIN13 (input pullup).
|
||||
* PF14 - PIN14 (input pullup).
|
||||
* PF15 - PIN15 (input pullup).
|
||||
*/
|
||||
#define VAL_GPIOF_MODER (PIN_MODE_INPUT(GPIOF_OSC_IN) | \
|
||||
PIN_MODE_INPUT(GPIOF_OSC_OUT) | \
|
||||
PIN_MODE_INPUT(GPIOF_PIN2) | \
|
||||
PIN_MODE_INPUT(GPIOF_PIN3) | \
|
||||
PIN_MODE_INPUT(GPIOF_PIN4) | \
|
||||
PIN_MODE_INPUT(GPIOF_PIN5) | \
|
||||
PIN_MODE_INPUT(GPIOF_PIN6) | \
|
||||
PIN_MODE_INPUT(GPIOF_PIN7) | \
|
||||
PIN_MODE_INPUT(GPIOF_PIN8) | \
|
||||
PIN_MODE_INPUT(GPIOF_PIN9) | \
|
||||
PIN_MODE_INPUT(GPIOF_PIN10) | \
|
||||
PIN_MODE_INPUT(GPIOF_PIN11) | \
|
||||
PIN_MODE_INPUT(GPIOF_PIN12) | \
|
||||
PIN_MODE_INPUT(GPIOF_PIN13) | \
|
||||
PIN_MODE_INPUT(GPIOF_PIN14) | \
|
||||
PIN_MODE_INPUT(GPIOF_PIN15))
|
||||
#define VAL_GPIOF_OTYPER (PIN_OTYPE_PUSHPULL(GPIOF_OSC_IN) | \
|
||||
PIN_OTYPE_PUSHPULL(GPIOF_OSC_OUT) | \
|
||||
PIN_OTYPE_PUSHPULL(GPIOF_PIN2) | \
|
||||
PIN_OTYPE_PUSHPULL(GPIOF_PIN3) | \
|
||||
PIN_OTYPE_PUSHPULL(GPIOF_PIN4) | \
|
||||
PIN_OTYPE_PUSHPULL(GPIOF_PIN5) | \
|
||||
PIN_OTYPE_PUSHPULL(GPIOF_PIN6) | \
|
||||
PIN_OTYPE_PUSHPULL(GPIOF_PIN7) | \
|
||||
PIN_OTYPE_PUSHPULL(GPIOF_PIN8) | \
|
||||
PIN_OTYPE_PUSHPULL(GPIOF_PIN9) | \
|
||||
PIN_OTYPE_PUSHPULL(GPIOF_PIN10) | \
|
||||
PIN_OTYPE_PUSHPULL(GPIOF_PIN11) | \
|
||||
PIN_OTYPE_PUSHPULL(GPIOF_PIN12) | \
|
||||
PIN_OTYPE_PUSHPULL(GPIOF_PIN13) | \
|
||||
PIN_OTYPE_PUSHPULL(GPIOF_PIN14) | \
|
||||
PIN_OTYPE_PUSHPULL(GPIOF_PIN15))
|
||||
#define VAL_GPIOF_OSPEEDR (PIN_OSPEED_HIGH(GPIOF_OSC_IN) | \
|
||||
PIN_OSPEED_HIGH(GPIOF_OSC_OUT) | \
|
||||
PIN_OSPEED_HIGH(GPIOF_PIN2) | \
|
||||
PIN_OSPEED_HIGH(GPIOF_PIN3) | \
|
||||
PIN_OSPEED_HIGH(GPIOF_PIN4) | \
|
||||
PIN_OSPEED_HIGH(GPIOF_PIN5) | \
|
||||
PIN_OSPEED_HIGH(GPIOF_PIN6) | \
|
||||
PIN_OSPEED_HIGH(GPIOF_PIN7) | \
|
||||
PIN_OSPEED_HIGH(GPIOF_PIN8) | \
|
||||
PIN_OSPEED_HIGH(GPIOF_PIN9) | \
|
||||
PIN_OSPEED_HIGH(GPIOF_PIN10) | \
|
||||
PIN_OSPEED_HIGH(GPIOF_PIN11) | \
|
||||
PIN_OSPEED_HIGH(GPIOF_PIN12) | \
|
||||
PIN_OSPEED_HIGH(GPIOF_PIN13) | \
|
||||
PIN_OSPEED_HIGH(GPIOF_PIN14) | \
|
||||
PIN_OSPEED_HIGH(GPIOF_PIN15))
|
||||
#define VAL_GPIOF_PUPDR (PIN_PUPDR_FLOATING(GPIOF_OSC_IN) | \
|
||||
PIN_PUPDR_FLOATING(GPIOF_OSC_OUT) | \
|
||||
PIN_PUPDR_PULLUP(GPIOF_PIN2) | \
|
||||
PIN_PUPDR_PULLUP(GPIOF_PIN3) | \
|
||||
PIN_PUPDR_PULLUP(GPIOF_PIN4) | \
|
||||
PIN_PUPDR_PULLUP(GPIOF_PIN5) | \
|
||||
PIN_PUPDR_PULLUP(GPIOF_PIN6) | \
|
||||
PIN_PUPDR_PULLUP(GPIOF_PIN7) | \
|
||||
PIN_PUPDR_PULLUP(GPIOF_PIN8) | \
|
||||
PIN_PUPDR_PULLUP(GPIOF_PIN9) | \
|
||||
PIN_PUPDR_PULLUP(GPIOF_PIN10) | \
|
||||
PIN_PUPDR_PULLUP(GPIOF_PIN11) | \
|
||||
PIN_PUPDR_PULLUP(GPIOF_PIN12) | \
|
||||
PIN_PUPDR_PULLUP(GPIOF_PIN13) | \
|
||||
PIN_PUPDR_PULLUP(GPIOF_PIN14) | \
|
||||
PIN_PUPDR_PULLUP(GPIOF_PIN15))
|
||||
#define VAL_GPIOF_ODR (PIN_ODR_HIGH(GPIOF_OSC_IN) | \
|
||||
PIN_ODR_HIGH(GPIOF_OSC_OUT) | \
|
||||
PIN_ODR_HIGH(GPIOF_PIN2) | \
|
||||
PIN_ODR_HIGH(GPIOF_PIN3) | \
|
||||
PIN_ODR_HIGH(GPIOF_PIN4) | \
|
||||
PIN_ODR_HIGH(GPIOF_PIN5) | \
|
||||
PIN_ODR_HIGH(GPIOF_PIN6) | \
|
||||
PIN_ODR_HIGH(GPIOF_PIN7) | \
|
||||
PIN_ODR_HIGH(GPIOF_PIN8) | \
|
||||
PIN_ODR_HIGH(GPIOF_PIN9) | \
|
||||
PIN_ODR_HIGH(GPIOF_PIN10) | \
|
||||
PIN_ODR_HIGH(GPIOF_PIN11) | \
|
||||
PIN_ODR_HIGH(GPIOF_PIN12) | \
|
||||
PIN_ODR_HIGH(GPIOF_PIN13) | \
|
||||
PIN_ODR_HIGH(GPIOF_PIN14) | \
|
||||
PIN_ODR_HIGH(GPIOF_PIN15))
|
||||
#define VAL_GPIOF_AFRL (PIN_AFIO_AF(GPIOF_OSC_IN, 0U) | \
|
||||
PIN_AFIO_AF(GPIOF_OSC_OUT, 0U) | \
|
||||
PIN_AFIO_AF(GPIOF_PIN2, 0U) | \
|
||||
PIN_AFIO_AF(GPIOF_PIN3, 0U) | \
|
||||
PIN_AFIO_AF(GPIOF_PIN4, 0U) | \
|
||||
PIN_AFIO_AF(GPIOF_PIN5, 0U) | \
|
||||
PIN_AFIO_AF(GPIOF_PIN6, 0U) | \
|
||||
PIN_AFIO_AF(GPIOF_PIN7, 0U))
|
||||
#define VAL_GPIOF_AFRH (PIN_AFIO_AF(GPIOF_PIN8, 0U) | \
|
||||
PIN_AFIO_AF(GPIOF_PIN9, 0U) | \
|
||||
PIN_AFIO_AF(GPIOF_PIN10, 0U) | \
|
||||
PIN_AFIO_AF(GPIOF_PIN11, 0U) | \
|
||||
PIN_AFIO_AF(GPIOF_PIN12, 0U) | \
|
||||
PIN_AFIO_AF(GPIOF_PIN13, 0U) | \
|
||||
PIN_AFIO_AF(GPIOF_PIN14, 0U) | \
|
||||
PIN_AFIO_AF(GPIOF_PIN15, 0U))
|
||||
|
||||
/*===========================================================================*/
|
||||
/* External declarations. */
|
||||
/*===========================================================================*/
|
||||
|
||||
#if !defined(_FROM_ASM_)
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
void boardInit(void);
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif /* _FROM_ASM_ */
|
||||
|
||||
#endif /* BOARD_H */
|
|
@ -0,0 +1,9 @@
|
|||
# List of all the board related files.
|
||||
BOARDSRC = $(CHIBIOS)/os/hal/boards/ST_NUCLEO64_G071RB/board.c
|
||||
|
||||
# Required include directories
|
||||
BOARDINC = $(CHIBIOS)/os/hal/boards/ST_NUCLEO64_G071RB
|
||||
|
||||
# Shared variables
|
||||
ALLCSRC += $(BOARDSRC)
|
||||
ALLINC += $(BOARDINC)
|
|
@ -0,0 +1,669 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!-- STM32G0xx board Template -->
|
||||
<board
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:noNamespaceSchemaLocation="http://www.chibios.org/xml/schema/boards/stm32g0xx_board.xsd">
|
||||
<configuration_settings>
|
||||
<templates_path>resources/gencfg/processors/boards/stm32g0xx/templates</templates_path>
|
||||
<output_path>..</output_path>
|
||||
<hal_version>5.0.x</hal_version>
|
||||
</configuration_settings>
|
||||
<board_name>STMicroelectronics STM32 Nucleo64-G071RB</board_name>
|
||||
<board_id>ST_NUCLEO64_G071RB</board_id>
|
||||
<board_functions></board_functions>
|
||||
<subtype>STM32G071xB</subtype>
|
||||
<clocks HSEFrequency="8000000" HSEBypass="true" LSEFrequency="32768"
|
||||
LSEBypass="false" LSEDrive="3 High Drive (default)" />
|
||||
<ports>
|
||||
<GPIOA>
|
||||
<pin0
|
||||
ID=""
|
||||
Type="PushPull"
|
||||
Level="High"
|
||||
Speed="Maximum"
|
||||
Resistor="PullUp"
|
||||
Mode="Input"
|
||||
Alternate="0" />
|
||||
<pin1
|
||||
ID=""
|
||||
Type="PushPull"
|
||||
Level="High"
|
||||
Speed="Maximum"
|
||||
Resistor="PullUp"
|
||||
Mode="Input"
|
||||
Alternate="0" />
|
||||
<pin2
|
||||
ID="LPUART1_TX"
|
||||
Type="PushPull"
|
||||
Level="High"
|
||||
Speed="High"
|
||||
Resistor="Floating"
|
||||
Mode="Alternate"
|
||||
Alternate="6" />
|
||||
<pin3
|
||||
ID="LPUART1_RX"
|
||||
Type="PushPull"
|
||||
Level="High"
|
||||
Speed="High"
|
||||
Resistor="Floating"
|
||||
Mode="Alternate"
|
||||
Alternate="6"/>
|
||||
<pin4
|
||||
ID=""
|
||||
Type="PushPull"
|
||||
Level="High"
|
||||
Speed="Maximum"
|
||||
Resistor="PullUp"
|
||||
Mode="Input"
|
||||
Alternate="0" />
|
||||
<pin5
|
||||
ID="LED_GREEN"
|
||||
Type="PushPull"
|
||||
Level="Low"
|
||||
Speed="Maximum"
|
||||
Resistor="Floating"
|
||||
Mode="Output"
|
||||
Alternate="0" />
|
||||
<pin6
|
||||
ID=""
|
||||
Type="PushPull"
|
||||
Level="High"
|
||||
Speed="Maximum"
|
||||
Resistor="PullUp"
|
||||
Mode="Input"
|
||||
Alternate="0" />
|
||||
<pin7
|
||||
ID=""
|
||||
Type="PushPull"
|
||||
Level="High"
|
||||
Speed="Maximum"
|
||||
Resistor="PullUp"
|
||||
Mode="Input"
|
||||
Alternate="0" />
|
||||
<pin8
|
||||
ID=""
|
||||
Type="PushPull"
|
||||
Level="High"
|
||||
Speed="Maximum"
|
||||
Resistor="PullUp"
|
||||
Mode="Input"
|
||||
Alternate="0" />
|
||||
<pin9
|
||||
ID=""
|
||||
Type="PushPull"
|
||||
Level="High"
|
||||
Speed="Maximum"
|
||||
Resistor="PullUp"
|
||||
Mode="Input"
|
||||
Alternate="0" />
|
||||
<pin10
|
||||
ID=""
|
||||
Type="PushPull"
|
||||
Level="High"
|
||||
Speed="Maximum"
|
||||
Resistor="PullUp"
|
||||
Mode="Input"
|
||||
Alternate="0" />
|
||||
<pin11
|
||||
ID=""
|
||||
Type="PushPull"
|
||||
Level="High"
|
||||
Speed="Maximum"
|
||||
Resistor="PullUp"
|
||||
Mode="Input"
|
||||
Alternate="0" />
|
||||
<pin12
|
||||
ID=""
|
||||
Type="PushPull"
|
||||
Level="High"
|
||||
Speed="Maximum"
|
||||
Resistor="PullUp"
|
||||
Mode="Input"
|
||||
Alternate="0" />
|
||||
<pin13
|
||||
ID="SWDIO"
|
||||
Type="PushPull"
|
||||
Level="High"
|
||||
Speed="Maximum"
|
||||
Resistor="PullUp"
|
||||
Mode="Alternate"
|
||||
Alternate="0" />
|
||||
<pin14
|
||||
ID="SWCLK"
|
||||
Type="PushPull"
|
||||
Level="High"
|
||||
Speed="Maximum"
|
||||
Resistor="PullDown"
|
||||
Mode="Alternate"
|
||||
Alternate="0" />
|
||||
<pin15
|
||||
ID=""
|
||||
Type="PushPull"
|
||||
Level="High"
|
||||
Speed="Maximum"
|
||||
Resistor="PullUp"
|
||||
Mode="Input"
|
||||
Alternate="0" />
|
||||
</GPIOA>
|
||||
<GPIOB>
|
||||
<pin0
|
||||
ID=""
|
||||
Type="PushPull"
|
||||
Level="High"
|
||||
Speed="Maximum"
|
||||
Resistor="PullUp"
|
||||
Mode="Input"
|
||||
Alternate="0" />
|
||||
<pin1
|
||||
ID=""
|
||||
Type="PushPull"
|
||||
Level="High"
|
||||
Speed="Maximum"
|
||||
Resistor="PullUp"
|
||||
Mode="Input"
|
||||
Alternate="0" />
|
||||
<pin2
|
||||
ID=""
|
||||
Type="PushPull"
|
||||
Level="High"
|
||||
Speed="Maximum"
|
||||
Resistor="PullUp"
|
||||
Mode="Input"
|
||||
Alternate="0" />
|
||||
<pin3
|
||||
ID="SWO"
|
||||
Type="PushPull"
|
||||
Level="High"
|
||||
Speed="Maximum"
|
||||
Resistor="PullUp"
|
||||
Mode="Alternate"
|
||||
Alternate="0" />
|
||||
<pin4
|
||||
ID=""
|
||||
Type="PushPull"
|
||||
Level="High"
|
||||
Speed="Maximum"
|
||||
Resistor="PullUp"
|
||||
Mode="Input"
|
||||
Alternate="0" />
|
||||
<pin5
|
||||
ID=""
|
||||
Type="PushPull"
|
||||
Level="High"
|
||||
Speed="Maximum"
|
||||
Resistor="PullUp"
|
||||
Mode="Input"
|
||||
Alternate="0" />
|
||||
<pin6
|
||||
ID=""
|
||||
Type="PushPull"
|
||||
Level="High"
|
||||
Speed="Maximum"
|
||||
Resistor="PullUp"
|
||||
Mode="Input"
|
||||
Alternate="0" />
|
||||
<pin7
|
||||
ID=""
|
||||
Type="PushPull"
|
||||
Level="High"
|
||||
Speed="Maximum"
|
||||
Resistor="PullUp"
|
||||
Mode="Input"
|
||||
Alternate="0" />
|
||||
<pin8
|
||||
ID=""
|
||||
Type="PushPull"
|
||||
Level="High"
|
||||
Speed="Maximum"
|
||||
Resistor="PullUp"
|
||||
Mode="Input"
|
||||
Alternate="0" />
|
||||
<pin9
|
||||
ID=""
|
||||
Type="PushPull"
|
||||
Level="High"
|
||||
Speed="Maximum"
|
||||
Resistor="PullUp"
|
||||
Mode="Input"
|
||||
Alternate="0" />
|
||||
<pin10
|
||||
ID=""
|
||||
Type="PushPull"
|
||||
Level="High"
|
||||
Speed="Maximum"
|
||||
Resistor="PullUp"
|
||||
Mode="Input"
|
||||
Alternate="0" />
|
||||
<pin11
|
||||
ID=""
|
||||
Type="PushPull"
|
||||
Level="High"
|
||||
Speed="Maximum"
|
||||
Resistor="PullUp"
|
||||
Mode="Input"
|
||||
Alternate="0" />
|
||||
<pin12
|
||||
ID=""
|
||||
Type="PushPull"
|
||||
Level="High"
|
||||
Speed="Maximum"
|
||||
Resistor="PullUp"
|
||||
Mode="Input"
|
||||
Alternate="0" />
|
||||
<pin13
|
||||
ID=""
|
||||
Type="PushPull"
|
||||
Level="High"
|
||||
Speed="Maximum"
|
||||
Resistor="PullUp"
|
||||
Mode="Input"
|
||||
Alternate="0" />
|
||||
<pin14
|
||||
ID=""
|
||||
Type="PushPull"
|
||||
Level="High"
|
||||
Speed="Maximum"
|
||||
Resistor="PullUp"
|
||||
Mode="Input"
|
||||
Alternate="0" />
|
||||
<pin15
|
||||
ID=""
|
||||
Type="PushPull"
|
||||
Level="High"
|
||||
Speed="Maximum"
|
||||
Resistor="PullUp"
|
||||
Mode="Input"
|
||||
Alternate="0" />
|
||||
</GPIOB>
|
||||
<GPIOC>
|
||||
<pin0
|
||||
ID=""
|
||||
Type="PushPull"
|
||||
Level="High"
|
||||
Speed="Maximum"
|
||||
Resistor="PullUp"
|
||||
Mode="Input"
|
||||
Alternate="0" />
|
||||
<pin1
|
||||
ID=""
|
||||
Type="PushPull"
|
||||
Level="High"
|
||||
Speed="Maximum"
|
||||
Resistor="PullUp"
|
||||
Mode="Input"
|
||||
Alternate="0" />
|
||||
<pin2
|
||||
ID=""
|
||||
Type="PushPull"
|
||||
Level="High"
|
||||
Speed="Maximum"
|
||||
Resistor="PullUp"
|
||||
Mode="Input"
|
||||
Alternate="0" />
|
||||
<pin3
|
||||
ID=""
|
||||
Type="PushPull"
|
||||
Level="High"
|
||||
Speed="Maximum"
|
||||
Resistor="PullUp"
|
||||
Mode="Input"
|
||||
Alternate="0" />
|
||||
<pin4
|
||||
ID=""
|
||||
Type="PushPull"
|
||||
Level="High"
|
||||
Speed="Maximum"
|
||||
Resistor="PullUp"
|
||||
Mode="Input"
|
||||
Alternate="0" />
|
||||
<pin5
|
||||
ID=""
|
||||
Type="PushPull"
|
||||
Level="High"
|
||||
Speed="Maximum"
|
||||
Resistor="PullUp"
|
||||
Mode="Input"
|
||||
Alternate="0" />
|
||||
<pin6
|
||||
ID=""
|
||||
Type="PushPull"
|
||||
Level="High"
|
||||
Speed="Maximum"
|
||||
Resistor="PullUp"
|
||||
Mode="Input"
|
||||
Alternate="0" />
|
||||
<pin7
|
||||
ID=""
|
||||
Type="PushPull"
|
||||
Level="High"
|
||||
Speed="Maximum"
|
||||
Resistor="PullUp"
|
||||
Mode="Input"
|
||||
Alternate="0" />
|
||||
<pin8
|
||||
ID=""
|
||||
Type="PushPull"
|
||||
Level="High"
|
||||
Speed="Maximum"
|
||||
Resistor="PullUp"
|
||||
Mode="Input"
|
||||
Alternate="0" />
|
||||
<pin9
|
||||
ID=""
|
||||
Type="PushPull"
|
||||
Level="High"
|
||||
Speed="Maximum"
|
||||
Resistor="PullUp"
|
||||
Mode="Input"
|
||||
Alternate="0" />
|
||||
<pin10
|
||||
ID=""
|
||||
Type="PushPull"
|
||||
Level="High"
|
||||
Speed="Maximum"
|
||||
Resistor="PullUp"
|
||||
Mode="Input"
|
||||
Alternate="0" />
|
||||
<pin11
|
||||
ID=""
|
||||
Type="PushPull"
|
||||
Level="High"
|
||||
Speed="Maximum"
|
||||
Resistor="PullUp"
|
||||
Mode="Input"
|
||||
Alternate="0" />
|
||||
<pin12
|
||||
ID=""
|
||||
Type="PushPull"
|
||||
Level="High"
|
||||
Speed="Maximum"
|
||||
Resistor="PullUp"
|
||||
Mode="Input"
|
||||
Alternate="0" />
|
||||
<pin13
|
||||
ID="BUTTON"
|
||||
Type="PushPull"
|
||||
Level="High"
|
||||
Speed="Maximum"
|
||||
Resistor="Floating"
|
||||
Mode="Input"
|
||||
Alternate="0" />
|
||||
<pin14
|
||||
ID="OSC32_IN"
|
||||
Type="PushPull"
|
||||
Level="High"
|
||||
Speed="Maximum"
|
||||
Resistor="Floating"
|
||||
Mode="Input"
|
||||
Alternate="0" />
|
||||
<pin15
|
||||
ID="OSC32_OUT"
|
||||
Type="PushPull"
|
||||
Level="High"
|
||||
Speed="Maximum"
|
||||
Resistor="Floating"
|
||||
Mode="Input"
|
||||
Alternate="0" />
|
||||
</GPIOC>
|
||||
<GPIOD>
|
||||
<pin0
|
||||
ID=""
|
||||
Type="PushPull"
|
||||
Speed="Maximum"
|
||||
Resistor="PullUp"
|
||||
Level="High"
|
||||
Mode="Input"
|
||||
Alternate="0" />
|
||||
<pin1
|
||||
ID=""
|
||||
Type="PushPull"
|
||||
Speed="Maximum"
|
||||
Resistor="PullUp"
|
||||
Level="High"
|
||||
Mode="Input"
|
||||
Alternate="0" />
|
||||
<pin2
|
||||
ID=""
|
||||
Type="PushPull"
|
||||
Speed="Maximum"
|
||||
Resistor="PullUp"
|
||||
Level="High"
|
||||
Mode="Input"
|
||||
Alternate="0" />
|
||||
<pin3
|
||||
ID=""
|
||||
Type="PushPull"
|
||||
Speed="Maximum"
|
||||
Resistor="PullUp"
|
||||
Level="High"
|
||||
Mode="Input"
|
||||
Alternate="0" />
|
||||
<pin4
|
||||
ID=""
|
||||
Type="PushPull"
|
||||
Speed="Maximum"
|
||||
Resistor="PullUp"
|
||||
Level="High"
|
||||
Mode="Input"
|
||||
Alternate="0" />
|
||||
<pin5
|
||||
ID=""
|
||||
Type="PushPull"
|
||||
Speed="Maximum"
|
||||
Resistor="PullUp"
|
||||
Level="High"
|
||||
Mode="Input"
|
||||
Alternate="0" />
|
||||
<pin6
|
||||
ID=""
|
||||
Type="PushPull"
|
||||
Speed="Maximum"
|
||||
Resistor="PullUp"
|
||||
Level="High"
|
||||
Mode="Input"
|
||||
Alternate="0" />
|
||||
<pin7
|
||||
ID=""
|
||||
Type="PushPull"
|
||||
Speed="Maximum"
|
||||
Resistor="PullUp"
|
||||
Level="High"
|
||||
Mode="Input"
|
||||
Alternate="0" />
|
||||
<pin8
|
||||
ID=""
|
||||
Type="PushPull"
|
||||
Speed="Maximum"
|
||||
Resistor="PullUp"
|
||||
Level="High"
|
||||
Mode="Input"
|
||||
Alternate="0" />
|
||||
<pin9
|
||||
ID=""
|
||||
Type="PushPull"
|
||||
Speed="Maximum"
|
||||
Resistor="PullUp"
|
||||
Level="High"
|
||||
Mode="Input"
|
||||
Alternate="0" />
|
||||
<pin10
|
||||
ID=""
|
||||
Type="PushPull"
|
||||
Speed="Maximum"
|
||||
Resistor="PullUp"
|
||||
Level="High"
|
||||
Mode="Input"
|
||||
Alternate="0" />
|
||||
<pin11
|
||||
ID=""
|
||||
Type="PushPull"
|
||||
Speed="Maximum"
|
||||
Resistor="PullUp"
|
||||
Level="High"
|
||||
Mode="Input"
|
||||
Alternate="0" />
|
||||
<pin12
|
||||
ID=""
|
||||
Type="PushPull"
|
||||
Speed="Maximum"
|
||||
Resistor="PullUp"
|
||||
Level="High"
|
||||
Mode="Input"
|
||||
Alternate="0" />
|
||||
<pin13
|
||||
ID=""
|
||||
Type="PushPull"
|
||||
Speed="Maximum"
|
||||
Resistor="PullUp"
|
||||
Level="High"
|
||||
Mode="Input"
|
||||
Alternate="0" />
|
||||
<pin14
|
||||
ID=""
|
||||
Type="PushPull"
|
||||
Speed="Maximum"
|
||||
Resistor="PullUp"
|
||||
Level="High"
|
||||
Mode="Input"
|
||||
Alternate="0" />
|
||||
<pin15
|
||||
ID=""
|
||||
Type="PushPull"
|
||||
Speed="Maximum"
|
||||
Resistor="PullUp"
|
||||
Level="High"
|
||||
Mode="Input"
|
||||
Alternate="0" />
|
||||
</GPIOD>
|
||||
<GPIOF>
|
||||
<pin0
|
||||
ID="OSC_IN"
|
||||
Type="PushPull"
|
||||
Speed="Maximum"
|
||||
Resistor="Floating"
|
||||
Level="High"
|
||||
Mode="Input"
|
||||
Alternate="0" />
|
||||
<pin1
|
||||
ID="OSC_OUT"
|
||||
Type="PushPull"
|
||||
Speed="Maximum"
|
||||
Resistor="Floating"
|
||||
Level="High"
|
||||
Mode="Input"
|
||||
Alternate="0" />
|
||||
<pin2
|
||||
ID=""
|
||||
Type="PushPull"
|
||||
Speed="Maximum"
|
||||
Resistor="PullUp"
|
||||
Level="High"
|
||||
Mode="Input"
|
||||
Alternate="0" />
|
||||
<pin3
|
||||
ID=""
|
||||
Type="PushPull"
|
||||
Speed="Maximum"
|
||||
Resistor="PullUp"
|
||||
Level="High"
|
||||
Mode="Input"
|
||||
Alternate="0" />
|
||||
<pin4
|
||||
ID=""
|
||||
Type="PushPull"
|
||||
Speed="Maximum"
|
||||
Resistor="PullUp"
|
||||
Level="High"
|
||||
Mode="Input"
|
||||
Alternate="0" />
|
||||
<pin5
|
||||
ID=""
|
||||
Type="PushPull"
|
||||
Speed="Maximum"
|
||||
Resistor="PullUp"
|
||||
Level="High"
|
||||
Mode="Input"
|
||||
Alternate="0" />
|
||||
<pin6
|
||||
ID=""
|
||||
Type="PushPull"
|
||||
Speed="Maximum"
|
||||
Resistor="PullUp"
|
||||
Level="High"
|
||||
Mode="Input"
|
||||
Alternate="0" />
|
||||
<pin7
|
||||
ID=""
|
||||
Type="PushPull"
|
||||
Speed="Maximum"
|
||||
Resistor="PullUp"
|
||||
Level="High"
|
||||
Mode="Input"
|
||||
Alternate="0" />
|
||||
<pin8
|
||||
ID=""
|
||||
Type="PushPull"
|
||||
Speed="Maximum"
|
||||
Resistor="PullUp"
|
||||
Level="High"
|
||||
Mode="Input"
|
||||
Alternate="0" />
|
||||
<pin9
|
||||
ID=""
|
||||
Type="PushPull"
|
||||
Speed="Maximum"
|
||||
Resistor="PullUp"
|
||||
Level="High"
|
||||
Mode="Input"
|
||||
Alternate="0" />
|
||||
<pin10
|
||||
ID=""
|
||||
Type="PushPull"
|
||||
Speed="Maximum"
|
||||
Resistor="PullUp"
|
||||
Level="High"
|
||||
Mode="Input"
|
||||
Alternate="0" />
|
||||
<pin11
|
||||
ID=""
|
||||
Type="PushPull"
|
||||
Speed="Maximum"
|
||||
Resistor="PullUp"
|
||||
Level="High"
|
||||
Mode="Input"
|
||||
Alternate="0" />
|
||||
<pin12
|
||||
ID=""
|
||||
Type="PushPull"
|
||||
Speed="Maximum"
|
||||
Resistor="PullUp"
|
||||
Level="High"
|
||||
Mode="Input"
|
||||
Alternate="0" />
|
||||
<pin13
|
||||
ID=""
|
||||
Type="PushPull"
|
||||
Speed="Maximum"
|
||||
Resistor="PullUp"
|
||||
Level="High"
|
||||
Mode="Input"
|
||||
Alternate="0" />
|
||||
<pin14
|
||||
ID=""
|
||||
Type="PushPull"
|
||||
Speed="Maximum"
|
||||
Resistor="PullUp"
|
||||
Level="High"
|
||||
Mode="Input"
|
||||
Alternate="0" />
|
||||
<pin15
|
||||
ID=""
|
||||
Type="PushPull"
|
||||
Speed="Maximum"
|
||||
Resistor="PullUp"
|
||||
Level="High"
|
||||
Mode="Input"
|
||||
Alternate="0" />
|
||||
</GPIOF>
|
||||
</ports>
|
||||
</board>
|
|
@ -0,0 +1,15 @@
|
|||
sourceRoot: ../../../../../tools/ftl/processors/boards/stm32l0xx/templates
|
||||
outputRoot: ..
|
||||
dataRoot: .
|
||||
|
||||
freemarkerLinks: {
|
||||
lib: ../../../../../tools/ftl/libs
|
||||
}
|
||||
|
||||
data : {
|
||||
doc1:xml (
|
||||
board.chcfg
|
||||
{
|
||||
}
|
||||
)
|
||||
}
|
|
@ -0,0 +1,358 @@
|
|||
/*
|
||||
ChibiOS - Copyright (C) 2006..2018 Giovanni Di Sirio
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @file STM32G0xx+/hal_lld.c
|
||||
* @brief STM32G0xx+ HAL subsystem low level driver source.
|
||||
*
|
||||
* @addtogroup HAL
|
||||
* @{
|
||||
*/
|
||||
|
||||
#include "hal.h"
|
||||
|
||||
/*===========================================================================*/
|
||||
/* Driver local definitions. */
|
||||
/*===========================================================================*/
|
||||
|
||||
/*===========================================================================*/
|
||||
/* Driver exported variables. */
|
||||
/*===========================================================================*/
|
||||
|
||||
/**
|
||||
* @brief CMSIS system core clock variable.
|
||||
* @note It is declared in system_stm32l4xx.h.
|
||||
*/
|
||||
uint32_t SystemCoreClock = STM32_HCLK;
|
||||
|
||||
/*===========================================================================*/
|
||||
/* Driver local variables and types. */
|
||||
/*===========================================================================*/
|
||||
|
||||
/*===========================================================================*/
|
||||
/* Driver local functions. */
|
||||
/*===========================================================================*/
|
||||
|
||||
/**
|
||||
* @brief Initializes the backup domain.
|
||||
* @note WARNING! Changing RTC clock source impossible without resetting
|
||||
* of the whole BKP domain.
|
||||
*/
|
||||
static void hal_lld_backup_domain_init(void) {
|
||||
|
||||
/* Reset BKP domain if different clock source selected.*/
|
||||
if ((RCC->BDCR & STM32_RTCSEL_MASK) != STM32_RTCSEL) {
|
||||
/* Backup domain reset.*/
|
||||
RCC->BDCR = RCC_BDCR_BDRST;
|
||||
RCC->BDCR = 0;
|
||||
}
|
||||
|
||||
#if STM32_LSE_ENABLED
|
||||
/* LSE activation.*/
|
||||
#if defined(STM32_LSE_BYPASS)
|
||||
/* LSE Bypass.*/
|
||||
RCC->BDCR |= STM32_LSEDRV | RCC_BDCR_LSEON | RCC_BDCR_LSEBYP;
|
||||
#else
|
||||
/* No LSE Bypass.*/
|
||||
RCC->BDCR |= STM32_LSEDRV | RCC_BDCR_LSEON;
|
||||
#endif
|
||||
while ((RCC->BDCR & RCC_BDCR_LSERDY) == 0)
|
||||
; /* Wait until LSE is stable. */
|
||||
#endif
|
||||
|
||||
#if STM32_MSIPLL_ENABLED
|
||||
/* MSI PLL activation depends on LSE. Reactivating and checking for
|
||||
MSI stability.*/
|
||||
RCC->CR |= RCC_CR_MSIPLLEN;
|
||||
while ((RCC->CR & RCC_CR_MSIRDY) == 0)
|
||||
; /* Wait until MSI is stable. */
|
||||
#endif
|
||||
|
||||
#if HAL_USE_RTC
|
||||
/* If the backup domain hasn't been initialized yet then proceed with
|
||||
initialization.*/
|
||||
if ((RCC->BDCR & RCC_BDCR_RTCEN) == 0) {
|
||||
/* Selects clock source.*/
|
||||
RCC->BDCR |= STM32_RTCSEL;
|
||||
|
||||
/* RTC clock enabled.*/
|
||||
RCC->BDCR |= RCC_BDCR_RTCEN;
|
||||
}
|
||||
#endif /* HAL_USE_RTC */
|
||||
|
||||
/* Low speed output mode.*/
|
||||
RCC->BDCR |= STM32_LSCOSEL;
|
||||
}
|
||||
|
||||
/*===========================================================================*/
|
||||
/* Driver interrupt handlers. */
|
||||
/*===========================================================================*/
|
||||
|
||||
/*===========================================================================*/
|
||||
/* Driver exported functions. */
|
||||
/*===========================================================================*/
|
||||
|
||||
/**
|
||||
* @brief Low level HAL driver initialization.
|
||||
*
|
||||
* @notapi
|
||||
*/
|
||||
void hal_lld_init(void) {
|
||||
|
||||
/* Reset of all peripherals.
|
||||
Note, GPIOs are not reset because initialized before this point in
|
||||
board files.*/
|
||||
rccResetAHB1(~0);
|
||||
rccResetAHB2(~STM32_GPIO_EN_MASK);
|
||||
rccResetAHB3(~0);
|
||||
rccResetAPB1R1(~RCC_APB1RSTR1_PWRRST);
|
||||
rccResetAPB1R2(~0);
|
||||
rccResetAPB2(~0);
|
||||
|
||||
/* PWR clock enabled.*/
|
||||
rccEnablePWRInterface(true);
|
||||
|
||||
/* Initializes the backup domain.*/
|
||||
hal_lld_backup_domain_init();
|
||||
|
||||
/* DMA subsystems initialization.*/
|
||||
#if defined(STM32_DMA_REQUIRED)
|
||||
dmaInit();
|
||||
#endif
|
||||
|
||||
/* IRQ subsystem initialization.*/
|
||||
irqInit();
|
||||
|
||||
/* Programmable voltage detector enable.*/
|
||||
#if STM32_PVD_ENABLE
|
||||
PWR->CR2 = PWR_CR2_PVDE | (STM32_PLS & STM32_PLS_MASK);
|
||||
#else
|
||||
PWR->CR2 = 0;
|
||||
#endif /* STM32_PVD_ENABLE */
|
||||
|
||||
/* Enabling independent VDDUSB.*/
|
||||
#if HAL_USE_USB
|
||||
PWR->CR2 |= PWR_CR2_USV;
|
||||
#endif /* HAL_USE_USB */
|
||||
|
||||
/* Enabling independent VDDIO2 required by GPIOG.*/
|
||||
#if STM32_HAS_GPIOG
|
||||
PWR->CR2 |= PWR_CR2_IOSV;
|
||||
#endif /* STM32_HAS_GPIOG */
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief STM32G0xx clocks and PLL initialization.
|
||||
* @note All the involved constants come from the file @p board.h.
|
||||
* @note This function should be invoked just after the system reset.
|
||||
*
|
||||
* @special
|
||||
*/
|
||||
void stm32_clock_init(void) {
|
||||
|
||||
#if !STM32_NO_INIT
|
||||
/* PWR clock enable.*/
|
||||
#if defined(HAL_USE_RTC) && defined(RCC_APB1ENR1_RTCAPBEN)
|
||||
RCC->APB1ENR1 = RCC_APB1ENR1_PWREN | RCC_APB1ENR1_RTCAPBEN;
|
||||
#else
|
||||
RCC->APB1ENR1 = RCC_APB1ENR1_PWREN;
|
||||
#endif
|
||||
|
||||
/* Initial clocks setup and wait for MSI stabilization, the MSI clock is
|
||||
always enabled because it is the fall back clock when PLL the fails.
|
||||
Trim fields are not altered from reset values.*/
|
||||
|
||||
/* MSIRANGE can be set only when MSI is OFF or READY.*/
|
||||
RCC->CR = RCC_CR_MSION;
|
||||
while ((RCC->CR & RCC_CR_MSIRDY) == 0)
|
||||
; /* Wait until MSI is stable. */
|
||||
|
||||
/* Clocking from MSI, in case MSI was not the default source.*/
|
||||
RCC->CFGR = 0;
|
||||
while ((RCC->CFGR & RCC_CFGR_SWS) != RCC_CFGR_SWS_MSI)
|
||||
; /* Wait until MSI is selected. */
|
||||
|
||||
/* Core voltage setup.*/
|
||||
PWR->CR1 = STM32_VOS;
|
||||
while ((PWR->SR2 & PWR_SR2_VOSF) != 0) /* Wait until regulator is */
|
||||
; /* stable. */
|
||||
|
||||
/* Boost mode setting.*/
|
||||
PWR->CR5 = STM32_R1MODE;
|
||||
|
||||
#if STM32_HSI16_ENABLED
|
||||
/* HSI activation.*/
|
||||
RCC->CR |= RCC_CR_HSION;
|
||||
while ((RCC->CR & RCC_CR_HSIRDY) == 0)
|
||||
; /* Wait until HSI16 is stable. */
|
||||
#endif
|
||||
|
||||
#if STM32_HSI48_ENABLED
|
||||
/* HSI activation.*/
|
||||
RCC->CRRCR |= RCC_CRRCR_HSI48ON;
|
||||
while ((RCC->CRRCR & RCC_CRRCR_HSI48RDY) == 0)
|
||||
; /* Wait until HSI48 is stable. */
|
||||
#endif
|
||||
|
||||
#if STM32_HSE_ENABLED
|
||||
#if defined(STM32_HSE_BYPASS)
|
||||
/* HSE Bypass.*/
|
||||
RCC->CR |= RCC_CR_HSEON | RCC_CR_HSEBYP;
|
||||
#endif
|
||||
/* HSE activation.*/
|
||||
RCC->CR |= RCC_CR_HSEON;
|
||||
while ((RCC->CR & RCC_CR_HSERDY) == 0)
|
||||
; /* Wait until HSE is stable. */
|
||||
#endif
|
||||
|
||||
#if STM32_LSI_ENABLED
|
||||
/* LSI activation.*/
|
||||
RCC->CSR |= RCC_CSR_LSION;
|
||||
while ((RCC->CSR & RCC_CSR_LSIRDY) == 0)
|
||||
; /* Wait until LSI is stable. */
|
||||
#endif
|
||||
|
||||
/* Backup domain access enabled and left open.*/
|
||||
PWR->CR1 |= PWR_CR1_DBP;
|
||||
|
||||
#if STM32_LSE_ENABLED
|
||||
/* LSE activation.*/
|
||||
#if defined(STM32_LSE_BYPASS)
|
||||
/* LSE Bypass.*/
|
||||
RCC->BDCR |= STM32_LSEDRV | RCC_BDCR_LSEON | RCC_BDCR_LSEBYP;
|
||||
#else
|
||||
/* No LSE Bypass.*/
|
||||
RCC->BDCR |= STM32_LSEDRV | RCC_BDCR_LSEON;
|
||||
#endif
|
||||
while ((RCC->BDCR & RCC_BDCR_LSERDY) == 0)
|
||||
; /* Wait until LSE is stable. */
|
||||
#endif
|
||||
|
||||
/* Flash setup for selected MSI speed setting.*/
|
||||
FLASH->ACR = FLASH_ACR_DCEN | FLASH_ACR_ICEN | FLASH_ACR_PRFTEN |
|
||||
STM32_MSI_FLASHBITS;
|
||||
|
||||
/* Changing MSIRANGE to configured value.*/
|
||||
RCC->CR |= STM32_MSIRANGE;
|
||||
|
||||
/* Switching from MSISRANGE to MSIRANGE.*/
|
||||
RCC->CR |= RCC_CR_MSIRGSEL;
|
||||
while ((RCC->CR & RCC_CR_MSIRDY) == 0)
|
||||
;
|
||||
|
||||
/* MSI is configured SYSCLK source so wait for it to be stable as well.*/
|
||||
while ((RCC->CFGR & RCC_CFGR_SWS) != RCC_CFGR_SWS_MSI)
|
||||
;
|
||||
|
||||
#if STM32_MSIPLL_ENABLED
|
||||
/* MSI PLL (to LSE) activation */
|
||||
RCC->CR |= RCC_CR_MSIPLLEN;
|
||||
#endif
|
||||
|
||||
/* Updating MSISRANGE value. MSISRANGE can be set only when MSIRGSEL is high.
|
||||
This range is used exiting the Standby mode until MSIRGSEL is set.*/
|
||||
RCC->CSR |= STM32_MSISRANGE;
|
||||
|
||||
#if STM32_ACTIVATE_PLL || STM32_ACTIVATE_PLLSAI1 || STM32_ACTIVATE_PLLSAI2
|
||||
/* PLLM and PLLSRC are common to all PLLs.*/
|
||||
RCC->PLLCFGR = STM32_PLLPDIV | STM32_PLLR |
|
||||
STM32_PLLREN | STM32_PLLQ |
|
||||
STM32_PLLQEN | STM32_PLLP |
|
||||
STM32_PLLPEN | STM32_PLLN |
|
||||
STM32_PLLM | STM32_PLLSRC;
|
||||
#endif
|
||||
|
||||
#if STM32_ACTIVATE_PLL
|
||||
/* PLL activation.*/
|
||||
RCC->CR |= RCC_CR_PLLON;
|
||||
|
||||
/* Waiting for PLL lock.*/
|
||||
while ((RCC->CR & RCC_CR_PLLRDY) == 0)
|
||||
;
|
||||
#endif
|
||||
|
||||
#if STM32_ACTIVATE_PLLSAI1
|
||||
/* PLLSAI1 activation.*/
|
||||
RCC->PLLSAI1CFGR = STM32_PLLSAI1PDIV | STM32_PLLSAI1R |
|
||||
STM32_PLLSAI1REN | STM32_PLLSAI1Q |
|
||||
STM32_PLLSAI1QEN | STM32_PLLSAI1P |
|
||||
STM32_PLLSAI1PEN | STM32_PLLSAI1N |
|
||||
STM32_PLLSAI1M;
|
||||
RCC->CR |= RCC_CR_PLLSAI1ON;
|
||||
|
||||
/* Waiting for PLL lock.*/
|
||||
while ((RCC->CR & RCC_CR_PLLSAI1RDY) == 0)
|
||||
;
|
||||
#endif
|
||||
|
||||
#if STM32_ACTIVATE_PLLSAI2
|
||||
/* PLLSAI2 activation.*/
|
||||
RCC->PLLSAI2CFGR = STM32_PLLSAI2PDIV | STM32_PLLSAI2R |
|
||||
STM32_PLLSAI2REN | STM32_PLLSAI2P |
|
||||
STM32_PLLSAI2PEN | STM32_PLLSAI2N |
|
||||
STM32_PLLSAI2M;
|
||||
RCC->CR |= RCC_CR_PLLSAI2ON;
|
||||
|
||||
/* Waiting for PLL lock.*/
|
||||
while ((RCC->CR & RCC_CR_PLLSAI2RDY) == 0)
|
||||
;
|
||||
#endif
|
||||
|
||||
/* Other clock-related settings (dividers, MCO etc).*/
|
||||
RCC->CFGR = STM32_MCOPRE | STM32_MCOSEL | STM32_STOPWUCK |
|
||||
STM32_PPRE2 | STM32_PPRE1 | STM32_HPRE;
|
||||
|
||||
/* CCIPR register initialization, note, must take care of the _OFF
|
||||
pseudo settings.*/
|
||||
{
|
||||
uint32_t ccipr = STM32_DFSDMSEL | STM32_ADCSEL |
|
||||
STM32_CLK48SEL | STM32_LPTIM2SEL | STM32_LPTIM1SEL |
|
||||
STM32_I2C3SEL | STM32_I2C2SEL | STM32_I2C1SEL |
|
||||
STM32_UART5SEL | STM32_UART4SEL | STM32_USART3SEL |
|
||||
STM32_USART2SEL | STM32_USART1SEL | STM32_LPUART1SEL;
|
||||
#if STM32_SAI2SEL != STM32_SAI2SEL_OFF
|
||||
ccipr |= STM32_SAI2SEL;
|
||||
#endif
|
||||
#if STM32_SAI1SEL != STM32_SAI1SEL_OFF
|
||||
ccipr |= STM32_SAI1SEL;
|
||||
#endif
|
||||
RCC->CCIPR = ccipr;
|
||||
}
|
||||
|
||||
/* Set flash WS's for SYSCLK source */
|
||||
if (STM32_FLASHBITS > STM32_MSI_FLASHBITS)
|
||||
FLASH->ACR = (FLASH->ACR & ~FLASH_ACR_LATENCY_Msk) | STM32_FLASHBITS;
|
||||
|
||||
/* Switching to the configured SYSCLK source if it is different from MSI.*/
|
||||
#if (STM32_SW != STM32_SW_MSI)
|
||||
RCC->CFGR |= STM32_SW; /* Switches on the selected clock source. */
|
||||
/* Wait until SYSCLK is stable.*/
|
||||
while ((RCC->CFGR & RCC_CFGR_SWS) != (STM32_SW << 2))
|
||||
;
|
||||
#endif
|
||||
|
||||
/* Reduce the flash WS's for SYSCLK source if they are less than MSI WSs */
|
||||
if (STM32_FLASHBITS < STM32_MSI_FLASHBITS)
|
||||
FLASH->ACR = (FLASH->ACR & ~FLASH_ACR_LATENCY_Msk) | STM32_FLASHBITS;
|
||||
|
||||
#endif /* STM32_NO_INIT */
|
||||
|
||||
/* SYSCFG clock enabled here because it is a multi-functional unit shared
|
||||
among multiple drivers.*/
|
||||
rccEnableAPB2(RCC_APB2ENR_SYSCFGEN, true);
|
||||
}
|
||||
|
||||
/** @} */
|
|
@ -334,13 +334,6 @@
|
|||
#define STM32_HSI16_ENABLED FALSE
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief Enables or disables the HSI48 clock source.
|
||||
*/
|
||||
#if !defined(STM32_HSI48_ENABLED) || defined(__DOXYGEN__)
|
||||
#define STM32_HSI48_ENABLED FALSE
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief Enables or disables the HSE clock source.
|
||||
*/
|
||||
|
|
|
@ -0,0 +1,42 @@
|
|||
# Required platform files.
|
||||
PLATFORMSRC := $(CHIBIOS)/os/hal/ports/common/ARMCMx/nvic.c \
|
||||
$(CHIBIOS)/os/hal/ports/STM32/STM32G0xx/stm32_isr.c \
|
||||
$(CHIBIOS)/os/hal/ports/STM32/STM32G0xx/hal_lld.c
|
||||
|
||||
# Required include directories.
|
||||
PLATFORMINC := $(CHIBIOS)/os/hal/ports/common/ARMCMx \
|
||||
$(CHIBIOS)/os/hal/ports/STM32/STM32G0xx
|
||||
|
||||
# Optional platform files.
|
||||
ifeq ($(USE_SMART_BUILD),yes)
|
||||
|
||||
# Configuration files directory
|
||||
ifeq ($(HALCONFDIR),)
|
||||
ifeq ($(CONFDIR),)
|
||||
HALCONFDIR = .
|
||||
else
|
||||
HALCONFDIR := $(CONFDIR)
|
||||
endif
|
||||
endif
|
||||
|
||||
HALCONF := $(strip $(shell cat $(HALCONFDIR)/halconf.h | egrep -e "\#define"))
|
||||
|
||||
else
|
||||
endif
|
||||
|
||||
# Drivers compatible with the platform.
|
||||
include $(CHIBIOS)/os/hal/ports/STM32/LLD/ADCv1/driver.mk
|
||||
include $(CHIBIOS)/os/hal/ports/STM32/LLD/DACv1/driver.mk
|
||||
include $(CHIBIOS)/os/hal/ports/STM32/LLD/DMAv1/driver.mk
|
||||
include $(CHIBIOS)/os/hal/ports/STM32/LLD/EXTIv1/driver.mk
|
||||
include $(CHIBIOS)/os/hal/ports/STM32/LLD/GPIOv2/driver.mk
|
||||
include $(CHIBIOS)/os/hal/ports/STM32/LLD/I2Cv2/driver.mk
|
||||
include $(CHIBIOS)/os/hal/ports/STM32/LLD/RTCv2/driver.mk
|
||||
include $(CHIBIOS)/os/hal/ports/STM32/LLD/SPIv2/driver.mk
|
||||
include $(CHIBIOS)/os/hal/ports/STM32/LLD/TIMv1/driver.mk
|
||||
include $(CHIBIOS)/os/hal/ports/STM32/LLD/USARTv2/driver.mk
|
||||
include $(CHIBIOS)/os/hal/ports/STM32/LLD/xWDGv1/driver.mk
|
||||
|
||||
# Shared variables
|
||||
ALLCSRC += $(PLATFORMSRC)
|
||||
ALLINC += $(PLATFORMINC)
|
|
@ -0,0 +1,167 @@
|
|||
/*
|
||||
ChibiOS - Copyright (C) 2006..2018 Giovanni Di Sirio
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @file STM32G0xx/stm32_isr.h
|
||||
* @brief STM32G0xx ISR handler code.
|
||||
*
|
||||
* @addtogroup SRM32G0xx_ISR
|
||||
* @{
|
||||
*/
|
||||
|
||||
#include "hal.h"
|
||||
|
||||
/*===========================================================================*/
|
||||
/* Driver local definitions. */
|
||||
/*===========================================================================*/
|
||||
|
||||
/*===========================================================================*/
|
||||
/* Driver exported variables. */
|
||||
/*===========================================================================*/
|
||||
|
||||
/*===========================================================================*/
|
||||
/* Driver local variables. */
|
||||
/*===========================================================================*/
|
||||
|
||||
/*===========================================================================*/
|
||||
/* Driver local functions. */
|
||||
/*===========================================================================*/
|
||||
|
||||
#define exti_serve_irq(pr, channel) { \
|
||||
\
|
||||
if ((pr) & (1U << (channel))) { \
|
||||
_pal_isr_code(channel); \
|
||||
} \
|
||||
}
|
||||
|
||||
/*===========================================================================*/
|
||||
/* Driver interrupt handlers. */
|
||||
/*===========================================================================*/
|
||||
|
||||
#if (HAL_USE_PAL && (PAL_USE_WAIT || PAL_USE_CALLBACKS)) || defined(__DOXYGEN__)
|
||||
#if !defined(STM32_DISABLE_EXTI0_1_HANDLER)
|
||||
/**
|
||||
* @brief EXTI[0]...EXTI[1] interrupt handler.
|
||||
*
|
||||
* @isr
|
||||
*/
|
||||
OSAL_IRQ_HANDLER(Vector54) {
|
||||
uint32_t pr;
|
||||
|
||||
OSAL_IRQ_PROLOGUE();
|
||||
|
||||
pr = EXTI->PR;
|
||||
pr &= ((1U << 0) | (1U << 1));
|
||||
EXTI->PR = pr;
|
||||
|
||||
exti_serve_irq(pr, 0);
|
||||
exti_serve_irq(pr, 1);
|
||||
|
||||
OSAL_IRQ_EPILOGUE();
|
||||
}
|
||||
#endif
|
||||
|
||||
#if !defined(STM32_DISABLE_EXTI2_3_HANDLER)
|
||||
/**
|
||||
* @brief EXTI[2]...EXTI[3] interrupt handler.
|
||||
*
|
||||
* @isr
|
||||
*/
|
||||
OSAL_IRQ_HANDLER(Vector58) {
|
||||
uint32_t pr;
|
||||
|
||||
OSAL_IRQ_PROLOGUE();
|
||||
|
||||
pr = EXTI->PR;
|
||||
pr &= ((1U << 2) | (1U << 3));
|
||||
EXTI->PR = pr;
|
||||
|
||||
exti_serve_irq(pr, 2);
|
||||
exti_serve_irq(pr, 3);
|
||||
|
||||
OSAL_IRQ_EPILOGUE();
|
||||
}
|
||||
#endif
|
||||
|
||||
#if !defined(STM32_DISABLE_EXTI4_15_HANDLER)
|
||||
/**
|
||||
* @brief EXTI[4]...EXTI[15] interrupt handler.
|
||||
*
|
||||
* @isr
|
||||
*/
|
||||
OSAL_IRQ_HANDLER(Vector5C) {
|
||||
uint32_t pr;
|
||||
|
||||
OSAL_IRQ_PROLOGUE();
|
||||
|
||||
pr = EXTI->PR;
|
||||
pr &= ((1U << 4) | (1U << 5) | (1U << 6) | (1U << 7) | (1U << 8) |
|
||||
(1U << 9) | (1U << 10) | (1U << 11) | (1U << 12) | (1U << 13) |
|
||||
(1U << 14) | (1U << 15));
|
||||
EXTI->PR = pr;
|
||||
|
||||
exti_serve_irq(pr, 4);
|
||||
exti_serve_irq(pr, 5);
|
||||
exti_serve_irq(pr, 6);
|
||||
exti_serve_irq(pr, 7);
|
||||
exti_serve_irq(pr, 8);
|
||||
exti_serve_irq(pr, 9);
|
||||
exti_serve_irq(pr, 10);
|
||||
exti_serve_irq(pr, 11);
|
||||
exti_serve_irq(pr, 12);
|
||||
exti_serve_irq(pr, 13);
|
||||
exti_serve_irq(pr, 14);
|
||||
exti_serve_irq(pr, 15);
|
||||
|
||||
OSAL_IRQ_EPILOGUE();
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* HAL_USE_PAL && (PAL_USE_WAIT || PAL_USE_CALLBACKS) */
|
||||
|
||||
/*===========================================================================*/
|
||||
/* Driver exported functions. */
|
||||
/*===========================================================================*/
|
||||
|
||||
/**
|
||||
* @brief Enables IRQ sources.
|
||||
*
|
||||
* @notapi
|
||||
*/
|
||||
void irqInit(void) {
|
||||
|
||||
#if HAL_USE_PAL
|
||||
nvicEnableVector(EXTI0_1_IRQn, STM32_IRQ_EXTI0_1_PRIORITY);
|
||||
nvicEnableVector(EXTI2_3_IRQn, STM32_IRQ_EXTI2_3_PRIORITY);
|
||||
nvicEnableVector(EXTI4_15_IRQn, STM32_IRQ_EXTI4_15_PRIORITY);
|
||||
#endif
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Disables IRQ sources.
|
||||
*
|
||||
* @notapi
|
||||
*/
|
||||
void irqDeinit(void) {
|
||||
|
||||
#if HAL_USE_PAL
|
||||
nvicDisableVector(EXTI0_1_IRQn);
|
||||
nvicDisableVector(EXTI2_3_IRQn);
|
||||
nvicDisableVector(EXTI4_15_IRQn);
|
||||
#endif
|
||||
}
|
||||
|
||||
/** @} */
|
|
@ -0,0 +1,156 @@
|
|||
/*
|
||||
ChibiOS - Copyright (C) 2006..2018 Giovanni Di Sirio
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @file STM32G0xx/stm32_isr.h
|
||||
* @brief STM32G0xx ISR handler header.
|
||||
*
|
||||
* @addtogroup STM32G0xx_ISR
|
||||
* @{
|
||||
*/
|
||||
|
||||
#ifndef STM32_ISR_H
|
||||
#define STM32_ISR_H
|
||||
|
||||
/*===========================================================================*/
|
||||
/* Driver constants. */
|
||||
/*===========================================================================*/
|
||||
|
||||
/**
|
||||
* @name ISR names and numbers remapping
|
||||
* @{
|
||||
*/
|
||||
/*
|
||||
|
||||
/*
|
||||
* I2C units.
|
||||
*/
|
||||
#define STM32_I2C1_GLOBAL_HANDLER Vector9C
|
||||
#define STM32_I2C1_GLOBAL_NUMBER 23
|
||||
|
||||
#define STM32_I2C2_GLOBAL_HANDLER VectorA0
|
||||
#define STM32_I2C2_GLOBAL_NUMBER 24
|
||||
|
||||
/*
|
||||
* TIM units.
|
||||
*/
|
||||
#define STM32_TIM1_UP_HANDLER Vector74
|
||||
#define STM32_TIM1_CC_HANDLER Vector78
|
||||
#define STM32_TIM2_HANDLER Vector7C
|
||||
#define STM32_TIM3_HANDLER VectorB4
|
||||
#define STM32_TIM6_HANDLER Vector84
|
||||
#define STM32_TIM7_HANDLER Vector88
|
||||
#define STM32_TIM14_HANDLER Vector8C
|
||||
#define STM32_TIM15_HANDLER Vector90
|
||||
#define STM32_TIM16_HANDLER Vector94
|
||||
#define STM32_TIM17_HANDLER Vector98
|
||||
|
||||
#define STM32_TIM1_UP_NUMBER 13
|
||||
#define STM32_TIM1_CC_NUMBER 14
|
||||
#define STM32_TIM2_NUMBER 15
|
||||
#define STM32_TIM3_NUMBER 29
|
||||
#define STM32_TIM6_NUMBER 17
|
||||
#define STM32_TIM7_NUMBER 18
|
||||
#define STM32_TIM14_NUMBER 19
|
||||
#define STM32_TIM15_NUMBER 20
|
||||
#define STM32_TIM16_NUMBER 21
|
||||
#define STM32_TIM17_NUMBER 22
|
||||
|
||||
/*
|
||||
* USART units.
|
||||
*/
|
||||
#define STM32_USART1_HANDLER VectorAC
|
||||
#define STM32_USART2_HANDLER VectorB0
|
||||
#define STM32_USART3_8_LP1_HANDLER VectorB4
|
||||
|
||||
#define STM32_USART1_NUMBER 27
|
||||
#define STM32_USART2_NUMBER 28
|
||||
#define STM32_USART3_8_LP1_NUMBER 29
|
||||
|
||||
/*
|
||||
* USB units.
|
||||
*/
|
||||
#define STM32_USB1_LP_HANDLER VectorBC
|
||||
#define STM32_USB1_LP_NUMBER 31
|
||||
#define STM32_USB1_HP_HANDLER VectorBC
|
||||
#define STM32_USB1_HP_NUMBER 31
|
||||
/** @} */
|
||||
|
||||
/*===========================================================================*/
|
||||
/* Driver pre-compile time settings. */
|
||||
/*===========================================================================*/
|
||||
|
||||
/**
|
||||
* @name Configuration options
|
||||
* @{
|
||||
*/
|
||||
/**
|
||||
* @brief EXTI0..1 interrupt priority level setting.
|
||||
*/
|
||||
#if !defined(STM32_IRQ_EXTI0_1_PRIORITY) || defined(__DOXYGEN__)
|
||||
#define STM32_IRQ_EXTI0_1_PRIORITY 3
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief EXTI2..3 interrupt priority level setting.
|
||||
*/
|
||||
#if !defined(STM32_IRQ_EXTI2_3_PRIORITY) || defined(__DOXYGEN__)
|
||||
#define STM32_IRQ_EXTI2_3_PRIORITY 3
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief EXTI4..15 interrupt priority level setting.
|
||||
*/
|
||||
#if !defined(STM32_IRQ_EXTI4_15_PRIORITY) || defined(__DOXYGEN__)
|
||||
#define STM32_IRQ_EXTI4_15_PRIORITY 3
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief EXTI16 interrupt priority level setting.
|
||||
*/
|
||||
#if !defined(STM32_IRQ_EXTI16_PRIORITY) || defined(__DOXYGEN__)
|
||||
#define STM32_IRQ_EXTI16_PRIORITY 3
|
||||
#endif
|
||||
/** @} */
|
||||
|
||||
/*===========================================================================*/
|
||||
/* Derived constants and error checks. */
|
||||
/*===========================================================================*/
|
||||
|
||||
/*===========================================================================*/
|
||||
/* Driver data structures and types. */
|
||||
/*===========================================================================*/
|
||||
|
||||
/*===========================================================================*/
|
||||
/* Driver macros. */
|
||||
/*===========================================================================*/
|
||||
|
||||
/*===========================================================================*/
|
||||
/* External declarations. */
|
||||
/*===========================================================================*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
void irqInit(void);
|
||||
void irqDeinit(void);
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* STM32_ISR_H */
|
||||
|
||||
/** @} */
|
|
@ -136,6 +136,49 @@
|
|||
(void)RCC->APBRSTR2; \
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Enables the clock of one or more peripheral on the IOP bus.
|
||||
*
|
||||
* @param[in] mask IOP peripherals mask
|
||||
* @param[in] lp low power enable flag
|
||||
*
|
||||
* @api
|
||||
*/
|
||||
#define rccEnableIOP(mask, lp) { \
|
||||
RCC->IOPENR |= (mask); \
|
||||
if (lp) \
|
||||
RCC->IOPSMENR |= (mask); \
|
||||
else \
|
||||
RCC->IOPSMENR &= ~(mask); \
|
||||
(void)RCC->IOPSMENR; \
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Disables the clock of one or more peripheral on the IOP bus.
|
||||
*
|
||||
* @param[in] mask IOP peripherals mask
|
||||
*
|
||||
* @api
|
||||
*/
|
||||
#define rccDisableIOP(mask) { \
|
||||
RCC->IOPENR &= ~(mask); \
|
||||
RCC->IOPSMENR &= ~(mask); \
|
||||
(void)RCC->IOPSMENR; \
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Resets one or more peripheral on the IOP bus.
|
||||
*
|
||||
* @param[in] mask IOP peripherals mask
|
||||
*
|
||||
* @api
|
||||
*/
|
||||
#define rccResetIOP(mask) { \
|
||||
RCC->IOPRSTR |= (mask); \
|
||||
RCC->IOPRSTR &= ~(mask); \
|
||||
(void)RCC->IOPRSTR; \
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Enables the clock of one or more peripheral on the AHB bus.
|
||||
*
|
||||
|
|
|
@ -144,13 +144,7 @@
|
|||
|
||||
/* I2C attributes.*/
|
||||
#define STM32_HAS_I2C1 TRUE
|
||||
#define STM32_I2C1_GLOBAL_HANDLER Vector9C
|
||||
#define STM32_I2C1_GLOBAL_NUMBER 23
|
||||
|
||||
#define STM32_HAS_I2C2 TRUE
|
||||
#define STM32_I2C1_GLOBAL_HANDLER VectorA0
|
||||
#define STM32_I2C1_GLOBAL_NUMBER 24
|
||||
|
||||
#define STM32_HAS_I2C3 FALSE
|
||||
#define STM32_HAS_I2C4 FALSE
|
||||
|
||||
|
@ -183,52 +177,34 @@
|
|||
#define STM32_HAS_TIM1 TRUE
|
||||
#define STM32_TIM1_IS_32BITS FALSE
|
||||
#define STM32_TIM1_CHANNELS 6
|
||||
#define STM32_TIM1_UP_HANDLER Vector74
|
||||
#define STM32_TIM1_CC_HANDLER Vector78
|
||||
#define STM32_TIM1_UP_NUMBER 13
|
||||
#define STM32_TIM1_CC_NUMBER 14
|
||||
|
||||
#define STM32_HAS_TIM3 TRUE
|
||||
#define STM32_TIM3_IS_32BITS FALSE
|
||||
#define STM32_TIM3_CHANNELS 4
|
||||
#define STM32_TIM3_HANDLER VectorB4
|
||||
#define STM32_TIM3_NUMBER 29
|
||||
|
||||
#define STM32_HAS_TIM6 TRUE
|
||||
#define STM32_TIM6_IS_32BITS FALSE
|
||||
#define STM32_TIM6_CHANNELS 0
|
||||
#define STM32_TIM6_HANDLER Vector84
|
||||
#define STM32_TIM6_NUMBER 17
|
||||
|
||||
#define STM32_HAS_TIM7 TRUE
|
||||
#define STM32_TIM7_IS_32BITS FALSE
|
||||
#define STM32_TIM7_CHANNELS 0
|
||||
#define STM32_TIM7_HANDLER Vector88
|
||||
#define STM32_TIM7_NUMBER 18
|
||||
|
||||
#define STM32_HAS_TIM14 TRUE
|
||||
#define STM32_TIM14_IS_32BITS FALSE
|
||||
#define STM32_TIM14_CHANNELS 1
|
||||
#define STM32_TIM14_HANDLER Vector8C
|
||||
#define STM32_TIM14_NUMBER 19
|
||||
|
||||
#define STM32_HAS_TIM15 TRUE
|
||||
#define STM32_TIM15_IS_32BITS FALSE
|
||||
#define STM32_TIM15_CHANNELS 2
|
||||
#define STM32_TIM15_HANDLER Vector90
|
||||
#define STM32_TIM15_NUMBER 20
|
||||
|
||||
#define STM32_HAS_TIM16 TRUE
|
||||
#define STM32_TIM16_IS_32BITS FALSE
|
||||
#define STM32_TIM16_CHANNELS 2
|
||||
#define STM32_TIM16_HANDLER Vector94
|
||||
#define STM32_TIM16_NUMBER 21
|
||||
#define STM32_TIM16_CHANNELS 1
|
||||
|
||||
#define STM32_HAS_TIM17 TRUE
|
||||
#define STM32_TIM17_IS_32BITS FALSE
|
||||
#define STM32_TIM17_CHANNELS 2
|
||||
#define STM32_TIM17_HANDLER Vector98
|
||||
#define STM32_TIM17_NUMBER 22
|
||||
#define STM32_TIM17_CHANNELS 1
|
||||
|
||||
#define STM32_HAS_TIM2 FALSE
|
||||
#define STM32_HAS_TIM4 FALSE
|
||||
|
|
Loading…
Reference in New Issue