Merge branch 'stm32-pin-remap' into stm32-peripherals

This commit is contained in:
Hierophect 2019-09-12 14:27:24 -04:00
commit 1fda6d4a48
7 changed files with 252 additions and 235 deletions

View File

@ -2,7 +2,7 @@ USB_VID = 0x239A
USB_PID = 0x802A
USB_PRODUCT = "STM32F411VE Discovery Board - CPy"
USB_MANUFACTURER = "STMicroelectronics"
USB_CDC_AND_MSC_ONLY = 1
USB_DEVICES = "CDC,MSC"
INTERNAL_FLASH_FILESYSTEM = 1
LONGINT_IMPL = NONE

View File

@ -33,7 +33,7 @@
void common_hal_digitalio_digitalinout_never_reset(
digitalio_digitalinout_obj_t *self) {
never_reset_pin_number(self->pin->port_number, self->pin->number);
never_reset_pin_number(self->pin->port, self->pin->number);
}
digitalinout_result_t common_hal_digitalio_digitalinout_construct(
@ -43,11 +43,11 @@ digitalinout_result_t common_hal_digitalio_digitalinout_construct(
self->pin = pin;
GPIO_InitTypeDef GPIO_InitStruct = {0};
GPIO_InitStruct.Pin = (1 << pin->number);
GPIO_InitStruct.Pin = pin_mask(self->pin->number);
GPIO_InitStruct.Mode = GPIO_MODE_INPUT;
GPIO_InitStruct.Pull = GPIO_NOPULL;
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;
HAL_GPIO_Init(pin->port, &GPIO_InitStruct);
HAL_GPIO_Init(pin_port(self->pin->number), &GPIO_InitStruct);
return DIGITALINOUT_OK;
}
@ -61,7 +61,7 @@ void common_hal_digitalio_digitalinout_deinit(digitalio_digitalinout_obj_t *self
return;
}
reset_pin_number(self->pin->port_number, self->pin->number);
reset_pin_number(self->pin->port, self->pin->number);
self->pin = mp_const_none;
}
@ -69,11 +69,11 @@ void common_hal_digitalio_digitalinout_switch_to_input(
digitalio_digitalinout_obj_t *self, digitalio_pull_t pull) {
GPIO_InitTypeDef GPIO_InitStruct = {0};
GPIO_InitStruct.Pin = (1 << self->pin->number);
GPIO_InitStruct.Pin = pin_mask(self->pin->number);
GPIO_InitStruct.Mode = GPIO_MODE_INPUT;
GPIO_InitStruct.Pull = GPIO_NOPULL;
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;
HAL_GPIO_Init(self->pin->port, &GPIO_InitStruct);
HAL_GPIO_Init(pin_port(self->pin->number), &GPIO_InitStruct);
common_hal_digitalio_digitalinout_set_pull(self, pull);
}
@ -89,38 +89,38 @@ void common_hal_digitalio_digitalinout_switch_to_output(
digitalio_direction_t common_hal_digitalio_digitalinout_get_direction(
digitalio_digitalinout_obj_t *self) {
return (LL_GPIO_GetPinMode(self->pin->port, (1 << self->pin->number))
return (LL_GPIO_GetPinMode(pin_port(self->pin->number), pin_mask(self->pin->number))
== LL_GPIO_MODE_INPUT) ? DIRECTION_INPUT : DIRECTION_OUTPUT;
}
void common_hal_digitalio_digitalinout_set_value(
digitalio_digitalinout_obj_t *self, bool value) {
HAL_GPIO_WritePin(self->pin->port, 1 << self->pin->number, value);
HAL_GPIO_WritePin(pin_port(self->pin->number), pin_mask(self->pin->number), value);
}
bool common_hal_digitalio_digitalinout_get_value(
digitalio_digitalinout_obj_t *self) {
return (LL_GPIO_GetPinMode(self->pin->port, (1 << self->pin->number)) == LL_GPIO_MODE_INPUT)
? HAL_GPIO_ReadPin(self->pin->port, (1 << self->pin->number))
: LL_GPIO_IsOutputPinSet(self->pin->port, (1 << self->pin->number));
return (LL_GPIO_GetPinMode(pin_port(self->pin->number), pin_mask(self->pin->number)) == LL_GPIO_MODE_INPUT)
? HAL_GPIO_ReadPin(pin_port(self->pin->number), pin_mask(self->pin->number))
: LL_GPIO_IsOutputPinSet(pin_port(self->pin->number), pin_mask(self->pin->number));
}
void common_hal_digitalio_digitalinout_set_drive_mode(
digitalio_digitalinout_obj_t *self,
digitalio_drive_mode_t drive_mode) {
GPIO_InitTypeDef GPIO_InitStruct = {0};
GPIO_InitStruct.Pin = (1 << self->pin->number);
GPIO_InitStruct.Pin = pin_mask(self->pin->number);
GPIO_InitStruct.Mode = (drive_mode == DRIVE_MODE_OPEN_DRAIN ?
GPIO_MODE_OUTPUT_OD : GPIO_MODE_OUTPUT_PP);
GPIO_InitStruct.Pull = GPIO_NOPULL;
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;
HAL_GPIO_Init(self->pin->port, &GPIO_InitStruct);
HAL_GPIO_Init(pin_port(self->pin->number), &GPIO_InitStruct);
}
digitalio_drive_mode_t common_hal_digitalio_digitalinout_get_drive_mode(
digitalio_digitalinout_obj_t *self) {
return LL_GPIO_GetPinOutputType(self->pin->port, (1 << self->pin->port_number))
return LL_GPIO_GetPinOutputType(pin_port(self->pin->number), pin_mask(self->pin->number))
== LL_GPIO_OUTPUT_OPENDRAIN ? DRIVE_MODE_OPEN_DRAIN : DRIVE_MODE_PUSH_PULL;
}
@ -129,13 +129,13 @@ void common_hal_digitalio_digitalinout_set_pull(
switch (pull) {
case PULL_UP:
LL_GPIO_SetPinPull(self->pin->port,(1 << self->pin->number),LL_GPIO_PULL_UP);
LL_GPIO_SetPinPull(pin_port(self->pin->number), pin_mask(self->pin->number),LL_GPIO_PULL_UP);
break;
case PULL_DOWN:
LL_GPIO_SetPinPull(self->pin->port,(1 << self->pin->number),LL_GPIO_PULL_DOWN);
LL_GPIO_SetPinPull(pin_port(self->pin->number), pin_mask(self->pin->number),LL_GPIO_PULL_DOWN);
break;
case PULL_NONE:
LL_GPIO_SetPinPull(self->pin->port,(1 << self->pin->number),LL_GPIO_PULL_NO);
LL_GPIO_SetPinPull(pin_port(self->pin->number), pin_mask(self->pin->number),LL_GPIO_PULL_NO);
break;
default:
break;
@ -146,7 +146,7 @@ digitalio_pull_t common_hal_digitalio_digitalinout_get_pull(
digitalio_digitalinout_obj_t *self) {
switch (LL_GPIO_GetPinPull(self->pin->port,(1 << self->pin->number))) {
switch (LL_GPIO_GetPinPull(pin_port(self->pin->number), pin_mask(self->pin->number))) {
case LL_GPIO_PULL_UP:
return PULL_UP;
case LL_GPIO_PULL_DOWN:

View File

@ -54,33 +54,38 @@ void reset_all_pins(void) {
// Mark pin as free and return it to a quiescent state.
void reset_pin_number(uint8_t pin_port, uint8_t pin_number) {
if (pin_number == NO_PIN) {
if (pin_port == 0x0F) {
return;
}
// Clear claimed bit.
claimed_pins[pin_port] &= ~(1 << pin_number);
claimed_pins[pin_port] &= ~(1<<pin_number);
// Reset the pin
HAL_GPIO_DeInit(ports[pin_port], (1 << pin_number));
HAL_GPIO_DeInit(ports[pin_port], 1<<pin_number);
}
void never_reset_pin_number(uint8_t pin_port, uint8_t pin_number) {
never_reset_pins[pin_port] |= 1 << pin_number;
never_reset_pins[pin_port] |= 1<<pin_number;
}
void claim_pin(const mcu_pin_obj_t* pin) {
// Set bit in claimed_pins bitmask.
claimed_pins[pin->port_number] |= 1 << pin->number;
claimed_pins[pin->port] |= 1<<pin->number;
}
bool pin_number_is_free(uint8_t pin_port, uint8_t pin_number) {
return !(claimed_pins[pin_port] & (1 << pin_number));
return !(claimed_pins[pin_port] & 1<<pin_number);
}
bool common_hal_mcu_pin_is_free(const mcu_pin_obj_t *pin) {
return pin_number_is_free(pin->port_number, pin->number);
return pin_number_is_free(pin->port, pin->number);
}
GPIO_TypeDef * pin_port(uint8_t pin_port) {
return ports[pin_port];
}
uint16_t pin_mask(uint8_t pin_number) {
return 1<<pin_number;
}

View File

@ -34,9 +34,11 @@
void reset_all_pins(void);
// reset_pin_number takes the pin number instead of the pointer so that objects don't
// need to store a full pointer.
void reset_pin_number(uint8_t pin_port, uint8_t pin);
void reset_pin_number(uint8_t pin_port, uint8_t pin_number);
void claim_pin(const mcu_pin_obj_t* pin);
bool pin_number_is_free(uint8_t pin_port, uint8_t pin_number);
void never_reset_pin_number(uint8_t pin_port, uint8_t pin_number);
GPIO_TypeDef * pin_port(uint8_t pin_port);
uint16_t pin_mask(uint8_t pin_number);
#endif // MICROPY_INCLUDED_STM34F4_COMMON_HAL_MICROCONTROLLER_PIN_H

View File

@ -38,28 +38,38 @@
typedef struct {
mp_obj_base_t base;
//uint8_t number; //(3)port,(5)pin
uint8_t port_number;
GPIO_TypeDef * port;
uint8_t number;
uint8_t port:4;
uint8_t number:4;
uint8_t adc_unit:3;
uint8_t adc_channel:5;
} mcu_pin_obj_t;
// extern GPIO_TypeDef *port_lookup_table[];
#define ADC_1 1
#define ADC_123 7
#define ADC_12 3
#define ADC_3 4
// static inline GPIO_TypeDef * get_GPIO_ptr(const mcu_pin_obj_t *p)
// {
// return port_lookup_table[0x7&( (p->number) >> 5)];
// }
//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,
#define NO_ADC \
.adc_unit = 0x00, \
.adc_channel = 0x1f
extern const mp_obj_type_t mcu_pin_type;
// Used in device-specific pins.c
#define PIN(p_port_num, p_port, p_number) \
// STM32 can have up to 9 ports, each restricted to 16 pins
// We split the pin/port evenly, in contrast to nrf.
#define PIN(p_port, p_number, p_adc) \
{ \
{ &mcu_pin_type }, \
.port_number = (p_port_num), \
.port = (p_port), \
.number = (p_number), \
.port = p_port, \
.number = p_number, \
p_adc \
}
// Use illegal pin value to mark unassigned pins.

View File

@ -28,96 +28,96 @@
#include "py/mphal.h"
#include "stm32f4/pins.h"
const mcu_pin_obj_t pin_PE02 = PIN(4, GPIOE, 2);
const mcu_pin_obj_t pin_PE03 = PIN(4, GPIOE, 3);
const mcu_pin_obj_t pin_PE04 = PIN(4, GPIOE, 4);
const mcu_pin_obj_t pin_PE05 = PIN(4, GPIOE, 5);
const mcu_pin_obj_t pin_PE06 = PIN(4, GPIOE, 6);
const mcu_pin_obj_t pin_PE02 = PIN(4, 2, NO_ADC);
const mcu_pin_obj_t pin_PE03 = PIN(4, 3, NO_ADC);
const mcu_pin_obj_t pin_PE04 = PIN(4, 4, NO_ADC);
const mcu_pin_obj_t pin_PE05 = PIN(4, 5, NO_ADC);
const mcu_pin_obj_t pin_PE06 = PIN(4, 6, NO_ADC);
const mcu_pin_obj_t pin_PC13 = PIN(2, GPIOC, 13); //anti-tamp
const mcu_pin_obj_t pin_PC14 = PIN(2, GPIOC, 14); //OSC32_IN
const mcu_pin_obj_t pin_PC15 = PIN(2, GPIOC, 15); //OSC32_OUT
const mcu_pin_obj_t pin_PC13 = PIN(2, 13, NO_ADC); //anti-tamp
const mcu_pin_obj_t pin_PC14 = PIN(2, 14, NO_ADC); //OSC32_IN
const mcu_pin_obj_t pin_PC15 = PIN(2, 15, NO_ADC); //OSC32_OUT
const mcu_pin_obj_t pin_PC00 = PIN(2, GPIOC, 0);
const mcu_pin_obj_t pin_PC01 = PIN(2, GPIOC, 1);
const mcu_pin_obj_t pin_PC02 = PIN(2, GPIOC, 2);
const mcu_pin_obj_t pin_PC03 = PIN(2, GPIOC, 3);
const mcu_pin_obj_t pin_PC00 = PIN(2, 0, ADC_INPUT(ADC_1,10));
const mcu_pin_obj_t pin_PC01 = PIN(2, 1, ADC_INPUT(ADC_1,11));
const mcu_pin_obj_t pin_PC02 = PIN(2, 2, ADC_INPUT(ADC_1,12));
const mcu_pin_obj_t pin_PC03 = PIN(2, 3, ADC_INPUT(ADC_1,13));
const mcu_pin_obj_t pin_PA00 = PIN(0, GPIOA, 0);
const mcu_pin_obj_t pin_PA01 = PIN(0, GPIOA, 1);
const mcu_pin_obj_t pin_PA02 = PIN(0, GPIOA, 2);
const mcu_pin_obj_t pin_PA03 = PIN(0, GPIOA, 3);
const mcu_pin_obj_t pin_PA04 = PIN(0, GPIOA, 4);
const mcu_pin_obj_t pin_PA05 = PIN(0, GPIOA, 5);
const mcu_pin_obj_t pin_PA06 = PIN(0, GPIOA, 6);
const mcu_pin_obj_t pin_PA07 = PIN(0, GPIOA, 7);
const mcu_pin_obj_t pin_PA00 = PIN(0, 0, ADC_INPUT(ADC_1,0));
const mcu_pin_obj_t pin_PA01 = PIN(0, 1, ADC_INPUT(ADC_1,1));
const mcu_pin_obj_t pin_PA02 = PIN(0, 2, ADC_INPUT(ADC_1,2));
const mcu_pin_obj_t pin_PA03 = PIN(0, 3, ADC_INPUT(ADC_1,3));
const mcu_pin_obj_t pin_PA04 = PIN(0, 4, ADC_INPUT(ADC_1,4));
const mcu_pin_obj_t pin_PA05 = PIN(0, 5, ADC_INPUT(ADC_1,5));
const mcu_pin_obj_t pin_PA06 = PIN(0, 6, ADC_INPUT(ADC_1,6));
const mcu_pin_obj_t pin_PA07 = PIN(0, 7, ADC_INPUT(ADC_1,7));
const mcu_pin_obj_t pin_PC04 = PIN(2, GPIOC, 4);
const mcu_pin_obj_t pin_PC05 = PIN(2, GPIOC, 5);
const mcu_pin_obj_t pin_PC04 = PIN(2, 4, ADC_INPUT(ADC_1,14));
const mcu_pin_obj_t pin_PC05 = PIN(2, 5, ADC_INPUT(ADC_1,15));
const mcu_pin_obj_t pin_PB00 = PIN(1, GPIOB, 0);
const mcu_pin_obj_t pin_PB01 = PIN(1, GPIOB, 1);
const mcu_pin_obj_t pin_PB02 = PIN(1, GPIOB, 2);
const mcu_pin_obj_t pin_PB00 = PIN(1, 0, ADC_INPUT(ADC_1,8));
const mcu_pin_obj_t pin_PB01 = PIN(1, 1, ADC_INPUT(ADC_1,9));
const mcu_pin_obj_t pin_PB02 = PIN(1, 2, NO_ADC);
const mcu_pin_obj_t pin_PE07 = PIN(4, GPIOE, 7);
const mcu_pin_obj_t pin_PE08 = PIN(4, GPIOE, 8);
const mcu_pin_obj_t pin_PE09 = PIN(4, GPIOE, 9);
const mcu_pin_obj_t pin_PE10 = PIN(4, GPIOE, 10);
const mcu_pin_obj_t pin_PE11 = PIN(4, GPIOE, 11);
const mcu_pin_obj_t pin_PE12 = PIN(4, GPIOE, 12);
const mcu_pin_obj_t pin_PE13 = PIN(4, GPIOE, 13);
const mcu_pin_obj_t pin_PE14 = PIN(4, GPIOE, 14);
const mcu_pin_obj_t pin_PE15 = PIN(4, GPIOE, 15);
const mcu_pin_obj_t pin_PE07 = PIN(4, 7, NO_ADC);
const mcu_pin_obj_t pin_PE08 = PIN(4, 8, NO_ADC);
const mcu_pin_obj_t pin_PE09 = PIN(4, 9, NO_ADC);
const mcu_pin_obj_t pin_PE10 = PIN(4, 10, NO_ADC);
const mcu_pin_obj_t pin_PE11 = PIN(4, 11, NO_ADC);
const mcu_pin_obj_t pin_PE12 = PIN(4, 12, NO_ADC);
const mcu_pin_obj_t pin_PE13 = PIN(4, 13, NO_ADC);
const mcu_pin_obj_t pin_PE14 = PIN(4, 14, NO_ADC);
const mcu_pin_obj_t pin_PE15 = PIN(4, 15, NO_ADC);
const mcu_pin_obj_t pin_PB10 = PIN(1, GPIOB, 10);
const mcu_pin_obj_t pin_PB12 = PIN(1, GPIOB, 12);
const mcu_pin_obj_t pin_PB13 = PIN(1, GPIOB, 13);
const mcu_pin_obj_t pin_PB14 = PIN(1, GPIOB, 14);
const mcu_pin_obj_t pin_PB15 = PIN(1, GPIOB, 15);
const mcu_pin_obj_t pin_PB10 = PIN(1, 10, NO_ADC);
const mcu_pin_obj_t pin_PB12 = PIN(1, 12, NO_ADC);
const mcu_pin_obj_t pin_PB13 = PIN(1, 13, NO_ADC);
const mcu_pin_obj_t pin_PB14 = PIN(1, 14, NO_ADC);
const mcu_pin_obj_t pin_PB15 = PIN(1, 15, NO_ADC);
const mcu_pin_obj_t pin_PD08 = PIN(3, GPIOD, 8);
const mcu_pin_obj_t pin_PD09 = PIN(3, GPIOD, 9);
const mcu_pin_obj_t pin_PD10 = PIN(3, GPIOD, 10);
const mcu_pin_obj_t pin_PD11 = PIN(3, GPIOD, 11);
const mcu_pin_obj_t pin_PD12 = PIN(3, GPIOD, 12);
const mcu_pin_obj_t pin_PD13 = PIN(3, GPIOD, 13);
const mcu_pin_obj_t pin_PD14 = PIN(3, GPIOD, 14);
const mcu_pin_obj_t pin_PD15 = PIN(3, GPIOD, 15);
const mcu_pin_obj_t pin_PD08 = PIN(3, 8, NO_ADC);
const mcu_pin_obj_t pin_PD09 = PIN(3, 9, NO_ADC);
const mcu_pin_obj_t pin_PD10 = PIN(3, 10, NO_ADC);
const mcu_pin_obj_t pin_PD11 = PIN(3, 11, NO_ADC);
const mcu_pin_obj_t pin_PD12 = PIN(3, 12, NO_ADC);
const mcu_pin_obj_t pin_PD13 = PIN(3, 13, NO_ADC);
const mcu_pin_obj_t pin_PD14 = PIN(3, 14, NO_ADC);
const mcu_pin_obj_t pin_PD15 = PIN(3, 15, NO_ADC);
const mcu_pin_obj_t pin_PC06 = PIN(2, GPIOC, 6);
const mcu_pin_obj_t pin_PC07 = PIN(2, GPIOC, 7);
const mcu_pin_obj_t pin_PC08 = PIN(2, GPIOC, 8);
const mcu_pin_obj_t pin_PC09 = PIN(2, GPIOC, 9);
const mcu_pin_obj_t pin_PC06 = PIN(2, 6, NO_ADC);
const mcu_pin_obj_t pin_PC07 = PIN(2, 7, NO_ADC);
const mcu_pin_obj_t pin_PC08 = PIN(2, 8, NO_ADC);
const mcu_pin_obj_t pin_PC09 = PIN(2, 9, NO_ADC);
const mcu_pin_obj_t pin_PA08 = PIN(0, GPIOA, 8);
const mcu_pin_obj_t pin_PA09 = PIN(0, GPIOA, 9);
const mcu_pin_obj_t pin_PA10 = PIN(0, GPIOA, 10);
const mcu_pin_obj_t pin_PA11 = PIN(0, GPIOA, 11);
const mcu_pin_obj_t pin_PA12 = PIN(0, GPIOA, 12);
const mcu_pin_obj_t pin_PA13 = PIN(0, GPIOA, 13);
const mcu_pin_obj_t pin_PA14 = PIN(0, GPIOA, 14);
const mcu_pin_obj_t pin_PA15 = PIN(0, GPIOA, 15);
const mcu_pin_obj_t pin_PA08 = PIN(0, 8, NO_ADC);
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_PC10 = PIN(2, GPIOC, 10);
const mcu_pin_obj_t pin_PC11 = PIN(2, GPIOC, 11);
const mcu_pin_obj_t pin_PC12 = PIN(2, GPIOC, 12);
const mcu_pin_obj_t pin_PC10 = PIN(2, 10, NO_ADC);
const mcu_pin_obj_t pin_PC11 = PIN(2, 11, NO_ADC);
const mcu_pin_obj_t pin_PC12 = PIN(2, 12, NO_ADC);
const mcu_pin_obj_t pin_PD00 = PIN(3, GPIOD, 0);
const mcu_pin_obj_t pin_PD01 = PIN(3, GPIOD, 1);
const mcu_pin_obj_t pin_PD02 = PIN(3, GPIOD, 2);
const mcu_pin_obj_t pin_PD03 = PIN(3, GPIOD, 3);
const mcu_pin_obj_t pin_PD04 = PIN(3, GPIOD, 4);
const mcu_pin_obj_t pin_PD05 = PIN(3, GPIOD, 5);
const mcu_pin_obj_t pin_PD06 = PIN(3, GPIOD, 6);
const mcu_pin_obj_t pin_PD07 = PIN(3, GPIOD, 7);
const mcu_pin_obj_t pin_PD00 = PIN(3, 0, NO_ADC);
const mcu_pin_obj_t pin_PD01 = PIN(3, 1, NO_ADC);
const mcu_pin_obj_t pin_PD02 = PIN(3, 2, NO_ADC);
const mcu_pin_obj_t pin_PD03 = PIN(3, 3, NO_ADC);
const mcu_pin_obj_t pin_PD04 = PIN(3, 4, NO_ADC);
const mcu_pin_obj_t pin_PD05 = PIN(3, 5, NO_ADC);
const mcu_pin_obj_t pin_PD06 = PIN(3, 6, NO_ADC);
const mcu_pin_obj_t pin_PD07 = PIN(3, 7, NO_ADC);
const mcu_pin_obj_t pin_PB03 = PIN(1, GPIOB, 3);
const mcu_pin_obj_t pin_PB04 = PIN(1, GPIOB, 4);
const mcu_pin_obj_t pin_PB05 = PIN(1, GPIOB, 5);
const mcu_pin_obj_t pin_PB06 = PIN(1, GPIOB, 6);
const mcu_pin_obj_t pin_PB07 = PIN(1, GPIOB, 7);
const mcu_pin_obj_t pin_PB08 = PIN(1, GPIOB, 8);
const mcu_pin_obj_t pin_PB09 = PIN(1, GPIOB, 9);
const mcu_pin_obj_t pin_PB03 = PIN(1, 3, NO_ADC);
const mcu_pin_obj_t pin_PB04 = PIN(1, 4, NO_ADC);
const mcu_pin_obj_t pin_PB05 = PIN(1, 5, NO_ADC);
const mcu_pin_obj_t pin_PB06 = PIN(1, 6, NO_ADC);
const mcu_pin_obj_t pin_PB07 = PIN(1, 7, NO_ADC);
const mcu_pin_obj_t pin_PB08 = PIN(1, 8, NO_ADC);
const mcu_pin_obj_t pin_PB09 = PIN(1, 9, NO_ADC);
const mcu_pin_obj_t pin_PE00 = PIN(4, GPIOE, 0);
const mcu_pin_obj_t pin_PE01 = PIN(4, GPIOE, 1);
const mcu_pin_obj_t pin_PE00 = PIN(4, 0, NO_ADC);
const mcu_pin_obj_t pin_PE01 = PIN(4, 1, NO_ADC);

View File

@ -28,134 +28,134 @@
#include "py/mphal.h"
#include "stm32f4/pins.h"
const mcu_pin_obj_t pin_PE02 = PIN(4, GPIOE, 2);
const mcu_pin_obj_t pin_PE03 = PIN(4, GPIOE, 3);
const mcu_pin_obj_t pin_PE04 = PIN(4, GPIOE, 4);
const mcu_pin_obj_t pin_PE05 = PIN(4, GPIOE, 5);
const mcu_pin_obj_t pin_PE06 = PIN(4, GPIOE, 6);
const mcu_pin_obj_t pin_PE02 = PIN(4, 2, NO_ADC);
const mcu_pin_obj_t pin_PE03 = PIN(4, 3, NO_ADC);
const mcu_pin_obj_t pin_PE04 = PIN(4, 4, NO_ADC);
const mcu_pin_obj_t pin_PE05 = PIN(4, 5, NO_ADC);
const mcu_pin_obj_t pin_PE06 = PIN(4, 6, NO_ADC);
const mcu_pin_obj_t pin_PC13 = PIN(2, GPIOC, 13);
const mcu_pin_obj_t pin_PC14 = PIN(2, GPIOC, 14); //OSC32_IN
const mcu_pin_obj_t pin_PC15 = PIN(2, GPIOC, 15); //OSC32_OUT
const mcu_pin_obj_t pin_PC13 = PIN(2, 13, NO_ADC); //anti-tamp
const mcu_pin_obj_t pin_PC14 = PIN(2, 14, NO_ADC); //OSC32_IN
const mcu_pin_obj_t pin_PC15 = PIN(2, 15, NO_ADC); //OSC32_OUT
const mcu_pin_obj_t pin_PF00 = PIN(5, GPIOF, 0); // 144 only
const mcu_pin_obj_t pin_PF01 = PIN(5, GPIOF, 1); // 144 only
const mcu_pin_obj_t pin_PF02 = PIN(5, GPIOF, 2); // 144 only
const mcu_pin_obj_t pin_PF03 = PIN(5, GPIOF, 3); // 144 only
const mcu_pin_obj_t pin_PF04 = PIN(5, GPIOF, 4); // 144 only
const mcu_pin_obj_t pin_PF05 = PIN(5, GPIOF, 5); // 144 only
const mcu_pin_obj_t pin_PF06 = PIN(5, GPIOF, 6); // 144 only
const mcu_pin_obj_t pin_PF07 = PIN(5, GPIOF, 7); // 144 only
const mcu_pin_obj_t pin_PF08 = PIN(5, GPIOF, 8); // 144 only
const mcu_pin_obj_t pin_PF09 = PIN(5, GPIOF, 9); // 144 only
const mcu_pin_obj_t pin_PF10 = PIN(5, GPIOF, 10); // 144 only
const mcu_pin_obj_t pin_PF00 = PIN(5, 0, NO_ADC); // 144 only
const mcu_pin_obj_t pin_PF01 = PIN(5, 1, NO_ADC); // 144 only
const mcu_pin_obj_t pin_PF02 = PIN(5, 2, NO_ADC); // 144 only
const mcu_pin_obj_t pin_PF03 = PIN(5, 3, NO_ADC); // 144 only
const mcu_pin_obj_t pin_PF04 = PIN(5, 4, NO_ADC); // 144 only
const mcu_pin_obj_t pin_PF05 = PIN(5, 5, NO_ADC); // 144 only
const mcu_pin_obj_t pin_PF06 = PIN(5, 6, NO_ADC); // 144 only
const mcu_pin_obj_t pin_PF07 = PIN(5, 7, NO_ADC); // 144 only
const mcu_pin_obj_t pin_PF08 = PIN(5, 8, NO_ADC); // 144 only
const mcu_pin_obj_t pin_PF09 = PIN(5, 9, NO_ADC); // 144 only
const mcu_pin_obj_t pin_PF10 = PIN(5, 10, NO_ADC); // 144 only
const mcu_pin_obj_t pin_PC00 = PIN(2, GPIOC, 0);
const mcu_pin_obj_t pin_PC01 = PIN(2, GPIOC, 1);
const mcu_pin_obj_t pin_PC02 = PIN(2, GPIOC, 2);
const mcu_pin_obj_t pin_PC03 = PIN(2, GPIOC, 3);
const mcu_pin_obj_t pin_PC00 = PIN(2, 0, ADC_INPUT(ADC_1,10));
const mcu_pin_obj_t pin_PC01 = PIN(2, 1, ADC_INPUT(ADC_1,11));
const mcu_pin_obj_t pin_PC02 = PIN(2, 2, ADC_INPUT(ADC_1,12));
const mcu_pin_obj_t pin_PC03 = PIN(2, 3, ADC_INPUT(ADC_1,13));
const mcu_pin_obj_t pin_PA00 = PIN(0, GPIOA, 0);
const mcu_pin_obj_t pin_PA01 = PIN(0, GPIOA, 1);
const mcu_pin_obj_t pin_PA02 = PIN(0, GPIOA, 2);
const mcu_pin_obj_t pin_PA03 = PIN(0, GPIOA, 3);
const mcu_pin_obj_t pin_PA04 = PIN(0, GPIOA, 4);
const mcu_pin_obj_t pin_PA05 = PIN(0, GPIOA, 5);
const mcu_pin_obj_t pin_PA06 = PIN(0, GPIOA, 6);
const mcu_pin_obj_t pin_PA07 = PIN(0, GPIOA, 7);
const mcu_pin_obj_t pin_PA00 = PIN(0, 0, ADC_INPUT(ADC_1,0));
const mcu_pin_obj_t pin_PA01 = PIN(0, 1, ADC_INPUT(ADC_1,1));
const mcu_pin_obj_t pin_PA02 = PIN(0, 2, ADC_INPUT(ADC_1,2));
const mcu_pin_obj_t pin_PA03 = PIN(0, 3, ADC_INPUT(ADC_1,3));
const mcu_pin_obj_t pin_PA04 = PIN(0, 4, ADC_INPUT(ADC_1,4));
const mcu_pin_obj_t pin_PA05 = PIN(0, 5, ADC_INPUT(ADC_1,5));
const mcu_pin_obj_t pin_PA06 = PIN(0, 6, ADC_INPUT(ADC_1,6));
const mcu_pin_obj_t pin_PA07 = PIN(0, 7, ADC_INPUT(ADC_1,7));
const mcu_pin_obj_t pin_PC04 = PIN(2, GPIOC, 4);
const mcu_pin_obj_t pin_PC05 = PIN(2, GPIOC, 5);
const mcu_pin_obj_t pin_PC04 = PIN(2, 4, ADC_INPUT(ADC_1,14));
const mcu_pin_obj_t pin_PC05 = PIN(2, 5, ADC_INPUT(ADC_1,15));
const mcu_pin_obj_t pin_PB00 = PIN(1, GPIOB, 0);
const mcu_pin_obj_t pin_PB01 = PIN(1, GPIOB, 1);
const mcu_pin_obj_t pin_PB02 = PIN(1, GPIOB, 2);
const mcu_pin_obj_t pin_PB00 = PIN(1, 0, ADC_INPUT(ADC_1,8));
const mcu_pin_obj_t pin_PB01 = PIN(1, 1, ADC_INPUT(ADC_1,9));
const mcu_pin_obj_t pin_PB02 = PIN(1, 2, NO_ADC);
const mcu_pin_obj_t pin_PF11 = PIN(5, GPIOF, 11); // 144 only
const mcu_pin_obj_t pin_PF12 = PIN(5, GPIOF, 12); // 144 only
const mcu_pin_obj_t pin_PF13 = PIN(5, GPIOF, 13); // 144 only
const mcu_pin_obj_t pin_PF14 = PIN(5, GPIOF, 14); // 144 only
const mcu_pin_obj_t pin_PF15 = PIN(5, GPIOF, 15); // 144 only
const mcu_pin_obj_t pin_PF11 = PIN(5, 11, NO_ADC); // 144 only
const mcu_pin_obj_t pin_PF12 = PIN(5, 12, NO_ADC); // 144 only
const mcu_pin_obj_t pin_PF13 = PIN(5, 13, NO_ADC); // 144 only
const mcu_pin_obj_t pin_PF14 = PIN(5, 14, NO_ADC); // 144 only
const mcu_pin_obj_t pin_PF15 = PIN(5, 15, NO_ADC); // 144 only
const mcu_pin_obj_t pin_PG00 = PIN(6, GPIOG, 0); // 144 only
const mcu_pin_obj_t pin_PG01 = PIN(6, GPIOG, 1); // 144 only
const mcu_pin_obj_t pin_PG00 = PIN(6, 0, NO_ADC); // 144 only
const mcu_pin_obj_t pin_PG01 = PIN(6, 1, NO_ADC); // 144 only
const mcu_pin_obj_t pin_PE07 = PIN(4, GPIOE, 7);
const mcu_pin_obj_t pin_PE08 = PIN(4, GPIOE, 8);
const mcu_pin_obj_t pin_PE09 = PIN(4, GPIOE, 9);
const mcu_pin_obj_t pin_PE10 = PIN(4, GPIOE, 10);
const mcu_pin_obj_t pin_PE11 = PIN(4, GPIOE, 11);
const mcu_pin_obj_t pin_PE12 = PIN(4, GPIOE, 12);
const mcu_pin_obj_t pin_PE13 = PIN(4, GPIOE, 13);
const mcu_pin_obj_t pin_PE14 = PIN(4, GPIOE, 14);
const mcu_pin_obj_t pin_PE15 = PIN(4, GPIOE, 15);
const mcu_pin_obj_t pin_PE07 = PIN(4, 7, NO_ADC);
const mcu_pin_obj_t pin_PE08 = PIN(4, 8, NO_ADC);
const mcu_pin_obj_t pin_PE09 = PIN(4, 9, NO_ADC);
const mcu_pin_obj_t pin_PE10 = PIN(4, 10, NO_ADC);
const mcu_pin_obj_t pin_PE11 = PIN(4, 11, NO_ADC);
const mcu_pin_obj_t pin_PE12 = PIN(4, 12, NO_ADC);
const mcu_pin_obj_t pin_PE13 = PIN(4, 13, NO_ADC);
const mcu_pin_obj_t pin_PE14 = PIN(4, 14, NO_ADC);
const mcu_pin_obj_t pin_PE15 = PIN(4, 15, NO_ADC);
const mcu_pin_obj_t pin_PB10 = PIN(1, GPIOB, 10);
const mcu_pin_obj_t pin_PB12 = PIN(1, GPIOB, 12);
const mcu_pin_obj_t pin_PB11 = PIN(1, GPIOB, 11); // 144 only
const mcu_pin_obj_t pin_PB13 = PIN(1, GPIOB, 13);
const mcu_pin_obj_t pin_PB14 = PIN(1, GPIOB, 14);
const mcu_pin_obj_t pin_PB15 = PIN(1, GPIOB, 15);
const mcu_pin_obj_t pin_PB10 = PIN(1, 10, NO_ADC);
const mcu_pin_obj_t pin_PB11 = PIN(1, 11, NO_ADC); // 144 only
const mcu_pin_obj_t pin_PB12 = PIN(1, 12, NO_ADC);
const mcu_pin_obj_t pin_PB13 = PIN(1, 13, NO_ADC);
const mcu_pin_obj_t pin_PB14 = PIN(1, 14, NO_ADC);
const mcu_pin_obj_t pin_PB15 = PIN(1, 15, NO_ADC);
const mcu_pin_obj_t pin_PD08 = PIN(3, GPIOD, 8);
const mcu_pin_obj_t pin_PD09 = PIN(3, GPIOD, 9);
const mcu_pin_obj_t pin_PD10 = PIN(3, GPIOD, 10);
const mcu_pin_obj_t pin_PD11 = PIN(3, GPIOD, 11);
const mcu_pin_obj_t pin_PD12 = PIN(3, GPIOD, 12);
const mcu_pin_obj_t pin_PD13 = PIN(3, GPIOD, 13);
const mcu_pin_obj_t pin_PD14 = PIN(3, GPIOD, 14);
const mcu_pin_obj_t pin_PD15 = PIN(3, GPIOD, 15);
const mcu_pin_obj_t pin_PD08 = PIN(3, 8, NO_ADC);
const mcu_pin_obj_t pin_PD09 = PIN(3, 9, NO_ADC);
const mcu_pin_obj_t pin_PD10 = PIN(3, 10, NO_ADC);
const mcu_pin_obj_t pin_PD11 = PIN(3, 11, NO_ADC);
const mcu_pin_obj_t pin_PD12 = PIN(3, 12, NO_ADC);
const mcu_pin_obj_t pin_PD13 = PIN(3, 13, NO_ADC);
const mcu_pin_obj_t pin_PD14 = PIN(3, 14, NO_ADC);
const mcu_pin_obj_t pin_PD15 = PIN(3, 15, NO_ADC);
const mcu_pin_obj_t pin_PG02 = PIN(6, GPIOG, 2); // 144 only
const mcu_pin_obj_t pin_PG03 = PIN(6, GPIOG, 3); // 144 only
const mcu_pin_obj_t pin_PG04 = PIN(6, GPIOG, 4); // 144 only
const mcu_pin_obj_t pin_PG05 = PIN(6, GPIOG, 5); // 144 only
const mcu_pin_obj_t pin_PG06 = PIN(6, GPIOG, 6); // 144 only
const mcu_pin_obj_t pin_PG07 = PIN(6, GPIOG, 7); // 144 only
const mcu_pin_obj_t pin_PG08 = PIN(6, GPIOG, 8); // 144 only
const mcu_pin_obj_t pin_PG02 = PIN(6, 2, NO_ADC); // 144 only
const mcu_pin_obj_t pin_PG03 = PIN(6, 3, NO_ADC); // 144 only
const mcu_pin_obj_t pin_PG04 = PIN(6, 4, NO_ADC); // 144 only
const mcu_pin_obj_t pin_PG05 = PIN(6, 5, NO_ADC); // 144 only
const mcu_pin_obj_t pin_PG06 = PIN(6, 6, NO_ADC); // 144 only
const mcu_pin_obj_t pin_PG07 = PIN(6, 7, NO_ADC); // 144 only
const mcu_pin_obj_t pin_PG08 = PIN(6, 8, NO_ADC); // 144 only
const mcu_pin_obj_t pin_PC06 = PIN(2, GPIOC, 6);
const mcu_pin_obj_t pin_PC07 = PIN(2, GPIOC, 7);
const mcu_pin_obj_t pin_PC08 = PIN(2, GPIOC, 8);
const mcu_pin_obj_t pin_PC09 = PIN(2, GPIOC, 9);
const mcu_pin_obj_t pin_PC06 = PIN(2, 6, NO_ADC);
const mcu_pin_obj_t pin_PC07 = PIN(2, 7, NO_ADC);
const mcu_pin_obj_t pin_PC08 = PIN(2, 8, NO_ADC);
const mcu_pin_obj_t pin_PC09 = PIN(2, 9, NO_ADC);
const mcu_pin_obj_t pin_PA08 = PIN(0, GPIOA, 8);
const mcu_pin_obj_t pin_PA09 = PIN(0, GPIOA, 9);
const mcu_pin_obj_t pin_PA10 = PIN(0, GPIOA, 10);
const mcu_pin_obj_t pin_PA11 = PIN(0, GPIOA, 11);
const mcu_pin_obj_t pin_PA12 = PIN(0, GPIOA, 12);
const mcu_pin_obj_t pin_PA13 = PIN(0, GPIOA, 13);
const mcu_pin_obj_t pin_PA14 = PIN(0, GPIOA, 14);
const mcu_pin_obj_t pin_PA15 = PIN(0, GPIOA, 15);
const mcu_pin_obj_t pin_PA08 = PIN(0, 8, NO_ADC);
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_PC10 = PIN(2, GPIOC, 10);
const mcu_pin_obj_t pin_PC11 = PIN(2, GPIOC, 11);
const mcu_pin_obj_t pin_PC12 = PIN(2, GPIOC, 12);
const mcu_pin_obj_t pin_PC10 = PIN(2, 10, NO_ADC);
const mcu_pin_obj_t pin_PC11 = PIN(2, 11, NO_ADC);
const mcu_pin_obj_t pin_PC12 = PIN(2, 12, NO_ADC);
const mcu_pin_obj_t pin_PD00 = PIN(3, GPIOD, 0);
const mcu_pin_obj_t pin_PD01 = PIN(3, GPIOD, 1);
const mcu_pin_obj_t pin_PD02 = PIN(3, GPIOD, 2);
const mcu_pin_obj_t pin_PD03 = PIN(3, GPIOD, 3);
const mcu_pin_obj_t pin_PD04 = PIN(3, GPIOD, 4);
const mcu_pin_obj_t pin_PD05 = PIN(3, GPIOD, 5);
const mcu_pin_obj_t pin_PD06 = PIN(3, GPIOD, 6);
const mcu_pin_obj_t pin_PD07 = PIN(3, GPIOD, 7);
const mcu_pin_obj_t pin_PD00 = PIN(3, 0, NO_ADC);
const mcu_pin_obj_t pin_PD01 = PIN(3, 1, NO_ADC);
const mcu_pin_obj_t pin_PD02 = PIN(3, 2, NO_ADC);
const mcu_pin_obj_t pin_PD03 = PIN(3, 3, NO_ADC);
const mcu_pin_obj_t pin_PD04 = PIN(3, 4, NO_ADC);
const mcu_pin_obj_t pin_PD05 = PIN(3, 5, NO_ADC);
const mcu_pin_obj_t pin_PD06 = PIN(3, 6, NO_ADC);
const mcu_pin_obj_t pin_PD07 = PIN(3, 7, NO_ADC);
const mcu_pin_obj_t pin_PG09 = PIN(6, GPIOG, 9); // 144 only
const mcu_pin_obj_t pin_PG10 = PIN(6, GPIOG, 10); // 144 only
const mcu_pin_obj_t pin_PG11 = PIN(6, GPIOG, 11); // 144 only
const mcu_pin_obj_t pin_PG12 = PIN(6, GPIOG, 12); // 144 only
const mcu_pin_obj_t pin_PG13 = PIN(6, GPIOG, 13); // 144 only
const mcu_pin_obj_t pin_PG14 = PIN(6, GPIOG, 14); // 144 only
const mcu_pin_obj_t pin_PG15 = PIN(6, GPIOG, 15); // 144 only
const mcu_pin_obj_t pin_PG09 = PIN(6, 9, NO_ADC); // 144 only
const mcu_pin_obj_t pin_PG10 = PIN(6, 10, NO_ADC); // 144 only
const mcu_pin_obj_t pin_PG11 = PIN(6, 11, NO_ADC); // 144 only
const mcu_pin_obj_t pin_PG12 = PIN(6, 12, NO_ADC); // 144 only
const mcu_pin_obj_t pin_PG13 = PIN(6, 13, NO_ADC); // 144 only
const mcu_pin_obj_t pin_PG14 = PIN(6, 14, NO_ADC); // 144 only
const mcu_pin_obj_t pin_PG15 = PIN(6, 15, NO_ADC); // 144 only
const mcu_pin_obj_t pin_PB03 = PIN(1, GPIOB, 3);
const mcu_pin_obj_t pin_PB04 = PIN(1, GPIOB, 4);
const mcu_pin_obj_t pin_PB05 = PIN(1, GPIOB, 5);
const mcu_pin_obj_t pin_PB06 = PIN(1, GPIOB, 6);
const mcu_pin_obj_t pin_PB07 = PIN(1, GPIOB, 7);
const mcu_pin_obj_t pin_PB08 = PIN(1, GPIOB, 8);
const mcu_pin_obj_t pin_PB09 = PIN(1, GPIOB, 9);
const mcu_pin_obj_t pin_PB03 = PIN(1, 3, NO_ADC);
const mcu_pin_obj_t pin_PB04 = PIN(1, 4, NO_ADC);
const mcu_pin_obj_t pin_PB05 = PIN(1, 5, NO_ADC);
const mcu_pin_obj_t pin_PB06 = PIN(1, 6, NO_ADC);
const mcu_pin_obj_t pin_PB07 = PIN(1, 7, NO_ADC);
const mcu_pin_obj_t pin_PB08 = PIN(1, 8, NO_ADC);
const mcu_pin_obj_t pin_PB09 = PIN(1, 9, NO_ADC);
const mcu_pin_obj_t pin_PE00 = PIN(4, GPIOE, 0);
const mcu_pin_obj_t pin_PE01 = PIN(4, GPIOE, 1);
const mcu_pin_obj_t pin_PE00 = PIN(4, 0, NO_ADC);
const mcu_pin_obj_t pin_PE01 = PIN(4, 1, NO_ADC);