1 // Copyright 2021 The Pigweed Authors 2 // 3 // Licensed under the Apache License, Version 2.0 (the "License"); you may not 4 // use this file except in compliance with the License. You may obtain a copy of 5 // the License at 6 // 7 // https://www.apache.org/licenses/LICENSE-2.0 8 // 9 // Unless required by applicable law or agreed to in writing, software 10 // distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 11 // WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 12 // License for the specific language governing permissions and limitations under 13 // the License. 14 15 #pragma once 16 17 // Defaults to USART1 on the STM32F429xx, but can be overridden. 18 19 // The USART peripheral number to use. (1 for USART1, 2 for USART2, etc.) 20 #ifndef PW_SYS_IO_STM32CUBE_USART_NUM 21 #define PW_SYS_IO_STM32CUBE_USART_NUM 1 22 #endif // PW_SYS_IO_STM32CUBE_USART_NUM 23 24 // The port that the USART peripheral TX/RX pins are on. (e.g. to use A9/A10 25 // pins for TX and RX, respectively, set this to A) 26 #ifndef PW_SYS_IO_STM32CUBE_GPIO_PORT 27 #define PW_SYS_IO_STM32CUBE_GPIO_PORT A 28 #endif // PW_SYS_IO_STM32CUBE_GPIO_PORT 29 30 // The ports the USART peripheral TX and RX pins are on (if different ports). 31 #ifndef PW_SYS_IO_STM32CUBE_GPIO_TX_PORT 32 #define PW_SYS_IO_STM32CUBE_GPIO_TX_PORT PW_SYS_IO_STM32CUBE_GPIO_PORT 33 #endif // PW_SYS_IO_STM32CUBE_GPIO_TX_PORT 34 35 #ifndef PW_SYS_IO_STM32CUBE_GPIO_RX_PORT 36 #define PW_SYS_IO_STM32CUBE_GPIO_RX_PORT PW_SYS_IO_STM32CUBE_GPIO_PORT 37 #endif // PW_SYS_IO_STM32CUBE_GPIO_RX_PORT 38 39 // The pin index to use for USART transmission within the port set by 40 // PW_SYS_IO_STM32CUBE_GPIO_PORT. 41 #ifndef PW_SYS_IO_STM32CUBE_GPIO_TX_PIN 42 #define PW_SYS_IO_STM32CUBE_GPIO_TX_PIN 9 43 #endif // PW_SYS_IO_STM32CUBE_GPIO_TX_PIN 44 45 // The pin index to use for USART reception within the port set by 46 // PW_SYS_IO_STM32CUBE_GPIO_PORT. 47 #ifndef PW_SYS_IO_STM32CUBE_GPIO_RX_PIN 48 #define PW_SYS_IO_STM32CUBE_GPIO_RX_PIN 10 49 #endif // PW_SYS_IO_STM32CUBE_GPIO_RX_PIN 50 51 // The Alternate Function to use for configuring USART pins. 52 #ifndef PW_SYS_IO_STM32CUBE_GPIO_AF 53 #define PW_SYS_IO_STM32CUBE_GPIO_AF 7 54 #endif // PW_SYS_IO_STM32CUBE_GPIO_AF 55 56 // The remap to enable for configuring USART pins (stm32f1xx family only). 57 #ifndef PW_SYS_IO_STM32CUBE_GPIO_REMAP 58 #define PW_SYS_IO_STM32CUBE_GPIO_REMAP DISABLE 59 #endif // PW_SYS_IO_STM32CUBE_GPIO_REMAP 60 61 // The type of this peripheral. "USART" or "UART". 62 #ifndef PW_SYS_IO_STM32CUBE_USART_PREFIX 63 #define PW_SYS_IO_STM32CUBE_USART_PREFIX USART 64 #endif // PW_SYS_IO_STM32CUBE_GPIO_AF 65