Re-expand pin reset

This commit is contained in:
Hierophect 2019-09-17 16:52:44 -04:00
parent 71531dd4d1
commit 863655044e
5 changed files with 34 additions and 6 deletions

View File

@ -92,6 +92,7 @@ uint16_t common_hal_analogio_analogin_get_value(analogio_analogin_obj_t *self) {
LL_GPIO_SetPinMode(pin_port(self->pin->port), (uint32_t)pin_mask(self->pin->number), LL_GPIO_MODE_ANALOG);
//LL_GPIO_PIN_0
//HAL Implementation
ADC_HandleTypeDef AdcHandle;
ADC_ChannelConfTypeDef sConfig;

View File

@ -106,6 +106,7 @@
#include "stm32f4xx_hal.h"
#include "stm32f4/gpio.h"
#include "common-hal/microcontroller/Pin.h"
void stm32f4_peripherals_gpio_init(void) {
//Enable all GPIO for now
@ -133,6 +134,20 @@ void stm32f4_peripherals_gpio_init(void) {
stm32f4_peripherals_status_led(1,0);
stm32f4_peripherals_status_led(2,0);
stm32f4_peripherals_status_led(3,0);
//Never reset pins
never_reset_pin_number(2,13); //PC13 anti tamp
never_reset_pin_number(2,14); //PC14 OSC32_IN
never_reset_pin_number(2,15); //PC15 OSC32_OUT
never_reset_pin_number(0,13); //PA13 SWDIO
never_reset_pin_number(0,14); //PA14 SWCLK
never_reset_pin_number(0,15); //PA15 JTDI
never_reset_pin_number(1,3); //PB3 JTDO
never_reset_pin_number(1,4); //PB4 JTRST
// Port H is not included in GPIO port array
// never_reset_pin_number(5,0); //PH0 JTDO
// never_reset_pin_number(5,1); //PH1 JTRST
}
//LEDs are inverted on F411 DISCO

View File

@ -94,9 +94,9 @@ const mcu_pin_obj_t pin_PA09 = PIN(0, 9, NO_ADC);
const mcu_pin_obj_t pin_PA10 = PIN(0, 10, NO_ADC);
const mcu_pin_obj_t pin_PA11 = PIN(0, 11, NO_ADC);
const mcu_pin_obj_t pin_PA12 = PIN(0, 12, NO_ADC);
const mcu_pin_obj_t pin_PA13 = PIN(0, 13, NO_ADC);
const mcu_pin_obj_t pin_PA14 = PIN(0, 14, NO_ADC);
const mcu_pin_obj_t pin_PA15 = PIN(0, 15, NO_ADC);
const mcu_pin_obj_t pin_PA13 = PIN(0, 13, NO_ADC); //SWDIO
const mcu_pin_obj_t pin_PA14 = PIN(0, 14, NO_ADC); //SWCLK
const mcu_pin_obj_t pin_PA15 = PIN(0, 15, NO_ADC); //JTDI
const mcu_pin_obj_t pin_PC10 = PIN(2, 10, NO_ADC);
const mcu_pin_obj_t pin_PC11 = PIN(2, 11, NO_ADC);

View File

@ -207,6 +207,20 @@ void stm32f4_peripherals_gpio_init(void) {
stm32f4_peripherals_status_led(1,0);
stm32f4_peripherals_status_led(2,0);
stm32f4_peripherals_status_led(3,0);
//Never reset pins
never_reset_pin_number(2,13); //PC13 anti tamp
never_reset_pin_number(2,14); //PC14 OSC32_IN
never_reset_pin_number(2,15); //PC15 OSC32_OUT
never_reset_pin_number(0,13); //PA13 SWDIO
never_reset_pin_number(0,14); //PA14 SWCLK
never_reset_pin_number(0,15); //PA15 JTDI
never_reset_pin_number(1,3); //PB3 JTDO
never_reset_pin_number(1,4); //PB4 JTRST
// Port H is not included in GPIO port array
// never_reset_pin_number(5,0); //PH0 JTDO
// never_reset_pin_number(5,1); //PH1 JTRST
}
//LEDs are inverted on F411 DISCO

View File

@ -50,10 +50,8 @@ safe_mode_t port_init(void) {
}
void reset_port(void) {
//reset_all_pins();
reset_all_pins();
//reset_pin_number(uint8_t pin_port, uint8_t pin_number)
for(int i=0;i<8;i++) reset_pin_number(0,i); //PA (analog)
for(int i=12;i<16;i++) reset_pin_number(3,i); //PD (leds)
}
void reset_to_bootloader(void) {