Merged with dev

This commit is contained in:
Огънеяръ Яковлев 2024-08-23 16:00:00 +03:00
commit e37ab059a3
2 changed files with 14 additions and 1 deletions

View File

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

View File

@ -100,11 +100,22 @@ uint32_t* portOutputRegister(GPIO_TypeDef* GPIO_x)
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
uint32_t analogInputToChannelNumber(uint32_t PinNumber)
{
uint32_t adcChannel = 0;
// if passed a value from 0 - 5, instead of A0 - A5
if (PinNumber < 4) PinNumber += 14;
else if (PinNumber < 6) PinNumber += 16;
switch (PinNumber)
{
case PIN_A0: