|
| 1 | +/* |
| 2 | + * This file is part of the Micro Python project, http://micropython.org/ |
| 3 | + * |
| 4 | + * The MIT License (MIT) |
| 5 | + * |
| 6 | + * Copyright (c) 2013, 2014 Damien P. George |
| 7 | + * |
| 8 | + * Permission is hereby granted, free of charge, to any person obtaining a copy |
| 9 | + * of this software and associated documentation files (the "Software"), to deal |
| 10 | + * in the Software without restriction, including without limitation the rights |
| 11 | + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell |
| 12 | + * copies of the Software, and to permit persons to whom the Software is |
| 13 | + * furnished to do so, subject to the following conditions: |
| 14 | + * |
| 15 | + * The above copyright notice and this permission notice shall be included in |
| 16 | + * all copies or substantial portions of the Software. |
| 17 | + * |
| 18 | + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
| 19 | + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
| 20 | + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
| 21 | + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
| 22 | + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
| 23 | + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN |
| 24 | + * THE SOFTWARE. |
| 25 | + */ |
| 26 | + |
| 27 | +// This file contains pin definitions that are specific to the stmhal port. |
| 28 | +// This file should only ever be #included by pin.h and not directly. |
| 29 | + |
| 30 | +enum { |
| 31 | + PORT_A, |
| 32 | + PORT_B, |
| 33 | + PORT_C, |
| 34 | + PORT_D, |
| 35 | + PORT_E, |
| 36 | + PORT_F, |
| 37 | + PORT_G, |
| 38 | + PORT_H, |
| 39 | + PORT_I, |
| 40 | + PORT_J, |
| 41 | +}; |
| 42 | + |
| 43 | +enum { |
| 44 | + AF_FN_TIM, |
| 45 | + AF_FN_I2C, |
| 46 | + AF_FN_USART, |
| 47 | + AF_FN_UART = AF_FN_USART, |
| 48 | + AF_FN_SPI |
| 49 | +}; |
| 50 | + |
| 51 | +enum { |
| 52 | + AF_PIN_TYPE_TIM_CH1 = 0, |
| 53 | + AF_PIN_TYPE_TIM_CH2, |
| 54 | + AF_PIN_TYPE_TIM_CH3, |
| 55 | + AF_PIN_TYPE_TIM_CH4, |
| 56 | + AF_PIN_TYPE_TIM_CH1N, |
| 57 | + AF_PIN_TYPE_TIM_CH2N, |
| 58 | + AF_PIN_TYPE_TIM_CH3N, |
| 59 | + AF_PIN_TYPE_TIM_CH1_ETR, |
| 60 | + AF_PIN_TYPE_TIM_ETR, |
| 61 | + AF_PIN_TYPE_TIM_BKIN, |
| 62 | + |
| 63 | + AF_PIN_TYPE_I2C_SDA = 0, |
| 64 | + AF_PIN_TYPE_I2C_SCL, |
| 65 | + |
| 66 | + AF_PIN_TYPE_USART_TX = 0, |
| 67 | + AF_PIN_TYPE_USART_RX, |
| 68 | + AF_PIN_TYPE_USART_CTS, |
| 69 | + AF_PIN_TYPE_USART_RTS, |
| 70 | + AF_PIN_TYPE_USART_CK, |
| 71 | + AF_PIN_TYPE_UART_TX = AF_PIN_TYPE_USART_TX, |
| 72 | + AF_PIN_TYPE_UART_RX = AF_PIN_TYPE_USART_RX, |
| 73 | + AF_PIN_TYPE_UART_CTS = AF_PIN_TYPE_USART_CTS, |
| 74 | + AF_PIN_TYPE_UART_RTS = AF_PIN_TYPE_USART_RTS, |
| 75 | + |
| 76 | + AF_PIN_TYPE_SPI_MOSI = 0, |
| 77 | + AF_PIN_TYPE_SPI_MISO, |
| 78 | + AF_PIN_TYPE_SPI_SCK, |
| 79 | + AF_PIN_TYPE_SPI_NSS, |
| 80 | +}; |
| 81 | + |
| 82 | +enum { |
| 83 | + PIN_ADC1 = (1 << 0), |
| 84 | + PIN_ADC2 = (1 << 1), |
| 85 | + PIN_ADC3 = (1 << 2), |
| 86 | +}; |
| 87 | + |
| 88 | +#define PIN_DEFS_PORT_AF_UNION \ |
| 89 | + TIM_TypeDef *TIM; \ |
| 90 | + I2C_TypeDef *I2C; \ |
| 91 | + USART_TypeDef *USART; \ |
| 92 | + USART_TypeDef *UART; \ |
| 93 | + SPI_TypeDef *SPI; |
| 94 | + |
| 95 | +typedef GPIO_TypeDef pin_gpio_t; |
| 96 | + |
0 commit comments