1 #define MICROPY_HW_BOARD_NAME       "L496G-DISCO"
2 #define MICROPY_HW_MCU_NAME         "STM32L496"
3 
4 #define MICROPY_HW_HAS_SWITCH       (1)
5 #define MICROPY_HW_ENABLE_RNG       (1)
6 #define MICROPY_HW_ENABLE_RTC       (1)
7 #define MICROPY_HW_ENABLE_TIMER     (1)
8 #define MICROPY_HW_ENABLE_USB       (1)
9 
10 // MSI is used and is 4MHz,
11 // Resulting core frequency is 80MHz:
12 #define MICROPY_HW_CLK_PLLM (1)
13 #define MICROPY_HW_CLK_PLLN (40)
14 #define MICROPY_HW_CLK_PLLP (RCC_PLLP_DIV7)
15 #define MICROPY_HW_CLK_PLLR (RCC_PLLR_DIV2)
16 #define MICROPY_HW_CLK_PLLQ (RCC_PLLQ_DIV2)
17 #define MICROPY_HW_FLASH_LATENCY    FLASH_LATENCY_4
18 
19 // The board has an external 32kHz crystal
20 #define MICROPY_HW_RTC_USE_LSE      (1)
21 
22 // USART config
23 #define MICROPY_HW_UART2_TX     (pin_A2)
24 #define MICROPY_HW_UART2_RX     (pin_D6)
25 // USART 2 is connected to the virtual com port on the ST-LINK
26 #define MICROPY_HW_UART_REPL        PYB_UART_2
27 #define MICROPY_HW_UART_REPL_BAUD   115200
28 
29 // I2C buses
30 #define MICROPY_HW_I2C1_SCL (pin_G14)
31 #define MICROPY_HW_I2C1_SDA (pin_G13)
32 #define MICROPY_HW_I2C2_SCL (pin_H4)
33 #define MICROPY_HW_I2C2_SDA (pin_B14)
34 
35 // SPI buses
36 // -> To the arduino connector
37 #define MICROPY_HW_SPI1_NSS     (pin_A15)
38 #define MICROPY_HW_SPI1_SCK     (pin_A5)
39 #define MICROPY_HW_SPI1_MISO    (pin_B4)
40 #define MICROPY_HW_SPI1_MOSI    (pin_B5)
41 
42 // Use Sel from joystick. Joystick is pulled low. Pressing the button makes the input go high.
43 #define MICROPY_HW_USRSW_PIN        (pin_C13)
44 #define MICROPY_HW_USRSW_PULL       (GPIO_PULLDOWN)
45 #define MICROPY_HW_USRSW_EXTI_MODE  (GPIO_MODE_IT_RISING)
46 #define MICROPY_HW_USRSW_PRESSED    (1)
47 
48 // LED (The orange LED is controlled over MFX)
49 #define MICROPY_HW_LED1             (pin_B13) // Green
50 #define MICROPY_HW_LED_ON(pin)      (mp_hal_pin_low(pin))
51 #define MICROPY_HW_LED_OFF(pin)     (mp_hal_pin_high(pin))
52 // USB config
53 #define MICROPY_HW_USB_FS (1)
54 #define MICROPY_HW_USB_OTG_ID_PIN      (pin_A10)
55