text fixes

This commit is contained in:
Hierophect 2019-09-24 10:05:40 -04:00
parent 2b65a0e95f
commit 31a22858d5
5 changed files with 50 additions and 55 deletions

View File

@ -45,21 +45,21 @@ typedef struct {
} mcu_pin_obj_t;
//Standard stm32 adc unit combinations
#define ADC_1 1
#define ADC_12 3
#define ADC_123 7
#define ADC_3 4
#define ADC_1 1
#define ADC_12 3
#define ADC_123 7
#define ADC_3 4
//STM32 ADC pins can have a combination of 1, 2 or all 3 ADCs on a single pin,
//but all 3 ADCs will share the same input number per pin.
//F4 family has 3 ADC max, 24 channels max.
#define ADC_INPUT(mask, number) \
.adc_unit = mask, \
.adc_channel = number,
.adc_unit = mask, \
.adc_channel = number,
#define NO_ADC \
.adc_unit = 0x00, \
.adc_channel = 0x1f
.adc_unit = 0x00, \
.adc_channel = 0x1f
extern const mp_obj_type_t mcu_pin_type;

View File

@ -29,24 +29,19 @@
#include "common-hal/microcontroller/Pin.h"
void stm32f4_peripherals_gpio_init(void) {
//Enable all GPIO for now
__HAL_RCC_GPIOE_CLK_ENABLE();
__HAL_RCC_GPIOC_CLK_ENABLE();
__HAL_RCC_GPIOF_CLK_ENABLE();
__HAL_RCC_GPIOH_CLK_ENABLE();
__HAL_RCC_GPIOA_CLK_ENABLE();
__HAL_RCC_GPIOB_CLK_ENABLE();
__HAL_RCC_GPIOG_CLK_ENABLE();
__HAL_RCC_GPIOD_CLK_ENABLE();
//Enable all GPIO for now
__HAL_RCC_GPIOC_CLK_ENABLE();
__HAL_RCC_GPIOA_CLK_ENABLE();
__HAL_RCC_GPIOB_CLK_ENABLE();
//Status LED chain
stm32f4_peripherals_status_led(0,1);
stm32f4_peripherals_status_led(1,0);
stm32f4_peripherals_status_led(2,0);
stm32f4_peripherals_status_led(3,0);
//Status LED chain
stm32f4_peripherals_status_led(0,1);
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 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

View File

@ -34,16 +34,16 @@
I2C_TypeDef * mcu_i2c_banks[3] = {I2C1, I2C2, I2C3};
const mcu_i2c_sda_obj_t mcu_i2c_sda_list[4] = {
I2C_SDA(1, 4, &pin_PB07),
I2C_SDA(1, 4, &pin_PB09),
I2C_SDA(2, 4, &pin_PB11),
I2C_SDA(3, 4, &pin_PC09),
I2C_SDA(1, 4, &pin_PB07),
I2C_SDA(1, 4, &pin_PB09),
I2C_SDA(2, 4, &pin_PB11),
I2C_SDA(3, 4, &pin_PC09),
};
const mcu_i2c_scl_obj_t mcu_i2c_scl_list[4] = {
I2C_SCL(1, 4, &pin_PB06),
I2C_SCL(1, 4, &pin_PB08),
I2C_SCL(2, 4, &pin_PB10),
I2C_SCL(3, 4, &pin_PA08)
I2C_SCL(1, 4, &pin_PB06),
I2C_SCL(1, 4, &pin_PB08),
I2C_SCL(2, 4, &pin_PB10),
I2C_SCL(3, 4, &pin_PA08)
};
//SPI, UART, Etc

View File

@ -34,19 +34,19 @@
I2C_TypeDef * mcu_i2c_banks[3] = {I2C1, I2C2, I2C3};
const mcu_i2c_sda_obj_t mcu_i2c_sda_list[7] = {
I2C_SDA(1, 4, &pin_PB07),
I2C_SDA(1, 4, &pin_PB09),
I2C_SDA(2, 9, &pin_PB09),
I2C_SDA(2, 9, &pin_PB03),
I2C_SDA(3, 4, &pin_PC09),
I2C_SDA(3, 9, &pin_PB04),
I2C_SDA(3, 9, &pin_PB08)
I2C_SDA(1, 4, &pin_PB07),
I2C_SDA(1, 4, &pin_PB09),
I2C_SDA(2, 9, &pin_PB09),
I2C_SDA(2, 9, &pin_PB03),
I2C_SDA(3, 4, &pin_PC09),
I2C_SDA(3, 9, &pin_PB04),
I2C_SDA(3, 9, &pin_PB08)
};
const mcu_i2c_scl_obj_t mcu_i2c_scl_list[4] = {
I2C_SCL(1, 4, &pin_PB06),
I2C_SCL(1, 4, &pin_PB08),
I2C_SCL(2, 4, &pin_PB10),
I2C_SCL(3, 4, &pin_PA08)
I2C_SCL(1, 4, &pin_PB06),
I2C_SCL(1, 4, &pin_PB08),
I2C_SCL(2, 4, &pin_PB10),
I2C_SCL(3, 4, &pin_PA08)
};
//SPI, UART, Etc

View File

@ -34,20 +34,20 @@
I2C_TypeDef * mcu_i2c_banks[3] = {I2C1, I2C2, I2C3};
const mcu_i2c_sda_obj_t mcu_i2c_sda_list[8] = {
I2C_SDA(1, 4, &pin_PB07),
I2C_SDA(1, 4, &pin_PB09),
I2C_SDA(2, 4, &pin_PB11), //not on LQFP100
I2C_SDA(2, 9, &pin_PB09),
I2C_SDA(2, 9, &pin_PB03),
I2C_SDA(3, 4, &pin_PC09),
I2C_SDA(3, 9, &pin_PB04),
I2C_SDA(3, 9, &pin_PB08)
I2C_SDA(1, 4, &pin_PB07),
I2C_SDA(1, 4, &pin_PB09),
I2C_SDA(2, 4, &pin_PB11), //not on LQFP100
I2C_SDA(2, 9, &pin_PB09),
I2C_SDA(2, 9, &pin_PB03),
I2C_SDA(3, 4, &pin_PC09),
I2C_SDA(3, 9, &pin_PB04),
I2C_SDA(3, 9, &pin_PB08)
};
const mcu_i2c_scl_obj_t mcu_i2c_scl_list[4] = {
I2C_SCL(1, 4, &pin_PB06),
I2C_SCL(1, 4, &pin_PB08),
I2C_SCL(2, 4, &pin_PB10),
I2C_SCL(3, 4, &pin_PA08)
I2C_SCL(1, 4, &pin_PB06),
I2C_SCL(1, 4, &pin_PB08),
I2C_SCL(2, 4, &pin_PB10),
I2C_SCL(3, 4, &pin_PA08)
};
//SPI, UART, Etc