Add f405 pindefs

This commit is contained in:
Hierophect 2019-10-24 18:00:50 -04:00
parent 7f769580bd
commit cf7efee0d3
3 changed files with 92 additions and 2 deletions

View File

@ -33,7 +33,7 @@
#include "supervisor/shared/translate.h"
#include "stm32f4xx_hal.h"
#define PWM_MAX_FREQ 1000000
#define PWM_MAX_FREQ 6000000
// Get the frequency (in Hz) of the source clock for the given timer.
// On STM32F405/407/415/417 there are 2 cases for how the clock freq is set.

View File

@ -99,6 +99,22 @@ typedef struct {
.pin = spi_pin, \
}
//Timers
typedef struct {
uint8_t tim_index:4;
uint8_t altfn_index:4;
uint8_t tim_channel:4;
const mcu_pin_obj_t * pin;
} mcu_tim_pin_obj_t;
#define TIM(index, alt, channel, tim_pin) \
{ \
.tim_index = index, \
.altfn_index = alt, \
.tim_channel = channel, \
.pin = tim_pin, \
}
//Starter Lines
#ifdef STM32F411xE

View File

@ -85,4 +85,78 @@ const mcu_spi_nss_obj_t mcu_spi_nss_list[6] = {
SPI(3, 6, &pin_PA04),
SPI(3, 6, &pin_PA15),
};
//UART, Etc
//Timers
//TIM6 and TIM7 are basic timers that are only used by DAC, and don't have pins
TIM_TypeDef * mcu_tim_banks[14] = {TIM1, TIM2, TIM3, TIM4, TIM5, NULL, NULL, TIM8, TIM9, TIM10,
TIM11, TIM12, TIM13, TIM14};
const mcu_tim_pin_obj_t mcu_tim_pin_list[66] = {
TIM(2,1,1,&pin_PA00),
TIM(5,2,1,&pin_PA00),
TIM(2,1,2,&pin_PA01),
TIM(5,2,2,&pin_PA01),
TIM(2,1,3,&pin_PA02),
TIM(5,2,3,&pin_PA02),
TIM(2,1,4,&pin_PA03),
TIM(5,2,4,&pin_PA03),
TIM(9,3,1,&pin_PA02),
TIM(9,3,2,&pin_PA03),
TIM(3,2,1,&pin_PA06),
TIM(13,9,1,&pin_PA06),
TIM(3,2,2,&pin_PA07),
TIM(14,9,1,&pin_PA07),
TIM(1,1,1,&pin_PA08),
TIM(1,1,2,&pin_PA09),
TIM(1,1,3,&pin_PA10),
TIM(1,1,4,&pin_PA11),
TIM(2,1,1,&pin_PA15),
TIM(3,2,3,&pin_PB00),
TIM(3,2,4,&pin_PB01),
TIM(2,1,2,&pin_PB03),
TIM(3,2,1,&pin_PB04),
TIM(3,2,2,&pin_PB05),
TIM(4,2,1,&pin_PB06),
TIM(4,2,2,&pin_PB07),
TIM(4,2,3,&pin_PB08),
TIM(10,2,1,&pin_PB08),
TIM(4,2,4,&pin_PB09),
TIM(11,2,1,&pin_PB09),
TIM(2,1,3,&pin_PB10),
TIM(2,1,4,&pin_PB11),
TIM(12,9,1,&pin_PB14),
TIM(12,9,2,&pin_PB15),
TIM(3,2,1,&pin_PC06),
TIM(3,2,2,&pin_PC07),
TIM(3,2,3,&pin_PC08),
TIM(3,2,4,&pin_PC09),
TIM(8,3,1,&pin_PC06),
TIM(8,3,2,&pin_PC07),
TIM(8,3,3,&pin_PC08),
TIM(8,3,4,&pin_PC09),
TIM(4,2,1,&pin_PD12),
TIM(4,2,2,&pin_PD13),
TIM(4,2,3,&pin_PD14),
TIM(4,2,4,&pin_PD15),
TIM(9,3,1,&pin_PE05),
TIM(9,3,2,&pin_PE06),
TIM(1,1,1,&pin_PE09),
TIM(1,1,2,&pin_PE11),
TIM(1,1,3,&pin_PE13),
TIM(1,1,4,&pin_PE14),
TIM(10,3,1,&pin_PF06),
TIM(11,3,1,&pin_PF07),
TIM(13,9,1,&pin_PF08),
TIM(14,9,1,&pin_PF09),
TIM(12,9,1,&pin_PH06),
TIM(12,9,2,&pin_PH09),
TIM(5,2,1,&pin_PH10),
TIM(5,2,2,&pin_PH11),
TIM(5,2,3,&pin_PH12),
TIM(5,2,4,&pin_PI00),
TIM(8,3,4,&pin_PI02),
TIM(8,3,1,&pin_PI05),
TIM(8,3,2,&pin_PI06),
TIM(8,3,3,&pin_PI07),
};