stmhal: Some NETDUINO_PLUS_2 cleanup
- Put the I2C bus on the corect pins - Add the appropriate board_init to power the shield
This commit is contained in:
parent
9598f36a84
commit
4b2938a4b0
24
stmhal/boards/NETDUINO_PLUS_2/board_init.c
Normal file
24
stmhal/boards/NETDUINO_PLUS_2/board_init.c
Normal file
@ -0,0 +1,24 @@
|
||||
#include STM32_HAL_H
|
||||
|
||||
void NETDUINO_PLUS_2_board_early_init(void) {
|
||||
|
||||
__GPIOB_CLK_ENABLE();
|
||||
|
||||
// Turn off the backlight. LCD_BL_CTRL = PK3
|
||||
GPIO_InitTypeDef GPIO_InitStructure;
|
||||
GPIO_InitStructure.Speed = GPIO_SPEED_HIGH;
|
||||
GPIO_InitStructure.Mode = GPIO_MODE_OUTPUT_PP;
|
||||
GPIO_InitStructure.Pull = GPIO_PULLUP;
|
||||
|
||||
#if MICROPY_HW_HAS_SDCARD
|
||||
// Turn on the power enable for the sdcard (PB1)
|
||||
GPIO_InitStructure.Pin = GPIO_PIN_1;
|
||||
HAL_GPIO_Init(GPIOB, &GPIO_InitStructure);
|
||||
HAL_GPIO_WritePin(GPIOB, GPIO_PIN_1, GPIO_PIN_SET);
|
||||
#endif
|
||||
|
||||
// Turn on the power for the 5V on the expansion header (PB2)
|
||||
GPIO_InitStructure.Pin = GPIO_PIN_2;
|
||||
HAL_GPIO_Init(GPIOB, &GPIO_InitStructure);
|
||||
HAL_GPIO_WritePin(GPIOB, GPIO_PIN_2, GPIO_PIN_SET);
|
||||
}
|
@ -1,5 +1,3 @@
|
||||
#define NETDUINO_PLUS_2
|
||||
|
||||
#define MICROPY_HW_BOARD_NAME "NetduinoPlus2"
|
||||
#define MICROPY_HW_MCU_NAME "STM32F405RG"
|
||||
|
||||
@ -20,6 +18,9 @@
|
||||
#define MICROPY_HW_ENABLE_DAC (0)
|
||||
#define MICROPY_HW_ENABLE_CAN (0)
|
||||
|
||||
void NETDUINO_PLUS_2_board_early_init(void);
|
||||
#define MICROPY_BOARD_EARLY_INIT NETDUINO_PLUS_2_board_early_init
|
||||
|
||||
// HSE is 25MHz
|
||||
#define MICROPY_HW_CLK_PLLM (25)
|
||||
#define MICROPY_HW_CLK_PLLN (336)
|
||||
@ -43,8 +44,8 @@
|
||||
#define MICROPY_HW_UART6_PINS (GPIO_PIN_6 | GPIO_PIN_7)
|
||||
|
||||
// I2C busses
|
||||
#define MICROPY_HW_I2C2_SCL (pin_B10)
|
||||
#define MICROPY_HW_I2C2_SDA (pin_B11)
|
||||
#define MICROPY_HW_I2C1_SCL (pin_B6)
|
||||
#define MICROPY_HW_I2C1_SDA (pin_B7)
|
||||
|
||||
// SPI busses
|
||||
#define MICROPY_HW_SPI2_NSS (pin_B12)
|
||||
|
@ -12,6 +12,8 @@ D10,PB10
|
||||
D11,PB15
|
||||
D12,PB14
|
||||
D13,PB13
|
||||
SDA,PB6
|
||||
SCL,PB7
|
||||
A0,PC0
|
||||
A1,PC1
|
||||
A2,PC2
|
||||
|
|
@ -380,31 +380,6 @@ int main(void) {
|
||||
MICROPY_BOARD_EARLY_INIT();
|
||||
#endif
|
||||
|
||||
//TODO - Move the following to a board_init.c file for the NETDUINO
|
||||
#if 0
|
||||
#if defined(NETDUINO_PLUS_2)
|
||||
{
|
||||
GPIO_InitTypeDef GPIO_InitStructure;
|
||||
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_25MHz;
|
||||
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_OUT;
|
||||
GPIO_InitStructure.GPIO_OType = GPIO_OType_PP;
|
||||
GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_NOPULL;
|
||||
|
||||
#if MICROPY_HW_HAS_SDCARD
|
||||
// Turn on the power enable for the sdcard (PB1)
|
||||
GPIO_InitStructure.GPIO_Pin = GPIO_Pin_1;
|
||||
GPIO_Init(GPIOB, &GPIO_InitStructure);
|
||||
GPIO_WriteBit(GPIOB, GPIO_Pin_1, Bit_SET);
|
||||
#endif
|
||||
|
||||
// Turn on the power for the 5V on the expansion header (PB2)
|
||||
GPIO_InitStructure.GPIO_Pin = GPIO_Pin_2;
|
||||
GPIO_Init(GPIOB, &GPIO_InitStructure);
|
||||
GPIO_WriteBit(GPIOB, GPIO_Pin_2, Bit_SET);
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
// basic sub-system init
|
||||
pendsv_init();
|
||||
led_init();
|
||||
|
Loading…
Reference in New Issue
Block a user