ACDC Senior Project v1.0.0
Senior Project for Textron Aviation
|
Implementation of GPIO configuration and manipulation functions. More...
#include "ACDC_GPIO.h"
Macros | |
#define | GPIO_CNF_INPUT_PULLUP_PULLDOWN 0b10u |
#define | GPIO_MODE_CNF 0b1111 |
#define | GPIO_MODE_OFFSET 0 |
#define | GPIO_CNF_OFFSET 2 |
Functions | |
void | GPIO_PinDirection (GPIO_TypeDef *GPIOx, uint16_t GPIO_PIN, uint8_t GPIO_MODE, uint8_t GPIO_CNF) |
Sets the Direction of the Pin to Input/Output (MODE) and the sets its Configuration (CNF) [CAN ONLY SET ONE PIN AT A TIME]. | |
void | GPIO_Deinit (GPIO_TypeDef *GPIOx, uint16_t GPIO_PIN) |
Deinitializes GPIO_PIN on GPIOx back to its reset value. | |
void | GPIO_Write (GPIO_TypeDef *GPIOx, uint16_t GPIO_PIN, uint16_t GPIO_VALUE) |
Sets the pins output to the value passed into GPIO_VALUE. | |
void | GPIO_Set (GPIO_TypeDef *GPIOx, uint16_t GPIO_PIN) |
Sets the pins output to HIGH or 1. | |
void | GPIO_Clear (GPIO_TypeDef *GPIOx, uint16_t GPIO_PIN) |
Sets the pins output to LOW or 0. | |
void | GPIO_Toggle (GPIO_TypeDef *GPIOx, uint16_t GPIO_PIN) |
Toggles the pins output. From 0 -> 1 or 1 -> 0. | |
uint8_t | GPIO_Read (const GPIO_TypeDef *GPIOx, uint16_t GPIO_PIN) |
Returns the current value of GPIO_PIN on GPIOx. | |
uint8_t | GPIO_GetPinNumber (uint16_t GPIO_PIN) |
Returns the Pin number of the GPIO_PIN_#. | |
Implementation of GPIO configuration and manipulation functions.
This file provides functions for initializing and controlling GPIO pins, including setting pin directions, writing values, and reading pin states.
#define GPIO_CNF_INPUT_PULLUP_PULLDOWN 0b10u |
Check if the INPUT CNF bit is a pullup or pulldown
#define GPIO_CNF_OFFSET 2 |
CNF bit offset
#define GPIO_MODE_CNF 0b1111 |
Bitmask for the MODE & CNF bits
#define GPIO_MODE_OFFSET 0 |
MODE bit offset
void GPIO_Clear | ( | GPIO_TypeDef * | GPIOx, |
uint16_t | GPIO_PIN ) |
Sets the pins output to LOW or 0.
GPIOx | Port of the GPIO (Ex. GPIOA, GPIOB, ...) |
GPIO_PIN | Desired pin on port GPIOx (Ex. GPIO_PIN_0, GPIO_PIN_1, ...) |
void GPIO_Deinit | ( | GPIO_TypeDef * | GPIOx, |
uint16_t | GPIO_PIN ) |
Deinitializes GPIO_PIN on GPIOx back to its reset value.
GPIOx | Port of the GPIO (Ex. GPIOA, GPIOB, ...) |
GPIO_PIN | Desired pin on port GPIOx (Ex. GPIO_PIN_0, GPIO_PIN_1, ...) |
Returns the Pin number of the GPIO_PIN_#.
GPIO_PIN | Desired pin (Ex. GPIO_PIN_0, GPIO_PIN_1, ...) |
void GPIO_PinDirection | ( | GPIO_TypeDef * | GPIOx, |
uint16_t | GPIO_PIN, | ||
uint8_t | GPIO_MODE, | ||
uint8_t | GPIO_CNF ) |
Sets the Direction of the Pin to Input/Output (MODE) and the sets its Configuration (CNF) [CAN ONLY SET ONE PIN AT A TIME].
GPIOx | Port of the GPIO (Ex. GPIOA, GPIOB, ...) |
GPIO_PIN | Desired pin on port GPIOx (Ex. GPIO_PIN_0, GPIO_PIN_1, ...) |
GPIO_MODE | Desired mode like output 2Mhz, output 10Mhz, output 50Mhz or Input |
GPIO_CNF | Desired configuration, if output then Push-Pull or Open-Drain, else if input then Analog, Floating, or Pullup/Pulldown |
Returns the current value of GPIO_PIN on GPIOx.
GPIOx | Port of the GPIO (Ex. GPIOA, GPIOB, ...) |
GPIO_PIN | Desired pin on port GPIOx (Ex. GPIO_PIN_0, GPIO_PIN_1, ...) |
void GPIO_Set | ( | GPIO_TypeDef * | GPIOx, |
uint16_t | GPIO_PIN ) |
Sets the pins output to HIGH or 1.
GPIOx | Port of the GPIO (Ex. GPIOA, GPIOB, ...) |
GPIO_PIN | Desired pin on port GPIOx (Ex. GPIO_PIN_0, GPIO_PIN_1, ...) |
void GPIO_Toggle | ( | GPIO_TypeDef * | GPIOx, |
uint16_t | GPIO_PIN ) |
Toggles the pins output. From 0 -> 1 or 1 -> 0.
GPIOx | Port of the GPIO (Ex. GPIOA, GPIOB, ...) |
GPIO_PIN | Desired pin on port GPIOx (Ex. GPIO_PIN_0, GPIO_PIN_1, ...) |
Sets the pins output to the value passed into GPIO_VALUE.
GPIOx | Port of the GPIO (Ex. GPIOA, GPIOB, ...) |
GPIO_PIN | Desired pin on port GPIOx (Ex. GPIO_PIN_0, GPIO_PIN_1, ...) |
GPIO_VALUE | Value to set pin to. If >= 1 then 1, else 0 |