For sensor project

This commit is contained in:
Ea-r-th
2025-11-06 02:40:54 -08:00
parent a1458de235
commit 63fab62727
8 changed files with 113 additions and 46 deletions

View File

@@ -71,6 +71,10 @@ constexpr uint8_t getGPIOPinNumber(GPIO_Key key){
return static_cast<uint8_t>(key) % 16;
}
constexpr uint8_t getGPIOPortNUmber(GPIO_Key key){
return static_cast<uint8_t>(key) / 16;
}
constexpr SHAL_GPIO_EXTI_Register getGPIOEXTICR(const GPIO_Key g){
switch(g) {
case GPIO_Key::A0: return {&SYSCFG->EXTICR[0],SYSCFG_EXTICR1_EXTI0_PA,EXTI0_IRQn};
@@ -158,6 +162,12 @@ static inline SHAL_GPIO_Output_Data_Register getGPIOOutputDataRegister(const GPI
return {reg,offset};
}
static inline SHAL_GPIO_Input_Data_Register getGPIOInputDataRegister(const GPIO_Key key){
volatile uint32_t* reg = &GPIO_TABLE[static_cast<uint8_t>(key) / 16]->IDR;
uint32_t offset = static_cast<uint8_t>(key) % 16;
return {reg,offset};
}
constexpr SHAL_GPIO_Port_Info getGPIOPortInfo(GPIO_Key key){
switch(key){
case GPIO_Key::A0: