diff options
| author | Damien George | 2018-04-11 16:27:48 +1000 |
|---|---|---|
| committer | Damien George | 2018-04-11 16:35:24 +1000 |
| commit | a7ebac2eaed7eb0da362568b9333339634f1da1d (patch) | |
| tree | 0f5d9832bf9f61e8b968d00fc22a93cb706a983d /ports/stm32/boards/PYBV11 | |
| parent | 0041396f05bc1f43657c343df6b291fc4bbdc901 (diff) | |
stm32/can: Allow CAN pins to be configured per board.
This patch allows a given board to configure which pins are used for the
CAN peripherals, in a similar way to all the other bus peripherals (I2C,
UART, SPI). To enable CAN on a board the mpconfigboard.h file should
define (for example):
#define MICROPY_HW_CAN1_TX (pin_B9)
#define MICROPY_HW_CAN1_RX (pin_B8)
#define MICROPY_HW_CAN2_TX (pin_B13)
#define MICROPY_HW_CAN2_RX (pin_B12)
And the board config file should no longer define MICROPY_HW_ENABLE_CAN.
Diffstat (limited to 'ports/stm32/boards/PYBV11')
| -rw-r--r-- | ports/stm32/boards/PYBV11/mpconfigboard.h | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/ports/stm32/boards/PYBV11/mpconfigboard.h b/ports/stm32/boards/PYBV11/mpconfigboard.h index 71ff52848..2c75d0e64 100644 --- a/ports/stm32/boards/PYBV11/mpconfigboard.h +++ b/ports/stm32/boards/PYBV11/mpconfigboard.h @@ -10,7 +10,6 @@ #define MICROPY_HW_ENABLE_RTC (1) #define MICROPY_HW_ENABLE_SERVO (1) #define MICROPY_HW_ENABLE_DAC (1) -#define MICROPY_HW_ENABLE_CAN (1) #define MICROPY_HW_ENABLE_USB (1) // HSE is 12MHz @@ -66,8 +65,12 @@ #define MICROPY_HW_SPI2_MOSI (pin_B15) // Y8 // CAN busses -#define MICROPY_HW_CAN1_NAME "YA" // CAN1 on RX,TX = Y3,Y4 = PB8,PB9 -#define MICROPY_HW_CAN2_NAME "YB" // CAN2 on RX,TX = Y5,Y6 = PB12,PB13 +#define MICROPY_HW_CAN1_NAME "YA" +#define MICROPY_HW_CAN1_TX (pin_B9) // Y4 +#define MICROPY_HW_CAN1_RX (pin_B8) // Y3 +#define MICROPY_HW_CAN2_NAME "YB" +#define MICROPY_HW_CAN2_TX (pin_B13) // Y6 +#define MICROPY_HW_CAN2_RX (pin_B12) // Y5 // USRSW has no pullup or pulldown, and pressing the switch makes the input go low #define MICROPY_HW_USRSW_PIN (pin_B3) |
