|
TM STM32Fxxx HAL Libraries
v1.0.0
Libraries for STM32Fxxx (F0, F4 and F7 series) devices based on HAL drivers from ST from Tilen Majerle
|
GPIO Functions. More...
Macros | |
| #define | TM_GPIO_SetPinLow(GPIOx, GPIO_Pin) ((GPIOx)->BSRR = (uint32_t)(((uint32_t)GPIO_Pin) << 16)) |
| Sets pin(s) low. More... | |
| #define | TM_GPIO_SetPinHigh(GPIOx, GPIO_Pin) ((GPIOx)->BSRR = (uint32_t)(GPIO_Pin)) |
| Sets pin(s) high. More... | |
| #define | TM_GPIO_SetPinValue(GPIOx, GPIO_Pin, val) ((val) ? TM_GPIO_SetPinHigh(GPIOx, GPIO_Pin) : TM_GPIO_SetPinLow(GPIOx, GPIO_Pin)) |
| Sets pin(s) value. More... | |
| #define | TM_GPIO_TogglePinValue(GPIOx, GPIO_Pin) ((GPIOx)->ODR ^= (GPIO_Pin)) |
| Toggles pin(s) More... | |
| #define | TM_GPIO_SetPortValue(GPIOx, value) ((GPIOx)->ODR = (value)) |
| Sets value to entire GPIO PORT. More... | |
| #define | TM_GPIO_GetInputPinValue(GPIOx, GPIO_Pin) (((GPIOx)->IDR & (GPIO_Pin)) == 0 ? 0 : 1) |
| Gets input data bit. More... | |
| #define | TM_GPIO_GetOutputPinValue(GPIOx, GPIO_Pin) (((GPIOx)->ODR & (GPIO_Pin)) == 0 ? 0 : 1) |
| Gets output data bit. More... | |
| #define | TM_GPIO_GetPortInputValue(GPIOx) ((GPIOx)->IDR) |
| Gets input value from entire GPIO PORT. More... | |
| #define | TM_GPIO_GetPortOutputValue(GPIOx) ((GPIOx)->ODR) |
| Gets output value from entire GPIO PORT. More... | |
Functions | |
| void | TM_GPIO_Init (GPIO_TypeDef *GPIOx, uint16_t GPIO_Pin, TM_GPIO_Mode_t GPIO_Mode, TM_GPIO_OType_t GPIO_OType, TM_GPIO_PuPd_t GPIO_PuPd, TM_GPIO_Speed_t GPIO_Speed) |
| Initializes GPIO pins(s) More... | |
| void | TM_GPIO_InitAlternate (GPIO_TypeDef *GPIOx, uint16_t GPIO_Pin, TM_GPIO_OType_t GPIO_OType, TM_GPIO_PuPd_t GPIO_PuPd, TM_GPIO_Speed_t GPIO_Speed, uint8_t Alternate) |
| Initializes GPIO pins(s) as alternate function. More... | |
| void | TM_GPIO_DeInit (GPIO_TypeDef *GPIOx, uint16_t GPIO_Pin) |
| Deinitializes pin(s) More... | |
| void | TM_GPIO_SetPinAsInput (GPIO_TypeDef *GPIOx, uint16_t GPIO_Pin) |
| Sets pin(s) as input. More... | |
| void | TM_GPIO_SetPinAsOutput (GPIO_TypeDef *GPIOx, uint16_t GPIO_Pin) |
| Sets pin(s) as output. More... | |
| void | TM_GPIO_SetPinAsAnalog (GPIO_TypeDef *GPIOx, uint16_t GPIO_Pin) |
| Sets pin(s) as analog. More... | |
| void | TM_GPIO_SetPinAsAlternate (GPIO_TypeDef *GPIOx, uint16_t GPIO_Pin) |
| Sets pin(s) as alternate function. More... | |
| void | TM_GPIO_SetPullResistor (GPIO_TypeDef *GPIOx, uint16_t GPIO_Pin, TM_GPIO_PuPd_t GPIO_PuPd) |
| Sets pull resistor settings to GPIO pin(s) More... | |
| uint16_t | TM_GPIO_GetPortSource (GPIO_TypeDef *GPIOx) |
| Gets port source from desired GPIOx PORT. More... | |
| uint16_t | TM_GPIO_GetPinSource (uint16_t GPIO_Pin) |
| Gets pin source from desired GPIO pin. More... | |
| void | TM_GPIO_Lock (GPIO_TypeDef *GPIOx, uint16_t GPIO_Pin) |
| Locks GPIOx register for future changes. More... | |
| uint16_t | TM_GPIO_GetUsedPins (GPIO_TypeDef *GPIOx) |
| Gets bit separated pins which were used at least once in library and were not deinitialized. More... | |
| uint16_t | TM_GPIO_GetFreePins (GPIO_TypeDef *GPIOx) |
| Gets bit separated pins which were not used at in library or were deinitialized. More... | |
GPIO Functions.
TM_GPIO_Typedefs
| #define TM_GPIO_GetInputPinValue | ( | GPIOx, | |
| GPIO_Pin | |||
| ) | (((GPIOx)->IDR & (GPIO_Pin)) == 0 ? 0 : 1) |
Gets input data bit.
| GPIOx | GPIOx PORT where you want to read input bit value |
| GPIO_Pin | GPIO pin where you want to read value |
| 1 | in case pin is high, or 0 if low |
| #define TM_GPIO_GetOutputPinValue | ( | GPIOx, | |
| GPIO_Pin | |||
| ) | (((GPIOx)->ODR & (GPIO_Pin)) == 0 ? 0 : 1) |
Gets output data bit.
| GPIOx | GPIOx PORT where you want to read output bit value |
| GPIO_Pin | GPIO pin where you want to read value |
| 1 | in case pin is high, or 0 if low |
| #define TM_GPIO_GetPortInputValue | ( | GPIOx | ) | ((GPIOx)->IDR) |
Gets input value from entire GPIO PORT.
| GPIOx | GPIOx PORT where you want to read input data value |
| Entire | PORT INPUT register |
| #define TM_GPIO_GetPortOutputValue | ( | GPIOx | ) | ((GPIOx)->ODR) |
Gets output value from entire GPIO PORT.
| GPIOx | GPIOx PORT where you want to read output data value |
| Entire | PORT OUTPUT register |
| #define TM_GPIO_SetPinHigh | ( | GPIOx, | |
| GPIO_Pin | |||
| ) | ((GPIOx)->BSRR = (uint32_t)(GPIO_Pin)) |
Sets pin(s) high.
| GPIOx | GPIOx PORT where you want to set pin high |
| GPIO_Pin | Select GPIO pin(s). You can select more pins with | (OR) operator to set them high |
| None |
| #define TM_GPIO_SetPinLow | ( | GPIOx, | |
| GPIO_Pin | |||
| ) | ((GPIOx)->BSRR = (uint32_t)(((uint32_t)GPIO_Pin) << 16)) |
Sets pin(s) low.
| GPIOx | GPIOx PORT where you want to set pin low |
| GPIO_Pin | Select GPIO pin(s). You can select more pins with | (OR) operator to set them low |
| None |
| #define TM_GPIO_SetPinValue | ( | GPIOx, | |
| GPIO_Pin, | |||
| val | |||
| ) | ((val) ? TM_GPIO_SetPinHigh(GPIOx, GPIO_Pin) : TM_GPIO_SetPinLow(GPIOx, GPIO_Pin)) |
Sets pin(s) value.
| GPIOx | GPIOx PORT where you want to set pin value |
| GPIO_Pin | Select GPIO pin(s). You can select more pins with | (OR) operator to set them value |
| val | If parameter is 0 then pin will be low, otherwise high |
| None |
| #define TM_GPIO_SetPortValue | ( | GPIOx, | |
| value | |||
| ) | ((GPIOx)->ODR = (value)) |
Sets value to entire GPIO PORT.
| GPIOx | GPIOx PORT where you want to set value |
| value | Value for GPIO OUTPUT data |
| None |
| #define TM_GPIO_TogglePinValue | ( | GPIOx, | |
| GPIO_Pin | |||
| ) | ((GPIOx)->ODR ^= (GPIO_Pin)) |
Toggles pin(s)
| GPIOx | GPIOx PORT where you want to toggle pin value |
| GPIO_Pin | Select GPIO pin(s). You can select more pins with | (OR) operator to toggle them all at a time |
| None |
| void TM_GPIO_DeInit | ( | GPIO_TypeDef * | GPIOx, |
| uint16_t | GPIO_Pin | ||
| ) |
Deinitializes pin(s)
| GPIOx | GPIOx PORT where you want to set pin as input |
| GPIO_Pin | Select GPIO pin(s). You can select more pins with | (OR) operator to set them as input |
| None |
| uint16_t TM_GPIO_GetFreePins | ( | GPIO_TypeDef * | GPIOx | ) |
Gets bit separated pins which were not used at in library or were deinitialized.
| *GPIOx | Pointer to GPIOx peripheral where to check used GPIO pins |
| Bit | values for free pins |
| uint16_t TM_GPIO_GetPinSource | ( | uint16_t | GPIO_Pin | ) |
Gets pin source from desired GPIO pin.
| GPIO_Pin | GPIO pin for calculating port source |
| Calculated | pin source for GPIO pin |
| uint16_t TM_GPIO_GetPortSource | ( | GPIO_TypeDef * | GPIOx | ) |
Gets port source from desired GPIOx PORT.
| GPIOx | GPIO PORT for calculating port source |
| Calculated | port source for GPIO |
| uint16_t TM_GPIO_GetUsedPins | ( | GPIO_TypeDef * | GPIOx | ) |
Gets bit separated pins which were used at least once in library and were not deinitialized.
| *GPIOx | Pointer to GPIOx peripheral where to check used GPIO pins |
| Bit | values for used pins |
| void TM_GPIO_Init | ( | GPIO_TypeDef * | GPIOx, |
| uint16_t | GPIO_Pin, | ||
| TM_GPIO_Mode_t | GPIO_Mode, | ||
| TM_GPIO_OType_t | GPIO_OType, | ||
| TM_GPIO_PuPd_t | GPIO_PuPd, | ||
| TM_GPIO_Speed_t | GPIO_Speed | ||
| ) |
Initializes GPIO pins(s)
| GPIOx | Pointer to GPIOx port you will use for initialization |
| GPIO_Pin | GPIO pin(s) you will use for initialization |
| GPIO_Mode | Select GPIO mode. This parameter can be a value of TM_GPIO_Mode_t enumeration |
| GPIO_OType | Select GPIO Output type. This parameter can be a value of TM_GPIO_OType_t enumeration |
| GPIO_PuPd | Select GPIO pull resistor. This parameter can be a value of TM_GPIO_PuPd_t enumeration |
| GPIO_Speed | Select GPIO speed. This parameter can be a value of TM_GPIO_Speed_t enumeration |
| None |
| void TM_GPIO_InitAlternate | ( | GPIO_TypeDef * | GPIOx, |
| uint16_t | GPIO_Pin, | ||
| TM_GPIO_OType_t | GPIO_OType, | ||
| TM_GPIO_PuPd_t | GPIO_PuPd, | ||
| TM_GPIO_Speed_t | GPIO_Speed, | ||
| uint8_t | Alternate | ||
| ) |
Initializes GPIO pins(s) as alternate function.
| GPIOx | Pointer to GPIOx port you will use for initialization |
| GPIO_Pin | GPIO pin(s) you will use for initialization |
| GPIO_OType | Select GPIO Output type. This parameter can be a value of TM_GPIO_OType_t enumeration |
| GPIO_PuPd | Select GPIO pull resistor. This parameter can be a value of TM_GPIO_PuPd_t enumeration |
| GPIO_Speed | Select GPIO speed. This parameter can be a value of TM_GPIO_Speed_t enumeration |
| Alternate | Alternate function you will use |
| None |
| void TM_GPIO_Lock | ( | GPIO_TypeDef * | GPIOx, |
| uint16_t | GPIO_Pin | ||
| ) |
Locks GPIOx register for future changes.
| *GPIOx | GPIOx PORT where you want to lock config registers |
| GPIO_Pin | GPIO pin(s) where you want to lock config registers |
| None |
| void TM_GPIO_SetPinAsAlternate | ( | GPIO_TypeDef * | GPIOx, |
| uint16_t | GPIO_Pin | ||
| ) |
Sets pin(s) as alternate function.
| GPIOx | GPIOx PORT where you want to set pin as alternate |
| GPIO_Pin | Select GPIO pin(s). You can select more pins with | (OR) operator to set them as alternate |
| None |
| void TM_GPIO_SetPinAsAnalog | ( | GPIO_TypeDef * | GPIOx, |
| uint16_t | GPIO_Pin | ||
| ) |
Sets pin(s) as analog.
| GPIOx | GPIOx PORT where you want to set pin as analog |
| GPIO_Pin | Select GPIO pin(s). You can select more pins with | (OR) operator to set them as analog |
| None |
| void TM_GPIO_SetPinAsInput | ( | GPIO_TypeDef * | GPIOx, |
| uint16_t | GPIO_Pin | ||
| ) |
Sets pin(s) as input.
| GPIOx | GPIOx PORT where you want to set pin as input |
| GPIO_Pin | Select GPIO pin(s). You can select more pins with | (OR) operator to set them as input |
| None |
| void TM_GPIO_SetPinAsOutput | ( | GPIO_TypeDef * | GPIOx, |
| uint16_t | GPIO_Pin | ||
| ) |
Sets pin(s) as output.
| GPIOx | GPIOx PORT where you want to set pin as output |
| GPIO_Pin | Select GPIO pin(s). You can select more pins with | (OR) operator to set them as output |
| None |
| void TM_GPIO_SetPullResistor | ( | GPIO_TypeDef * | GPIOx, |
| uint16_t | GPIO_Pin, | ||
| TM_GPIO_PuPd_t | GPIO_PuPd | ||
| ) |
Sets pull resistor settings to GPIO pin(s)
| *GPIOx | GPIOx PORT where you want to select pull resistor |
| GPIO_Pin | Select GPIO pin(s). You can select more pins with | (OR) operator to set them as output |
| GPIO_PuPd | Pull resistor option. This parameter can be a value of TM_GPIO_PuPd_t enumeration |
| None |