added a function that returns a link to the STATE address of the GPIO register

This commit is contained in:
Ogneyar 2024-08-23 10:37:54 +03:00
parent 33e85b4f00
commit 63116429c9
2 changed files with 9 additions and 1 deletions

View File

@ -60,10 +60,12 @@ static const uint8_t A5 = PIN_A5;
GPIO_TypeDef* digitalPinToPort(uint32_t digPinNumber); GPIO_TypeDef* digitalPinToPort(uint32_t digPinNumber);
// determines the pin address inside the port by the board pin number // determines the pin address inside the port by the board pin number
HAL_PinsTypeDef digitalPinToBitMask(uint32_t digPinNumber); HAL_PinsTypeDef digitalPinToBitMask(uint32_t digPinNumber);
// оtotal number of pins available for initialization // total number of pins available for initialization
uint16_t pinCommonQty(void); uint16_t pinCommonQty(void);
// the function returns a reference to the OUTPUT address of the GPIO register // the function returns a reference to the OUTPUT address of the GPIO register
uint32_t* portOutputRegister(GPIO_TypeDef* GPIO_x); uint32_t* portOutputRegister(GPIO_TypeDef* GPIO_x);
// the function returns a reference to the STATE address of the GPIO register
uint32_t* portInputRegister(GPIO_TypeDef* GPIO_x);
// ADC // ADC
// determines the ADC channel number by the board pin number // determines the ADC channel number by the board pin number

View File

@ -100,6 +100,12 @@ uint32_t* portOutputRegister(GPIO_TypeDef* GPIO_x)
return &GPIO_x->OUTPUT_; return &GPIO_x->OUTPUT_;
} }
// the function returns a reference to the STATE address of the GPIO register
uint32_t* portInputRegister(GPIO_TypeDef* GPIO_x)
{
return &GPIO_x->STATE;
}
// ---------------------- АЦП ---------------------- // // ---------------------- АЦП ---------------------- //
// determines the ADC channel number by the board pin number // determines the ADC channel number by the board pin number
uint32_t analogInputToChannelNumber(uint32_t PinNumber) uint32_t analogInputToChannelNumber(uint32_t PinNumber)