Chip specific code.
This commit is contained in:
parent
5dbdf72472
commit
8a93a81a26
@ -443,9 +443,11 @@ STATIC void uart_clock_enable(uint16_t mask) {
|
|||||||
#endif
|
#endif
|
||||||
#ifdef USART3
|
#ifdef USART3
|
||||||
if (mask & (1 << 2)) {
|
if (mask & (1 << 2)) {
|
||||||
|
#ifndef STM32F412Cx
|
||||||
__HAL_RCC_USART3_FORCE_RESET();
|
__HAL_RCC_USART3_FORCE_RESET();
|
||||||
__HAL_RCC_USART3_RELEASE_RESET();
|
__HAL_RCC_USART3_RELEASE_RESET();
|
||||||
__HAL_RCC_USART3_CLK_ENABLE();
|
__HAL_RCC_USART3_CLK_ENABLE();
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
#ifdef UART4
|
#ifdef UART4
|
||||||
@ -516,9 +518,11 @@ STATIC void uart_clock_disable(uint16_t mask) {
|
|||||||
#endif
|
#endif
|
||||||
#ifdef USART3
|
#ifdef USART3
|
||||||
if (mask & (1 << 2)) {
|
if (mask & (1 << 2)) {
|
||||||
|
#ifndef STM32F412Cx
|
||||||
__HAL_RCC_USART3_FORCE_RESET();
|
__HAL_RCC_USART3_FORCE_RESET();
|
||||||
__HAL_RCC_USART3_RELEASE_RESET();
|
__HAL_RCC_USART3_RELEASE_RESET();
|
||||||
__HAL_RCC_USART3_CLK_DISABLE();
|
__HAL_RCC_USART3_CLK_DISABLE();
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
#ifdef UART4
|
#ifdef UART4
|
||||||
|
@ -33,9 +33,9 @@
|
|||||||
#include "stm32f4xx_hal.h"
|
#include "stm32f4xx_hal.h"
|
||||||
#include "stm32f4/pins.h"
|
#include "stm32f4/pins.h"
|
||||||
|
|
||||||
// I2C
|
// I2C
|
||||||
// TODO: these objects should be condensed into a single 'periph_pin' unless we
|
// TODO: these objects should be condensed into a single 'periph_pin' unless we
|
||||||
// find a compelling reason to store more unique data in them.
|
// find a compelling reason to store more unique data in them.
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
uint8_t i2c_index:4; // Index of the I2C unit (1 to 3)
|
uint8_t i2c_index:4; // Index of the I2C unit (1 to 3)
|
||||||
@ -44,8 +44,8 @@ typedef struct {
|
|||||||
} mcu_i2c_sda_obj_t;
|
} mcu_i2c_sda_obj_t;
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
uint8_t i2c_index:4;
|
uint8_t i2c_index:4;
|
||||||
uint8_t altfn_index:4;
|
uint8_t altfn_index:4;
|
||||||
const mcu_pin_obj_t * pin;
|
const mcu_pin_obj_t * pin;
|
||||||
} mcu_i2c_scl_obj_t;
|
} mcu_i2c_scl_obj_t;
|
||||||
|
|
||||||
@ -64,9 +64,9 @@ typedef struct {
|
|||||||
.pin = scl_pin, \
|
.pin = scl_pin, \
|
||||||
}
|
}
|
||||||
|
|
||||||
// SPI
|
// SPI
|
||||||
// TODO: these objects should be condensed into a single 'periph_pin' unless we
|
// TODO: these objects should be condensed into a single 'periph_pin' unless we
|
||||||
// find a compelling reason to store more unique data in them.
|
// find a compelling reason to store more unique data in them.
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
uint8_t spi_index:4; //Up to 6 SPI units
|
uint8_t spi_index:4; //Up to 6 SPI units
|
||||||
@ -75,20 +75,20 @@ typedef struct {
|
|||||||
} mcu_spi_sck_obj_t;
|
} mcu_spi_sck_obj_t;
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
uint8_t spi_index:4;
|
uint8_t spi_index:4;
|
||||||
uint8_t altfn_index:4;
|
uint8_t altfn_index:4;
|
||||||
const mcu_pin_obj_t * pin;
|
const mcu_pin_obj_t * pin;
|
||||||
} mcu_spi_mosi_obj_t;
|
} mcu_spi_mosi_obj_t;
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
uint8_t spi_index:4;
|
uint8_t spi_index:4;
|
||||||
uint8_t altfn_index:4;
|
uint8_t altfn_index:4;
|
||||||
const mcu_pin_obj_t * pin;
|
const mcu_pin_obj_t * pin;
|
||||||
} mcu_spi_miso_obj_t;
|
} mcu_spi_miso_obj_t;
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
uint8_t spi_index:4;
|
uint8_t spi_index:4;
|
||||||
uint8_t altfn_index:4;
|
uint8_t altfn_index:4;
|
||||||
const mcu_pin_obj_t * pin;
|
const mcu_pin_obj_t * pin;
|
||||||
} mcu_spi_nss_obj_t;
|
} mcu_spi_nss_obj_t;
|
||||||
|
|
||||||
@ -101,17 +101,17 @@ typedef struct {
|
|||||||
|
|
||||||
// UART
|
// UART
|
||||||
// TODO: these objects should be condensed into a single 'periph_pin' unless we
|
// TODO: these objects should be condensed into a single 'periph_pin' unless we
|
||||||
// find a compelling reason to store more unique data in them.
|
// find a compelling reason to store more unique data in them.
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
uint8_t uart_index:4;
|
uint8_t uart_index:4;
|
||||||
uint8_t altfn_index:4;
|
uint8_t altfn_index:4;
|
||||||
const mcu_pin_obj_t * pin;
|
const mcu_pin_obj_t * pin;
|
||||||
} mcu_uart_tx_obj_t;
|
} mcu_uart_tx_obj_t;
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
uint8_t uart_index:4;
|
uint8_t uart_index:4;
|
||||||
uint8_t altfn_index:4;
|
uint8_t altfn_index:4;
|
||||||
const mcu_pin_obj_t * pin;
|
const mcu_pin_obj_t * pin;
|
||||||
} mcu_uart_rx_obj_t;
|
} mcu_uart_rx_obj_t;
|
||||||
|
|
||||||
@ -124,8 +124,8 @@ typedef struct {
|
|||||||
|
|
||||||
//Timers
|
//Timers
|
||||||
typedef struct {
|
typedef struct {
|
||||||
uint8_t tim_index:4;
|
uint8_t tim_index:4;
|
||||||
uint8_t altfn_index:4;
|
uint8_t altfn_index:4;
|
||||||
uint8_t channel_index:4;
|
uint8_t channel_index:4;
|
||||||
const mcu_pin_obj_t * pin;
|
const mcu_pin_obj_t * pin;
|
||||||
} mcu_tim_pin_obj_t;
|
} mcu_tim_pin_obj_t;
|
||||||
@ -154,6 +154,13 @@ typedef struct {
|
|||||||
#include "stm32f411xe/periph.h"
|
#include "stm32f411xe/periph.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef BOARD_THUNDERPACK_STM32F412
|
||||||
|
#define HAS_DAC 0
|
||||||
|
#define HAS_TRNG 1
|
||||||
|
#define HAS_BASIC_TIM 1
|
||||||
|
#include "stm32f412cx_thunderpack/periph.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef STM32F412Zx
|
#ifdef STM32F412Zx
|
||||||
#define HAS_DAC 0
|
#define HAS_DAC 0
|
||||||
#define HAS_TRNG 1
|
#define HAS_TRNG 1
|
||||||
|
@ -31,56 +31,133 @@
|
|||||||
|
|
||||||
// I2C
|
// I2C
|
||||||
|
|
||||||
I2C_TypeDef * mcu_i2c_banks[3] = {I2C1, NULL, NULL};
|
I2C_TypeDef * mcu_i2c_banks[3] = {I2C1, I2C2, I2C3};
|
||||||
|
|
||||||
const mcu_i2c_sda_obj_t mcu_i2c_sda_list[8] = {
|
const mcu_i2c_sda_obj_t mcu_i2c_sda_list[8] = {
|
||||||
I2C_SDA(1, 4, &pin_PB07),
|
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] = {
|
const mcu_i2c_scl_obj_t mcu_i2c_scl_list[4] = {
|
||||||
I2C_SCL(1, 4, &pin_PB06),
|
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
|
// SPI
|
||||||
|
|
||||||
SPI_TypeDef * mcu_spi_banks[5] = {SPI1, NULL, NULL, NULL, NULL};
|
SPI_TypeDef * mcu_spi_banks[5] = {SPI1, SPI2, SPI3, SPI4, SPI5};
|
||||||
|
|
||||||
const mcu_spi_sck_obj_t mcu_spi_sck_list[15] = {
|
const mcu_spi_sck_obj_t mcu_spi_sck_list[15] = {
|
||||||
SPI(1, 5, &pin_PA05),
|
SPI(1, 5, &pin_PA05),
|
||||||
|
SPI(1, 5, &pin_PB03),
|
||||||
|
SPI(2, 5, &pin_PB10),
|
||||||
|
SPI(2, 5, &pin_PB13),
|
||||||
|
SPI(2, 5, &pin_PC07),
|
||||||
|
SPI(2, 5, &pin_PD03),
|
||||||
|
SPI(3, 6, &pin_PB03),
|
||||||
|
SPI(3, 7, &pin_PB12),
|
||||||
|
SPI(3, 6, &pin_PC10),
|
||||||
|
SPI(4, 6, &pin_PB13),
|
||||||
|
SPI(4, 5, &pin_PE02),
|
||||||
|
SPI(4, 5, &pin_PE12),
|
||||||
|
SPI(5, 6, &pin_PB00),
|
||||||
|
SPI(5, 6, &pin_PE02),
|
||||||
|
SPI(5, 6, &pin_PE12)
|
||||||
};
|
};
|
||||||
|
|
||||||
const mcu_spi_mosi_obj_t mcu_spi_mosi_list[14] = {
|
const mcu_spi_mosi_obj_t mcu_spi_mosi_list[14] = {
|
||||||
SPI(1, 5, &pin_PA07),
|
SPI(1, 5, &pin_PA07),
|
||||||
SPI(1, 5, &pin_PB05),
|
SPI(1, 5, &pin_PB05),
|
||||||
|
SPI(2, 5, &pin_PB15),
|
||||||
|
SPI(2, 5, &pin_PC03),
|
||||||
|
SPI(3, 6, &pin_PB05),
|
||||||
|
SPI(3, 6, &pin_PC12),
|
||||||
|
SPI(3, 5, &pin_PD06),
|
||||||
|
SPI(4, 5, &pin_PA01),
|
||||||
|
SPI(4, 5, &pin_PE06),
|
||||||
|
SPI(4, 5, &pin_PE14),
|
||||||
|
SPI(5, 6, &pin_PA10),
|
||||||
|
SPI(5, 6, &pin_PB08),
|
||||||
|
SPI(5, 6, &pin_PE06),
|
||||||
|
SPI(5, 6, &pin_PE14)
|
||||||
};
|
};
|
||||||
|
|
||||||
const mcu_spi_miso_obj_t mcu_spi_miso_list[12] = {
|
const mcu_spi_miso_obj_t mcu_spi_miso_list[12] = {
|
||||||
SPI(1, 5, &pin_PA06),
|
SPI(1, 5, &pin_PA06),
|
||||||
|
SPI(1, 5, &pin_PB04),
|
||||||
|
SPI(2, 5, &pin_PB14),
|
||||||
|
SPI(2, 5, &pin_PC02),
|
||||||
|
SPI(3, 6, &pin_PB04),
|
||||||
|
SPI(3, 6, &pin_PC11),
|
||||||
|
SPI(4, 6, &pin_PA11),
|
||||||
|
SPI(4, 5, &pin_PE05),
|
||||||
|
SPI(4, 5, &pin_PE13),
|
||||||
|
SPI(5, 6, &pin_PA12),
|
||||||
|
SPI(5, 6, &pin_PE05),
|
||||||
|
SPI(5, 6, &pin_PE13)
|
||||||
};
|
};
|
||||||
|
|
||||||
const mcu_spi_nss_obj_t mcu_spi_nss_list[12] = {
|
const mcu_spi_nss_obj_t mcu_spi_nss_list[12] = {
|
||||||
SPI(1, 5, &pin_PA04),
|
SPI(1, 5, &pin_PA04),
|
||||||
|
SPI(1, 5, &pin_PA15),
|
||||||
|
SPI(2, 5, &pin_PB09),
|
||||||
|
SPI(2, 5, &pin_PB12),
|
||||||
|
SPI(3, 6, &pin_PA04),
|
||||||
|
SPI(3, 6, &pin_PA15),
|
||||||
|
SPI(4, 6, &pin_PB12),
|
||||||
|
SPI(4, 5, &pin_PE04),
|
||||||
|
SPI(4, 5, &pin_PE11),
|
||||||
|
SPI(5, 6, &pin_PB01),
|
||||||
|
SPI(5, 6, &pin_PE04),
|
||||||
|
SPI(5, 6, &pin_PE11)
|
||||||
};
|
};
|
||||||
|
|
||||||
//UART
|
//UART
|
||||||
|
|
||||||
USART_TypeDef * mcu_uart_banks[MAX_UART] = {USART1, NULL, NULL, NULL, NULL, NULL};
|
USART_TypeDef * mcu_uart_banks[MAX_UART] = {USART1, USART2, USART3, NULL, NULL, USART6};
|
||||||
bool mcu_uart_has_usart[MAX_UART] = {true, false, false, false, false, false};
|
bool mcu_uart_has_usart[MAX_UART] = {true, true, true, false, false, true};
|
||||||
|
|
||||||
const mcu_uart_tx_obj_t mcu_uart_tx_list[11] = {
|
const mcu_uart_tx_obj_t mcu_uart_tx_list[11] = {
|
||||||
|
UART(2, 7, &pin_PA02),
|
||||||
UART(1, 7, &pin_PA09),
|
UART(1, 7, &pin_PA09),
|
||||||
|
UART(1, 7, &pin_PA15),
|
||||||
|
UART(6, 8, &pin_PA11),
|
||||||
UART(1, 7, &pin_PB06),
|
UART(1, 7, &pin_PB06),
|
||||||
|
UART(3, 7, &pin_PB10),
|
||||||
|
UART(6, 8, &pin_PC06),
|
||||||
|
UART(3, 7, &pin_PC10),
|
||||||
|
UART(2, 7, &pin_PD05),
|
||||||
|
UART(3, 7, &pin_PD08),
|
||||||
|
UART(6, 8, &pin_PG14),
|
||||||
};
|
};
|
||||||
|
|
||||||
const mcu_uart_rx_obj_t mcu_uart_rx_list[12] = {
|
const mcu_uart_rx_obj_t mcu_uart_rx_list[12] = {
|
||||||
|
UART(2, 7, &pin_PA03),
|
||||||
UART(1, 7, &pin_PA10),
|
UART(1, 7, &pin_PA10),
|
||||||
|
UART(6, 8, &pin_PA12),
|
||||||
|
UART(1, 7, &pin_PB03),
|
||||||
UART(1, 7, &pin_PB07),
|
UART(1, 7, &pin_PB07),
|
||||||
|
UART(3, 7, &pin_PB11),
|
||||||
|
UART(3, 7, &pin_PC05),
|
||||||
|
UART(6, 8, &pin_PC07),
|
||||||
|
UART(3, 7, &pin_PC11),
|
||||||
|
UART(2, 7, &pin_PD06),
|
||||||
|
UART(3, 7, &pin_PD09),
|
||||||
|
UART(6, 8, &pin_PG09),
|
||||||
};
|
};
|
||||||
|
|
||||||
//Timers
|
//Timers
|
||||||
//TIM6 and TIM7 are basic timers that are only used by DAC, and don't have pins
|
//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, NULL, TIM9, NULL,
|
TIM_TypeDef * mcu_tim_banks[14] = {TIM1, TIM2, TIM3, TIM4, TIM5, NULL, NULL, TIM8, TIM9, TIM10,
|
||||||
NULL, NULL, TIM13, TIM14};
|
TIM11, TIM12, TIM13, TIM14};
|
||||||
|
|
||||||
const mcu_tim_pin_obj_t mcu_tim_pin_list[60] = {
|
const mcu_tim_pin_obj_t mcu_tim_pin_list[60] = {
|
||||||
TIM(2,1,1,&pin_PA00),
|
TIM(2,1,1,&pin_PA00),
|
||||||
@ -101,7 +178,46 @@ const mcu_tim_pin_obj_t mcu_tim_pin_list[60] = {
|
|||||||
TIM(1,1,2,&pin_PA09),
|
TIM(1,1,2,&pin_PA09),
|
||||||
TIM(1,1,3,&pin_PA10),
|
TIM(1,1,3,&pin_PA10),
|
||||||
TIM(1,1,4,&pin_PA11),
|
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(3,2,2,&pin_PB05),
|
||||||
TIM(4,2,1,&pin_PB06),
|
TIM(4,2,1,&pin_PB06),
|
||||||
TIM(4,2,2,&pin_PB07),
|
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(5,2,1,&pin_PF03),
|
||||||
|
TIM(5,2,2,&pin_PF04),
|
||||||
|
TIM(5,2,3,&pin_PF05),
|
||||||
|
TIM(5,2,4,&pin_PF10),
|
||||||
};
|
};
|
||||||
|
@ -38,17 +38,17 @@ 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_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_PC15 = PIN(2, 15, NO_ADC); //OSC32_OUT
|
||||||
|
|
||||||
const mcu_pin_obj_t pin_PF00 = PIN(5, 0, NO_ADC); // 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_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_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_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_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_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_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_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_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_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_PF10 = PIN(5, 10, NO_ADC); // 144 only
|
||||||
|
|
||||||
const mcu_pin_obj_t pin_PC00 = PIN(2, 0, ADC_INPUT(ADC_1,10));
|
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_PC01 = PIN(2, 1, ADC_INPUT(ADC_1,11));
|
||||||
@ -71,14 +71,14 @@ 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_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_PB02 = PIN(1, 2, NO_ADC);
|
||||||
|
|
||||||
const mcu_pin_obj_t pin_PF11 = PIN(5, 11, NO_ADC); // 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_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_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_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_PF15 = PIN(5, 15, NO_ADC); // 144 only
|
||||||
|
|
||||||
const mcu_pin_obj_t pin_PG00 = PIN(6, 0, NO_ADC); // 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_PG01 = PIN(6, 1, NO_ADC); // 144 only
|
||||||
|
|
||||||
const mcu_pin_obj_t pin_PE07 = PIN(4, 7, NO_ADC);
|
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_PE08 = PIN(4, 8, NO_ADC);
|
||||||
|
@ -38,17 +38,17 @@ extern const mcu_pin_obj_t pin_PC13;
|
|||||||
extern const mcu_pin_obj_t pin_PC14;
|
extern const mcu_pin_obj_t pin_PC14;
|
||||||
//pg 51
|
//pg 51
|
||||||
extern const mcu_pin_obj_t pin_PC15;
|
extern const mcu_pin_obj_t pin_PC15;
|
||||||
extern const mcu_pin_obj_t pin_PF00; // 144 only
|
extern const mcu_pin_obj_t pin_PF00; // 144 only
|
||||||
extern const mcu_pin_obj_t pin_PF01; // 144 only
|
extern const mcu_pin_obj_t pin_PF01; // 144 only
|
||||||
extern const mcu_pin_obj_t pin_PF02; // 144 only
|
extern const mcu_pin_obj_t pin_PF02; // 144 only
|
||||||
extern const mcu_pin_obj_t pin_PF03; // 144 only
|
extern const mcu_pin_obj_t pin_PF03; // 144 only
|
||||||
extern const mcu_pin_obj_t pin_PF04; // 144 only
|
extern const mcu_pin_obj_t pin_PF04; // 144 only
|
||||||
extern const mcu_pin_obj_t pin_PF05; // 144 only
|
extern const mcu_pin_obj_t pin_PF05; // 144 only
|
||||||
extern const mcu_pin_obj_t pin_PF06; // 144 only
|
extern const mcu_pin_obj_t pin_PF06; // 144 only
|
||||||
extern const mcu_pin_obj_t pin_PF07; // 144 only
|
extern const mcu_pin_obj_t pin_PF07; // 144 only
|
||||||
extern const mcu_pin_obj_t pin_PF08; // 144 only
|
extern const mcu_pin_obj_t pin_PF08; // 144 only
|
||||||
extern const mcu_pin_obj_t pin_PF09; // 144 only
|
extern const mcu_pin_obj_t pin_PF09; // 144 only
|
||||||
extern const mcu_pin_obj_t pin_PF10; // 144 only
|
extern const mcu_pin_obj_t pin_PF10; // 144 only
|
||||||
//pg 52
|
//pg 52
|
||||||
extern const mcu_pin_obj_t pin_PC00;
|
extern const mcu_pin_obj_t pin_PC00;
|
||||||
extern const mcu_pin_obj_t pin_PC01;
|
extern const mcu_pin_obj_t pin_PC01;
|
||||||
@ -69,13 +69,13 @@ extern const mcu_pin_obj_t pin_PC05;
|
|||||||
extern const mcu_pin_obj_t pin_PB00;
|
extern const mcu_pin_obj_t pin_PB00;
|
||||||
extern const mcu_pin_obj_t pin_PB01;
|
extern const mcu_pin_obj_t pin_PB01;
|
||||||
extern const mcu_pin_obj_t pin_PB02;
|
extern const mcu_pin_obj_t pin_PB02;
|
||||||
extern const mcu_pin_obj_t pin_PF11; // 144 only
|
extern const mcu_pin_obj_t pin_PF11; // 144 only
|
||||||
extern const mcu_pin_obj_t pin_PF12; // 144 only
|
extern const mcu_pin_obj_t pin_PF12; // 144 only
|
||||||
extern const mcu_pin_obj_t pin_PF13; // 144 only
|
extern const mcu_pin_obj_t pin_PF13; // 144 only
|
||||||
extern const mcu_pin_obj_t pin_PF14; // 144 only
|
extern const mcu_pin_obj_t pin_PF14; // 144 only
|
||||||
extern const mcu_pin_obj_t pin_PF15; // 144 only
|
extern const mcu_pin_obj_t pin_PF15; // 144 only
|
||||||
extern const mcu_pin_obj_t pin_PG00; // 144 only
|
extern const mcu_pin_obj_t pin_PG00; // 144 only
|
||||||
extern const mcu_pin_obj_t pin_PG01; // 144 only
|
extern const mcu_pin_obj_t pin_PG01; // 144 only
|
||||||
//pg 55
|
//pg 55
|
||||||
extern const mcu_pin_obj_t pin_PE07;
|
extern const mcu_pin_obj_t pin_PE07;
|
||||||
extern const mcu_pin_obj_t pin_PE08;
|
extern const mcu_pin_obj_t pin_PE08;
|
||||||
|
@ -59,13 +59,13 @@ STATIC void init_usb_vbus_sense(void) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void init_usb_hardware(void) {
|
void init_usb_hardware(void) {
|
||||||
//TODO: if future chips overload this with options, move to peripherals management.
|
//TODO: if future chips overload this with options, move to peripherals management.
|
||||||
|
|
||||||
GPIO_InitTypeDef GPIO_InitStruct = {0};
|
GPIO_InitTypeDef GPIO_InitStruct = {0};
|
||||||
/**USB_OTG_FS GPIO Configuration
|
/**USB_OTG_FS GPIO Configuration
|
||||||
PA10 ------> USB_OTG_FS_ID
|
PA10 ------> USB_OTG_FS_ID
|
||||||
PA11 ------> USB_OTG_FS_DM
|
PA11 ------> USB_OTG_FS_DM
|
||||||
PA12 ------> USB_OTG_FS_DP
|
PA12 ------> USB_OTG_FS_DP
|
||||||
*/
|
*/
|
||||||
__HAL_RCC_GPIOA_CLK_ENABLE();
|
__HAL_RCC_GPIOA_CLK_ENABLE();
|
||||||
|
|
||||||
@ -80,11 +80,13 @@ void init_usb_hardware(void) {
|
|||||||
never_reset_pin_number(0, 12);
|
never_reset_pin_number(0, 12);
|
||||||
|
|
||||||
/* Configure VBUS Pin */
|
/* Configure VBUS Pin */
|
||||||
|
#if (BOARD_NO_VBUS_SENSE)
|
||||||
GPIO_InitStruct.Pin = GPIO_PIN_9;
|
GPIO_InitStruct.Pin = GPIO_PIN_9;
|
||||||
GPIO_InitStruct.Mode = GPIO_MODE_INPUT;
|
GPIO_InitStruct.Mode = GPIO_MODE_INPUT;
|
||||||
GPIO_InitStruct.Pull = GPIO_NOPULL;
|
GPIO_InitStruct.Pull = GPIO_NOPULL;
|
||||||
HAL_GPIO_Init(GPIOA, &GPIO_InitStruct);
|
HAL_GPIO_Init(GPIOA, &GPIO_InitStruct);
|
||||||
never_reset_pin_number(0, 9);
|
never_reset_pin_number(0, 9);
|
||||||
|
#endif
|
||||||
|
|
||||||
/* This for ID line debug */
|
/* This for ID line debug */
|
||||||
GPIO_InitStruct.Pin = GPIO_PIN_10;
|
GPIO_InitStruct.Pin = GPIO_PIN_10;
|
||||||
@ -103,7 +105,7 @@ void init_usb_hardware(void) {
|
|||||||
HAL_GPIO_Init(GPIOG, &GPIO_InitStruct);
|
HAL_GPIO_Init(GPIOG, &GPIO_InitStruct);
|
||||||
never_reset_pin_number(0, 8);
|
never_reset_pin_number(0, 8);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Peripheral clock enable */
|
/* Peripheral clock enable */
|
||||||
__HAL_RCC_USB_OTG_FS_CLK_DISABLE();
|
__HAL_RCC_USB_OTG_FS_CLK_DISABLE();
|
||||||
__HAL_RCC_USB_OTG_FS_CLK_ENABLE();
|
__HAL_RCC_USB_OTG_FS_CLK_ENABLE();
|
||||||
|
Loading…
Reference in New Issue
Block a user