GlobLib
HAL and API libraries for MCUs and hardware.
|
This module contains low level functions GPIO access. More...
Files | |
file | stm32f103cb_gpio.h |
Header file for stm32f103 GPIO. | |
Enumerations |
Functions | |
mcu_error | pinSetup (gpio_mode mode, gpio_port port, gpio_pin pin) |
Setup a GPIO pin for a given function. More... | |
void | pinHigh (gpio_port port, gpio_pin pin) |
Set a given gpio pin on a port to logic high. More... | |
void | pinLow (gpio_port port, gpio_pin pin) |
Set a given gpio pin on a port to logic low. More... | |
void | pinWrite (gpio_port port, gpio_pin pin, gpio_state state) |
Set a given gpio pin on a port to a logic state. More... | |
void | pinToggle (gpio_port port, gpio_pin pin) |
Toggle the output of a given pin on a port. More... | |
uint8_t | pinRead (gpio_port port, gpio_pin pin) |
Read the current digital value of an input pin. More... | |
mcu_error | GPIO_ISREnable (gpio_port port, gpio_pin pin, gpio_isr trigger, void(*handle)(void)) |
Setup interrupts on a gpio port / pin. More... | |
mcu_error | GPIO_ISRDisable (gpio_pin pin) |
Disable interrupts on a gpio port / pin. More... | |
This module contains low level functions GPIO access.
This header file is included in other modules. It acts as a bridge between peripheral modules such as USART and the cmsis libraries they use.
enum gpio_isr |
GPIO interrupt options for pins.
corresponds with the memory address offset used.
Enumerator | |
---|---|
GPIO_RISING |
Interrupt occurs on rising edge detection. |
GPIO_FALLING |
Interrupt occurs on falling edge detection. |
GPIO_BOTH |
Interrupt occurs on rising and falling edge detection. |
Definition at line 96 of file stm32f103cb_gpio.h.
enum gpio_mem |
GPIO memory address base and offsets.
These macros are used intenally to access GPIO configuration ports
Definition at line 131 of file stm32f103cb_gpio.h.
enum gpio_mode |
GPIO setup options.
These values are used when setting up the pin for use. Hexidecimal values used are memory address offsets to access the port.
Definition at line 58 of file stm32f103cb_gpio.h.
enum gpio_pin |
GPIO pins available for each port.
These macros are used to access the hardware pins for each port. Each hexidecimal number corresponds with the memory address offset used.
Definition at line 107 of file stm32f103cb_gpio.h.
enum gpio_port |
GPIO ports available for the MCU.
These values are used to access the hardware pins for each port. Each hexidecimal number corresponds with the memory address offset used.
Enumerator | |
---|---|
PORTA |
Port A of the MCU. |
PORTB |
Port B of the MCU. |
PORTC |
Port C of the MCU. |
Definition at line 85 of file stm32f103cb_gpio.h.
enum gpio_state |
GPIO pin states.
These values are used when writing a value to a pin with pinWrite().
Enumerator | |
---|---|
GPIO_LOW |
Set the corresponding pin to logic low. |
GPIO_HIGH |
Set the corresponding pin to logic high. |
Definition at line 75 of file stm32f103cb_gpio.h.
Disable interrupts on a gpio port / pin.
This function clears all previous setting of the interrupt.
pin | The pin of the port, defined by gpio_pin |
Definition at line 484 of file stm32f103cb_gpio.c.
Setup interrupts on a gpio port / pin.
The MCU can only support one external interrupt per pin number. For example, pin 2 cannot have an interrupt on port A and B, E_GPIO_ISR is return if this is attempted.
port | The port of the MCU, defined by gpio_port |
pin | The pin of the port, defined by gpio_pin |
trigger | The interrupt trigger, define by gpio_isr |
handle | Pointer to the function to be called on interrupt event. |
Definition at line 133 of file stm32f103cb_gpio.c.
Set a given gpio pin on a port to logic high.
Pin must be set for digital output to use this function
port | The port of the MCU, defined by gpio_port |
pin | The pin of the port, defined by gpio_pin |
Definition at line 91 of file stm32f103cb_gpio.c.
Set a given gpio pin on a port to logic low.
Pin must be set for digital output to use this function
port | The port of the MCU, defined by gpio_port |
pin | The pin of the port, defined by gpio_pin |
Definition at line 97 of file stm32f103cb_gpio.c.
Read the current digital value of an input pin.
Pin must be set for digital input to use this function
port | The port of the MCU, defined by gpio_port |
pin | The pin of the port, defined by gpio_pin |
Definition at line 123 of file stm32f103cb_gpio.c.
Setup a GPIO pin for a given function.
This function is also employed by other modules to configure pins and ports.
mode | The mode for the pin to operate, defined by gpio_mode |
port | The port of the MCU, defined by gpio_port |
pin | The pin of the port, defined by gpio_pin |
Definition at line 44 of file stm32f103cb_gpio.c.
Toggle the output of a given pin on a port.
Pin must be set for digital output to use this function
port | The port of the MCU, defined by gpio_port |
pin | The pin of the port, defined by gpio_pin |
Definition at line 116 of file stm32f103cb_gpio.c.
void pinWrite | ( | gpio_port | port, |
gpio_pin | pin, | ||
gpio_state | state | ||
) |
Set a given gpio pin on a port to a logic state.
Pin must be set for digital output to use this function
state | The state to set the pin to, defined by gpio_state |
port | The port of the MCU, defined by gpio_port |
pin | The pin of the port, defined by gpio_pin |
Definition at line 103 of file stm32f103cb_gpio.c.