|
|
|
@ -20,6 +20,27 @@
|
|
|
|
|
#define PUPDR_PULL_DOWN 0x2UL
|
|
|
|
|
|
|
|
|
|
// https://accu.org/journals/overload/13/68/goodliffe_281/
|
|
|
|
|
|
|
|
|
|
#define LQFP32 // TODO : If that makes sens it will be implmendet on the Cmake.
|
|
|
|
|
|
|
|
|
|
// How can we check the assert for each port ?
|
|
|
|
|
#ifdef LQFP32
|
|
|
|
|
|
|
|
|
|
#define PORT_A_PIN_COUNT 15
|
|
|
|
|
#define PORT_B_PIN_COUNT 8
|
|
|
|
|
#define PORT_C_PIN_COUNT 0
|
|
|
|
|
#define PORT_F_PIN_COUNT 2
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 0b1111 1111 Means all the piuns are present it's to de bale to make an & comprison
|
|
|
|
|
#define PORT_A_PIN_MISSING_MSK 0xFF
|
|
|
|
|
#define PORT_B_PIN_MISSING_MSK 0xFB
|
|
|
|
|
#define PORT_C_PIN_MISSING_MSK 0x00
|
|
|
|
|
#define PORT_F_PIN_MISSING_MSK 0xFC
|
|
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
enum GPIO_Port {
|
|
|
|
|
Port_A_base_address = GPIOA_BASE, // 0x4800'0000
|
|
|
|
|
Port_B_base_address = GPIOB_BASE, // 0x4800'0400
|
|
|
|
@ -28,23 +49,31 @@ enum GPIO_Port {
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
enum Pin_no{
|
|
|
|
|
pin_0,
|
|
|
|
|
pin_1,
|
|
|
|
|
pin_2,
|
|
|
|
|
pin_3,
|
|
|
|
|
pin_4,
|
|
|
|
|
pin_5,
|
|
|
|
|
pin_6,
|
|
|
|
|
pin_7
|
|
|
|
|
pin_0,
|
|
|
|
|
pin_1,
|
|
|
|
|
pin_2,
|
|
|
|
|
pin_3,
|
|
|
|
|
pin_4,
|
|
|
|
|
pin_5,
|
|
|
|
|
pin_6,
|
|
|
|
|
pin_8,
|
|
|
|
|
pin_9,
|
|
|
|
|
pin_10,
|
|
|
|
|
pin_11,
|
|
|
|
|
pin_12,
|
|
|
|
|
pin_13,
|
|
|
|
|
pin_14,
|
|
|
|
|
pin_15
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
template <uint8_t pin_no, GPIO_Port port_base_address>
|
|
|
|
|
|
|
|
|
|
template <Pin_no pin_no, GPIO_Port port_base_address>
|
|
|
|
|
class STM_Pin : Pin
|
|
|
|
|
{
|
|
|
|
|
public:
|
|
|
|
|
|
|
|
|
|
STM_Pin() {
|
|
|
|
|
static_assert(pin_no < 7, "GPIO has only 8 ports!");
|
|
|
|
|
static_assert(pin_no < PORT_A_PIN_COUNT, "GPIO has only 14 ports!");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void setMode(mode mode) override
|
|
|
|
|