Skip to content

Commit b8373ac

Browse files
authored
Merge pull request adafruit#2266 from hierophect/stm32-defaults
STM32: Add board defaults
2 parents 01bf932 + e66fcb5 commit b8373ac

File tree

8 files changed

+30
-10
lines changed

8 files changed

+30
-10
lines changed

ports/stm32f4/boards/feather_stm32f405_express/board.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,12 +25,13 @@
2525
*/
2626

2727
#include "boards/board.h"
28+
#include "mpconfigboard.h"
2829

2930
void board_init(void) {
3031
}
3132

3233
bool board_requests_safe_mode(void) {
33-
return false;
34+
return false;
3435
}
3536

3637
void reset_board(void) {

ports/stm32f4/boards/feather_stm32f405_express/mpconfigboard.h

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,7 @@
33
*
44
* The MIT License (MIT)
55
*
6-
* Copyright (c) 2016 Glenn Ruben Bakke
7-
* Copyright (c) 2018 Dan Halbert for Adafruit Industries
6+
* Copyright (c) 2019 Lucian Copeland for Adafruit Industries
87
*
98
* Permission is hereby granted, free of charge, to any person obtaining a copy
109
* of this software and associated documentation files (the "Software"), to deal
@@ -41,3 +40,13 @@
4140
#define SPI_FLASH_MISO_PIN &pin_PB04
4241
#define SPI_FLASH_SCK_PIN &pin_PB03
4342
#define SPI_FLASH_CS_PIN &pin_PA15
43+
44+
#define DEFAULT_I2C_BUS_SCL (&pin_PB06)
45+
#define DEFAULT_I2C_BUS_SDA (&pin_PB07)
46+
47+
#define DEFAULT_SPI_BUS_SCK (&pin_PB13)
48+
#define DEFAULT_SPI_BUS_MOSI (&pin_PB15)
49+
#define DEFAULT_SPI_BUS_MISO (&pin_PB14)
50+
51+
#define DEFAULT_UART_BUS_RX (&pin_PB11)
52+
#define DEFAULT_UART_BUS_TX (&pin_PB10)

ports/stm32f4/boards/feather_stm32f405_express/pins.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,5 +25,9 @@ STATIC const mp_rom_map_elem_t board_module_globals_table[] = {
2525

2626
{ MP_ROM_QSTR(MP_QSTR_TX), MP_ROM_PTR(&pin_PB10) },
2727
{ MP_ROM_QSTR(MP_QSTR_RX), MP_ROM_PTR(&pin_PB11) },
28+
29+
{ MP_ROM_QSTR(MP_QSTR_I2C), MP_ROM_PTR(&board_i2c_obj) },
30+
{ MP_ROM_QSTR(MP_QSTR_SPI), MP_ROM_PTR(&board_spi_obj) },
31+
{ MP_ROM_QSTR(MP_QSTR_UART), MP_ROM_PTR(&board_uart_obj) },
2832
};
2933
MP_DEFINE_CONST_DICT(board_module_globals, board_module_globals_table);

ports/stm32f4/boards/pyboard_v11/mpconfigboard.h

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,7 @@
33
*
44
* The MIT License (MIT)
55
*
6-
* Copyright (c) 2016 Glenn Ruben Bakke
7-
* Copyright (c) 2018 Dan Halbert for Adafruit Industries
6+
* Copyright (c) 2019 Lucian Copeland for Adafruit Industries
87
*
98
* Permission is hereby granted, free of charge, to any person obtaining a copy
109
* of this software and associated documentation files (the "Software"), to deal
@@ -34,4 +33,7 @@
3433
#define FLASH_PAGE_SIZE (0x4000)
3534

3635
#define AUTORESET_DELAY_MS 500
37-
#define BOARD_FLASH_SIZE (FLASH_SIZE - 0x4000)
36+
#define BOARD_FLASH_SIZE (FLASH_SIZE - 0x4000)
37+
38+
#define DEFAULT_I2C_BUS_SCL (&pin_PB06)
39+
#define DEFAULT_I2C_BUS_SDA (&pin_PB07)

ports/stm32f4/boards/pyboard_v11/pins.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,5 +46,7 @@ STATIC const mp_rom_map_elem_t board_module_globals_table[] = {
4646

4747
{ MP_ROM_QSTR(MP_QSTR_SCL), MP_ROM_PTR(&pin_PB06) },
4848
{ MP_ROM_QSTR(MP_QSTR_SDA), MP_ROM_PTR(&pin_PB07) },
49+
50+
{ MP_ROM_QSTR(MP_QSTR_I2C), MP_ROM_PTR(&board_i2c_obj) },
4951
};
5052
MP_DEFINE_CONST_DICT(board_module_globals, board_module_globals_table);

ports/stm32f4/boards/stm32f411ve_discovery/mpconfigboard.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,7 @@
33
*
44
* The MIT License (MIT)
55
*
6-
* Copyright (c) 2016 Glenn Ruben Bakke
7-
* Copyright (c) 2018 Dan Halbert for Adafruit Industries
6+
* Copyright (c) 2019 Lucian Copeland for Adafruit Industries
87
*
98
* Permission is hereby granted, free of charge, to any person obtaining a copy
109
* of this software and associated documentation files (the "Software"), to deal

ports/stm32f4/boards/stm32f412zg_discovery/mpconfigboard.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,7 @@
33
*
44
* The MIT License (MIT)
55
*
6-
* Copyright (c) 2016 Glenn Ruben Bakke
7-
* Copyright (c) 2018 Dan Halbert for Adafruit Industries
6+
* Copyright (c) 2019 Lucian Copeland for Adafruit Industries
87
*
98
* Permission is hereby granted, free of charge, to any person obtaining a copy
109
* of this software and associated documentation files (the "Software"), to deal
@@ -36,3 +35,5 @@
3635
#define AUTORESET_DELAY_MS 500
3736
#define BOARD_FLASH_SIZE (FLASH_SIZE - 0x4000)
3837

38+
#define DEFAULT_I2C_BUS_SCL (&pin_PB10)
39+
#define DEFAULT_I2C_BUS_SDA (&pin_PB09)

ports/stm32f4/boards/stm32f412zg_discovery/pins.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,5 +88,7 @@ STATIC const mp_rom_map_elem_t board_module_globals_table[] = {
8888
{ MP_ROM_QSTR(MP_QSTR_LED2), MP_ROM_PTR(&pin_PE01) },
8989
{ MP_ROM_QSTR(MP_QSTR_LED3), MP_ROM_PTR(&pin_PE02) },
9090
{ MP_ROM_QSTR(MP_QSTR_LED4), MP_ROM_PTR(&pin_PE03) },
91+
92+
{ MP_ROM_QSTR(MP_QSTR_I2C), MP_ROM_PTR(&board_i2c_obj) },
9193
};
9294
MP_DEFINE_CONST_DICT(board_module_globals, board_module_globals_table);

0 commit comments

Comments
 (0)