Merged with dev
This commit is contained in:
commit
e37ab059a3
@ -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
|
||||||
|
|||||||
@ -100,11 +100,22 @@ 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)
|
||||||
{
|
{
|
||||||
uint32_t adcChannel = 0;
|
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)
|
switch (PinNumber)
|
||||||
{
|
{
|
||||||
case PIN_A0:
|
case PIN_A0:
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user