Debian Codegraph @

ports/stm32/boards/STM32F4DISC/mpconfigboard.h

raw
1 #define MICROPY_HW_BOARD_NAME "F4DISC"
2 #define MICROPY_HW_MCU_NAME "STM32F407"
3
4 #define MICROPY_HW_HAS_SWITCH (1)
5 #define MICROPY_HW_HAS_FLASH (1)
6 #define MICROPY_HW_ENABLE_RNG (1)
7 #define MICROPY_HW_ENABLE_RTC (1)
8 #define MICROPY_HW_ENABLE_DAC (1)
9 #define MICROPY_HW_ENABLE_USB (1)
10 #define MICROPY_HW_ENABLE_SERVO (1)
11
12 // HSE is 8MHz
13 #define MICROPY_HW_CLK_PLLM (8)
14 #define MICROPY_HW_CLK_PLLN (336)
15 #define MICROPY_HW_CLK_PLLP (RCC_PLLP_DIV2)
16 #define MICROPY_HW_CLK_PLLQ (7)
17
18 // UART config
19 #if 0
20 // A9 is used for USB VBUS detect, and A10 is used for USB_FS_ID.
21 // UART1 is also on PB6/7 but PB6 is tied to the Audio SCL line.
22 // Without board modifications, this makes UART1 unusable on this board.
23 #define MICROPY_HW_UART1_TX (pin_A9)
24 #define MICROPY_HW_UART1_RX (pin_A10)
25 #endif
26 #define MICROPY_HW_UART2_TX (pin_A2)
27 #define MICROPY_HW_UART2_RX (pin_A3)
28 #define MICROPY_HW_UART2_RTS (pin_A1)
29 #define MICROPY_HW_UART2_CTS (pin_A0)
30 #define MICROPY_HW_UART3_TX (pin_D8)
31 #define MICROPY_HW_UART3_RX (pin_D9)
32 #define MICROPY_HW_UART3_RTS (pin_D12)
33 #define MICROPY_HW_UART3_CTS (pin_D11)
34 #if MICROPY_HW_HAS_SWITCH == 0
35 // NOTE: A0 also connects to the user switch. To use UART4 you should
36 // set MICROPY_HW_HAS_SWITCH to 0, and also remove SB20 (on the back
37 // of the board near the USER switch).
38 #define MICROPY_HW_UART4_TX (pin_A0)
39 #define MICROPY_HW_UART4_RX (pin_A1)
40 #endif
41 // NOTE: PC7 is connected to MCLK on the Audio chip. This is an input signal
42 // so I think as long as you're not using the audio chip then it should
43 // be fine to use as a UART pin.
44 #define MICROPY_HW_UART6_TX (pin_C6)
45 #define MICROPY_HW_UART6_RX (pin_C7)
46
47 // I2C buses
48 #define MICROPY_HW_I2C1_SCL (pin_B6)
49 #define MICROPY_HW_I2C1_SDA (pin_B7)
50 #define MICROPY_HW_I2C2_SCL (pin_B10)
51 #define MICROPY_HW_I2C2_SDA (pin_B11)
52
53 // SPI buses
54 #define MICROPY_HW_SPI1_NSS (pin_A4)
55 #define MICROPY_HW_SPI1_SCK (pin_A5)
56 #define MICROPY_HW_SPI1_MISO (pin_A6)
57 #define MICROPY_HW_SPI1_MOSI (pin_A7)
58 #define MICROPY_HW_SPI2_NSS (pin_B12)
59 #define MICROPY_HW_SPI2_SCK (pin_B13)
60 #define MICROPY_HW_SPI2_MISO (pin_B14)
61 #define MICROPY_HW_SPI2_MOSI (pin_B15)
62
63 // CAN buses
64 #define MICROPY_HW_CAN1_TX (pin_B9)
65 #define MICROPY_HW_CAN1_RX (pin_B8)
66 #define MICROPY_HW_CAN2_TX (pin_B13)
67 #define MICROPY_HW_CAN2_RX (pin_B12)
68
69 // USRSW is pulled low. Pressing the button makes the input go high.
70 #define MICROPY_HW_USRSW_PIN (pin_A0)
71 #define MICROPY_HW_USRSW_PULL (GPIO_NOPULL)
72 #define MICROPY_HW_USRSW_EXTI_MODE (GPIO_MODE_IT_RISING)
73 #define MICROPY_HW_USRSW_PRESSED (1)
74
75 // LEDs
76 #define MICROPY_HW_LED1 (pin_D14) // red
77 #define MICROPY_HW_LED2 (pin_D12) // green
78 #define MICROPY_HW_LED3 (pin_D13) // orange
79 #define MICROPY_HW_LED4 (pin_D15) // blue
80 #define MICROPY_HW_LED_ON(pin) (mp_hal_pin_high(pin))
81 #define MICROPY_HW_LED_OFF(pin) (mp_hal_pin_low(pin))
82
83 // USB config
84 #define MICROPY_HW_USB_FS (1)
85 #define MICROPY_HW_USB_VBUS_DETECT_PIN (pin_A9)
86 #define MICROPY_HW_USB_OTG_ID_PIN (pin_A10)