STM32G0 MCAL 0.0.1
Tiny MCAL for educational purpose.
|
Dio Specific Arquitecture Driver More...
#include "Dio_Types.h"
Go to the source code of this file.
Macros | |
#define | DIO_PORT_A 0u |
#define | DIO_PORT_B 1u |
#define | DIO_PORT_C 2u |
#define | DIO_PORT_D 3u |
#define | DIO_PORT_E 4u |
#define | DIO_PORT_F 5u |
Functions | |
Dio_LevelType | Dio_Arch_ReadChannel (Dio_PortType Port, uint8 Pin) |
Read Channel. | |
void | Dio_Arch_WriteChannel (Dio_PortType Port, uint8 Pin, Dio_LevelType Level) |
Write Channel. | |
Dio_LevelType | Dio_Arch_FlipChannel (Dio_PortType Port, uint8 Pin) |
Flip Channel. | |
Dio_PortLevelType | Dio_Arch_ReadPort (Dio_PortType Port) |
Read Port. | |
void | Dio_Arch_WritePort (Dio_PortType Port, Dio_PortLevelType Level) |
Write Port. | |
Dio_PortLevelType | Dio_Arch_ReadChannelGroup (const Dio_ChannelGroupType *ChannelGroupIdPtr) |
Read Channel Group. | |
void | Dio_Arch_WriteChannelGroup (const Dio_ChannelGroupType *ChannelGroupIdPtr, Dio_PortLevelType Level) |
Write Channel Group. | |
void | Dio_Arch_MaskedWritePort (Dio_PortType Port, Dio_PortLevelType Level, Dio_PortLevelType Mask) |
Masked Write Port. | |
Dio Specific Arquitecture Driver
Dio driver implementation for the STM32G0xx family of microcontrollers. This file contains the hardware specific implementation of the Dio 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.
Dio_LevelType Dio_Arch_FlipChannel | ( | Dio_PortType | Port, |
uint8 | Pin ) |
Flip Channel.
This function will flip the level of the specified channel writting the opposite value in the register ODR speficied by parameter Pin. from the port specified by the parameter Port. the fucntion will also return the level of the channel after flipping it reading the value from the register IDR.
Port | Port ID. |
Pin | Pin ID. |
Returns | the level of a channel after flipping the level. |
< Offset to set the bit in BSRR register
void Dio_Arch_MaskedWritePort | ( | Dio_PortType | Port, |
Dio_PortLevelType | Level, | ||
Dio_PortLevelType | Mask ) |
Masked Write Port.
This function will set the specified value for the channels on the specified port if the corresponding bit in Mask is '1'.
Port | ID of DIO Port. |
Level | Value to be written. |
Mask | Channels to be masked in the port. |
Dio_LevelType Dio_Arch_ReadChannel | ( | Dio_PortType | Port, |
uint8 | Pin ) |
Read Channel.
The function will return the bit from register IDR speficied by paramter Pin. from the port specified by the parameter Port.
Port | Port ID. |
Pin | Pin ID. |
Returns | the value of the specified DIO channel. |
Dio_PortLevelType Dio_Arch_ReadChannelGroup | ( | const Dio_ChannelGroupType * | ChannelGroupIdPtr | ) |
Read Channel Group.
This function will read a subset of the contiguous bits of register IDR of a port (channel group). The function will not change the remaining channels of the port or the channels
ChannelGroupIdPtr | Pointer to ChannelGroup. |
Returns | the level of a subset of the adjacent bits of a port (channel group). |
Dio_PortLevelType Dio_Arch_ReadPort | ( | Dio_PortType | Port | ) |
Read Port.
The function will return the level of all pins of the port specified by the parameter Port. The function will read the value from the register IDR.
Port | ID of DIO Port. |
Returns | the level of all channels on that port. |
void Dio_Arch_WriteChannel | ( | Dio_PortType | Port, |
uint8 | Pin, | ||
Dio_LevelType | Level ) |
Write Channel.
This function will write the specified value to register ODR speficied by parameter Pin. from the port specified by the parameter Port.
Port | Port ID. |
Pin | Pin ID. |
Level | Value to be written. |
void Dio_Arch_WriteChannelGroup | ( | const Dio_ChannelGroupType * | ChannelGroupIdPtr, |
Dio_PortLevelType | Level ) |
Write Channel Group.
This function will set a subset of the adjacent bits of a port (channel group) writting the specified value to the register ODR. The function will not change the remaining channels of the port or the channels
ChannelGroupIdPtr | Pointer to ChannelGroup. |
Level | Value to be written. |
void Dio_Arch_WritePort | ( | Dio_PortType | Port, |
Dio_PortLevelType | Level ) |
Write Port.
This function is used to write a value to all channels of the specified port. The function will write the value to the register ODR.
Port | ID of DIO Port. |
Level | Value to be written. |