|
|
|
/*
|
|
|
|
ChibiOS - Copyright (C) 2006..2020 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.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef BOARD_H
|
|
|
|
#define BOARD_H
|
|
|
|
|
|
|
|
/*===========================================================================*/
|
|
|
|
/* Driver constants. */
|
|
|
|
/*===========================================================================*/
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Setup for STMicroelectronics STM32 Nucleo32-G031K8 board.
|
|
|
|
*/
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Board identifier.
|
|
|
|
*/
|
|
|
|
#define BOARD_ST_NUCLEO32_G031J6
|
|
|
|
#define BOARD_NAME "STMicroelectronics STM32 Nucleo32-G031J6"
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Board oscillators-related settings.
|
|
|
|
* NOTE: HSE not fitted.
|
|
|
|
*/
|
|
|
|
#if !defined(STM32_LSECLK)
|
|
|
|
#define STM32_LSECLK 32768U
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#define STM32_LSEDRV (3U << 11U)
|
|
|
|
|
|
|
|
#if !defined(STM32_HSECLK)
|
|
|
|
#define STM32_HSECLK 0U
|
|
|
|
#endif
|
|
|
|
|
|
|
|
/*
|
|
|
|
* MCU type as defined in the ST header.
|
|
|
|
*/
|
|
|
|
#define STM32G031xx
|
|
|
|
|
|
|
|
/*
|
|
|
|
* IO lines assignments.
|
|
|
|
*/
|
|
|
|
#define LINE_I2S_SD PAL_LINE(GPIOA, 7U)
|
|
|
|
#define LINE_I2S_WS PAL_LINE(GPIOA, 4U)
|
|
|
|
#define LINE_I2S_CK PAL_LINE(GPIOA, 5U)
|
|
|
|
|
|
|
|
#define LINE_TP1 PAL_LINE(GPIOA, 12U)
|
|
|
|
|
|
|
|
#define LINE_LED0 PAL_LINE(GPIOB, 7U)
|
|
|
|
#define LINE_LED1 PAL_LINE(GPIOC, 14U)
|
|
|
|
#define LINE_LED2 PAL_LINE(GPIOC, 15U)
|
|
|
|
#define LINE_LED3 PAL_LINE(GPIOA, 0U)
|
|
|
|
#define LINE_LED4 PAL_LINE(GPIOA, 1U)
|
|
|
|
#define LINE_LED5 PAL_LINE(GPIOA, 2U)
|
|
|
|
#define LINE_LED6 PAL_LINE(GPIOA, 3U)
|
|
|
|
#define LINE_LED7 PAL_LINE(GPIOA, 6U)
|
|
|
|
#define LINE_LED8 PAL_LINE(GPIOB, 0U)
|
|
|
|
#define LINE_LED9 PAL_LINE(GPIOB, 3U)
|
|
|
|
|
|
|
|
/*
|
|
|
|
* 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))
|
|
|
|
|
|
|
|
/*===========================================================================*/
|
|
|
|
/* External declarations. */
|
|
|
|
/*===========================================================================*/
|
|
|
|
|
|
|
|
#if !defined(_FROM_ASM_)
|
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
|
|
|
void boardInit(void);
|
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
#endif /* _FROM_ASM_ */
|
|
|
|
|
|
|
|
#endif /* BOARD_H */
|