microHAL
An abstraction layer for your future F4xx projects
|
Function prototypes for the GPIO driver. More...
Go to the source code of this file.
Data Structures | |
struct | GPIORegs |
Contains GPIO registers. More... | |
Macros | |
#define | GPIO(bank) |
Typedefs | |
typedef enum gp_bank | gp_bank_t |
Available GPIO peripherals. | |
typedef enum gp_dir | gp_dir_t |
Available GPIO modes. | |
typedef enum gp_otype | gp_otype_t |
Available GPIO output types. | |
typedef enum gp_speed | gp_speed_t |
Available GPIO output speeds. | |
typedef enum gp_pupd | gp_pupd_t |
Available GPIO pull states. | |
Enumerations | |
enum | gp_bank { GP_BANK_LEN } |
Available GPIO peripherals. | |
enum | gp_dir { GP_DIR_IN = 0x00 , GP_DIR_OU = 0x01 , GP_DIR_AL = 0x02 , GP_DIR_AN = 0x03 } |
Available GPIO modes. | |
enum | gp_otype { GP_OTYPE_PP = 0x00 , GP_OTYPE_OD = 0x01 } |
Available GPIO output types. | |
enum | gp_speed { GP_SPEED_LOW = 0x00 , GP_SPEED_MED = 0x01 , GP_SPEED_FAS = 0x02 , GP_SPEED_HIG = 0x03 } |
Available GPIO output speeds. | |
enum | gp_pupd { GP_PUPD_NONE = 0x00 , GP_PUPD_PLUP = 0x01 , GP_PUPD_PLDO = 0x02 } |
Available GPIO pull states. | |
Functions | |
void | gp_set_direction (const gp_bank_t bank, const uint8_t pin, const gp_dir_t dir) |
Sets the GPIO pin to the desired mode. | |
void | gp_set_output_type (const gp_bank_t bank, const uint8_t pin, const gp_otype_t type) |
Sets the GPIO output pin to the desired type. | |
void | gp_set_speed (const gp_bank_t bank, const uint8_t pin, const gp_speed_t speed) |
Sets the GPIO output pin to the desired speed. | |
void | gp_set_pupd (const gp_bank_t bank, const uint8_t pin, const gp_pupd_t poopdr) |
Sets the GPIO input pin to the desired state. | |
void | gp_set_val (const gp_bank_t bank, const uint8_t pin, const _Bool value) |
Sets the GPIO output pin to the desired value. | |
uint8_t | gp_read_val (const gp_bank_t bank, const uint8_t pin) |
Reads the GPIO input pin value. | |
void | gp_set_af (const gp_bank_t bank, const uint8_t pin, const uint8_t af) |
Sets the alternate function of the GPIO pin. | |
Function prototypes for the GPIO driver.
This file contains all of the enums, macros, and function prototypes required for a functional GPIO driver.
#define GPIO | ( | bank | ) |
uint8_t gp_read_val | ( | const gp_bank_t | bank, |
const uint8_t | pin ) |
Reads the GPIO input pin value.
bank | The GPIO bank |
pin | The GPIO pin |
void gp_set_af | ( | const gp_bank_t | bank, |
const uint8_t | pin, | ||
const uint8_t | af ) |
Sets the alternate function of the GPIO pin.
bank | The GPIO bank |
pin | The GPIO pin |
The | alternate function number |
Sets the GPIO pin to the desired mode.
The available directions for the GPIO pins are specified in the gp_dir_t enum. Any other value will be ignored.
bank | The GPIO bank |
pin | The GPIO pin |
dir | The pin mode |
void gp_set_output_type | ( | const gp_bank_t | bank, |
const uint8_t | pin, | ||
const gp_otype_t | type ) |
Sets the GPIO output pin to the desired type.
The available output types for the GPIO pins are specified in the gp_otype_t enum. Any other value will be ignored.
bank | The GPIO bank |
pin | The GPIO pin |
type | The pin type |
Sets the GPIO input pin to the desired state.
The available pull-up/pull-down states for the GPIO pins are specified in the gp_pupdr_t enum. Any other value will be ignored.
bank | The GPIO bank |
pin | The GPIO pin |
poopdr | The pin state |
void gp_set_speed | ( | const gp_bank_t | bank, |
const uint8_t | pin, | ||
const gp_speed_t | speed ) |
Sets the GPIO output pin to the desired speed.
The available speeds for the GPIO output pins are specified in the gp_speed_t enum. Any other value will be ignored.
bank | The GPIO bank |
pin | The GPIO pin |
speed | The pin speed |
void gp_set_val | ( | const gp_bank_t | bank, |
const uint8_t | pin, | ||
const _Bool | value ) |
Sets the GPIO output pin to the desired value.
Allowed values are either TRUE(1) or FALSE(0). Any other value will be ignored.
bank | The GPIO bank |
pin | The GPIO pin |
value | The pin value |