STM32G0 MCAL 0.0.1
Tiny MCAL for educational purpose.
|
Port Specific Arquitecture Driver More...
#include "Port_Types.h"
Go to the source code of this file.
Macros | |
#define | PORT_A 0u |
#define | PORT_B 1u |
#define | PORT_C 2u |
#define | PORT_D 3u |
#define | PORT_E 4u |
#define | PORT_F 5u |
#define | GET_LOW_NIBBLE(x) |
#define | GET_HIGH_NIBBLE(x) |
#define | GET_HIGH_BYTE(x) |
#define | PORT_MODE_INPUT 0x00u |
#define | PORT_MODE_OUTPUT 0x10u |
#define | PORT_MODE_ANALOG 0x30u |
#define | PORT_MODE_ALT_AF0 0x20u |
#define | PORT_MODE_ALT_AF1 0x21u |
#define | PORT_MODE_ALT_AF2 0x22u |
#define | PORT_MODE_ALT_AF3 0x23u |
#define | PORT_MODE_ALT_AF4 0x24u |
#define | PORT_MODE_ALT_AF5 0x25u |
#define | PORT_MODE_ALT_AF6 0x26u |
#define | PORT_MODE_ALT_AF7 0x27u |
#define | PORT_NOPULL 0x00u |
#define | PORT_PULLUP 0x01u |
#define | PORT_PULLDOWN 0x02u |
#define | PORT_PUSH_PULL 0x00u |
#define | PORT_OPEN_COLECTOR 0x01u |
#define | PORT_VERY_LOW_SPEED 0x00u |
#define | PORT_LOW_SPEED 0x01u |
#define | PORT_HIGH_SPEED 0x02u |
#define | PORT_VERY_HIGH_SPEED 0x03u |
#define | PORT_PIN_IN 0x00u |
#define | PORT_PIN_OUT 0x01u |
Functions | |
void | Port_Arch_Init (const Port_PinConfigType *PortConfigPtr) |
Initialize the GPIO pins to the configuration store on ConfigPTR. | |
void | Port_Arch_SetPinDirection (const Port_PinConfigType *PortConfigPtr, Port_PinDirectionType Direction) |
Set the direction of a GPIO during runtime. | |
void | Port_Arch_SetPinMode (const Port_PinConfigType *PortConfigPtr, uint8 PinMode, uint8 AltMode) |
Set the mode of a GPIO during runtime. | |
void | Port_Arch_RefreshPortDirection (const Port_PinConfigType *PortConfigPtr) |
Refresh port direction. | |
Port Specific Arquitecture Driver
PORT driver implementation for the STM32G0xx family of microcontrollers. This file contains the hardware specific implementation of the PORT driver. The file is implemented as a means of abstraction from the hardware, this way we can avoid to include Arch headers in the actual driver header, making the low level interfaces available only for the inmediate upper layer.
void Port_Arch_Init | ( | const Port_PinConfigType * | PortConfigPtr | ) |
Initialize the GPIO pins to the configuration store on ConfigPTR.
This function changes the values of the registers depending on the ConfigPtr values.
PortConfigPtr | Pointer to ConfigPtr struct array. |
< Multiply by two on a shift operation
< operation on two bits
< Multiply by two on a shift operation
< operation on two bits
< Multiply by two on a shift operation
< operation on two bits
< get the four most significant nibble
< value of pin 8
< Multiply by four on a shift operation
< operation on four bits
< get the less significant bits
< value of pin 8
< Multiply by four on a shift operation
< operation on four bits
< get the less significant bits
void Port_Arch_RefreshPortDirection | ( | const Port_PinConfigType * | PortConfigPtr | ) |
Refresh port direction.
The function refreshes the registers values of the GPIOS moder during runtime to the initial values only if they are configured as non changeables.
PortConfigPtr | Pointer for the port configuration value. |
< Input mode value
< General purpose output mode value
< Multiply by two on a shift operation
< operation on two bits
< get the four most significant nibble
void Port_Arch_SetPinDirection | ( | const Port_PinConfigType * | PortConfigPtr, |
Port_PinDirectionType | Direction ) |
Set the direction of a GPIO during runtime.
The function changes the registers values of the GPIOS direction during runtime.
PortConfigPtr | Pointer for the port configuration value. |
Direction | Direction to be changed. |
< Multiply by two on a shift operation
< operation on two bits
void Port_Arch_SetPinMode | ( | const Port_PinConfigType * | PortConfigPtr, |
uint8 | PinMode, | ||
uint8 | AltMode ) |
Set the mode of a GPIO during runtime.
The function changes the registers values of the GPIOS mode during runtime.
PortConfigPtr | Pointer for the port configuration value. |
PinMode | Pin Mode to be changed. |
AltMode | Altern Mode to be changed. |
< Multiply by two on a shift operation
< operation on two bits
< value of pin 8
< Multiply by four on a shift operation
< operation on four bits
< value of pin 8
< Multiply by four on a shift operation
< operation on four bits