Digital Input/Output Reusable Driver v1.1
This project implements a GPIO reusable driver that can be adapted to various microcontrollers.
Loading...
Searching...
No Matches
dio_cfg.h File Reference

This module contains interface definitions for the Dio configuration. This is the header file for the definition of the interface for retrieving the digital input/output configuration table. More...

#include <stdio.h>
Include dependency graph for dio_cfg.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  DioConfig_t
 

Macros

#define NUMBER_OF_PORTS   5U
 

Enumerations

enum  DioPinState_t { DIO_LOW , DIO_HIGH , DIO_PIN_STATE_MAX }
 
enum  DioPort_t {
  DIO_PA , DIO_PB , DIO_PC , DIO_PD ,
  DIO_PH , DIO_MAX_PORT
}
 
enum  DioPin_t {
  DIO_PA0 , DIO_PA1 , DIO_PA2 , DIO_PA3 ,
  DIO_PA4 , DIO_PA5 , DIO_PA6 , DIO_PA7 ,
  DIO_PA8 , DIO_PA9 , DIO_PA10 , DIO_PA11 ,
  DIO_PA12 , DIO_PA13 , DIO_PA14 , DIO_PA15 ,
  DIO_PB0 = 0 , DIO_PB1 , DIO_PB2 , DIO_PB3 ,
  DIO_PB4 , DIO_PB5 , DIO_PB6 , DIO_PB7 ,
  DIO_PB8 , DIO_PB9 , DIO_PB10 , DIO_PB12 = 12 ,
  DIO_PB13 , DIO_PB14 , DIO_PB15 , DIO_PC0 = 0 ,
  DIO_PC1 , DIO_PC2 , DIO_PC3 , DIO_PC4 ,
  DIO_PC5 , DIO_PC6 , DIO_PC7 , DIO_PC8 ,
  DIO_PC9 , DIO_PC10 , DIO_PC11 , DIO_PC12 ,
  DIO_PC13 , DIO_PC14 , DIO_PC15 , DIO_PD2 = 2 ,
  DIO_PH0 = 0 , DIO_PH1 , DIO_MAX_PIN = 16
}
 
enum  DioMode_t {
  DIO_INPUT , DIO_OUTPUT , DIO_FUNCTION , DIO_ANALOG ,
  DIO_MAX_MODE
}
 
enum  DioType_t { DIO_PUSH_PULL , DIO_OPEN_DRAIN , DIO_MAX_TYPE }
 
enum  DioSpeed_t {
  DIO_LOW_SPEED , DIO_MEDIUM_SPEED , DIO_HIGH_SPEED , DIO_VERY_SPEED ,
  DIO_MAX_SPEED
}
 
enum  DioResistor_t { DIO_NO_RESISTOR , DIO_PULLUP , DIO_PULLDOWN , DIO_MAX_RESISTOR }
 
enum  DioFunction_t {
  DIO_AF0 , DIO_AF1 , DIO_AF2 , DIO_AF3 ,
  DIO_AF4 , DIO_AF5 , DIO_AF6 , DIO_AF7 ,
  DIO_AF8 , DIO_AF9 , DIO_AF10 , DIO_AF11 ,
  DIO_AF12 , DIO_AF13 , DIO_AF14 , DIO_AF15 ,
  DIO_MAX_FUNCTION
}
 

Functions

const DioConfig_t *const DIO_configGet (void)
 
size_t DIO_configSizeGet (void)
 

Detailed Description

This module contains interface definitions for the Dio configuration. This is the header file for the definition of the interface for retrieving the digital input/output configuration table.

Author
Jose Luis Figueroa
Version
1.1
Date
2025-03-04

Macro Definition Documentation

◆ NUMBER_OF_PORTS

#define NUMBER_OF_PORTS   5U

Defines the number of ports on the processor.

Enumeration Type Documentation

◆ DioFunction_t

Defines the possible DIO alternate function. A multiplexer is used to select the alternate function

Enumerator
DIO_AF0 

Alternate function 0

DIO_AF1 

Alternate function 1

DIO_AF2 

Alternate function 2

DIO_AF3 

Alternate function 3

DIO_AF4 

Alternate function 4

DIO_AF5 

Alternate function 5

DIO_AF6 

Alternate function 6

DIO_AF7 

Alternate function 7

DIO_AF8 

Alternate function 8

DIO_AF9 

Alternate function 9

DIO_AF10 

Alternate function 10

DIO_AF11 

Alternate function 11

DIO_AF12 

Alternate function 12

DIO_AF13 

Alternate function 13

DIO_AF14 

Alternate function 14

DIO_AF15 

Alternate function 15

DIO_MAX_FUNCTION 

Defines the maximum function value

◆ DioMode_t

enum DioMode_t

Defines the mode of the Dio pin as an input, output, alternate function and analog.

Enumerator
DIO_INPUT 

Input mode

DIO_OUTPUT 

General purpose Output mode

DIO_FUNCTION 

Alternate function mode

DIO_ANALOG 

Analog mode

DIO_MAX_MODE 

Defines the maximum mode

◆ DioPin_t

enum DioPin_t

Defines all the pins contained on the MCU device. It is used to set a specific bit on the ports.

Enumerator
DIO_PA0 

PA0

DIO_PA1 

PA1

DIO_PA2 

PA2

DIO_PA3 

PA3

DIO_PA4 

PA4

DIO_PA5 

PA5

DIO_PA6 

PA6

DIO_PA7 

PA7

DIO_PA8 

PA8

DIO_PA9 

PA9

DIO_PA10 

PA10

DIO_PA11 

PA11

DIO_PA12 

PA12

DIO_PA13 

PA13 SWD (NC)

DIO_PA14 

PA14 SWD (NC)

DIO_PA15 

PA15

DIO_PB0 

PB0

DIO_PB1 

PB1

DIO_PB2 

PB2

DIO_PB3 

PB3

DIO_PB4 

PB4

DIO_PB5 

PB5

DIO_PB6 

PB6

DIO_PB7 

PB7

DIO_PB8 

PB8

DIO_PB9 

PB9

DIO_PB10 

PB10

DIO_PB12 

PB12

DIO_PB13 

PB13

DIO_PB14 

PB14

DIO_PB15 

PB15

DIO_PC0 

PC0

DIO_PC1 

PC1

DIO_PC2 

PC2

DIO_PC3 

PC3

DIO_PC4 

PC4

DIO_PC5 

PC5

DIO_PC6 

PC6

DIO_PC7 

PC7

DIO_PC8 

PC8

DIO_PC9 

PC9

DIO_PC10 

PC10

DIO_PC11 

PC11

DIO_PC12 

PC12

DIO_PC13 

PC13 Push button

DIO_PC14 

PC14 OSC32_IN

DIO_PC15 

PC15 OSC32_OUT

DIO_PD2 

PD2

DIO_PH0 

PH0 OSC_IN

DIO_PH1 

PH1 OSC_OUT

DIO_MAX_PIN 

Defines the maximum pin value

◆ DioPinState_t

Defines the possible states for a digital output pin.

Enumerator
DIO_LOW 

Defines digital state ground

DIO_HIGH 

Defines digital state power

DIO_PIN_STATE_MAX 

Defines the maximum digital state

◆ DioPort_t

enum DioPort_t

Define the ports contained on the MCU device. It is used to identify the specific port GPIO to configure the register map.

Enumerator
DIO_PA 

Port A

DIO_PB 

Port B

DIO_PC 

Port C

DIO_PD 

Port D

DIO_PH 

Port H

DIO_MAX_PORT 

Defines the maximum Port

◆ DioResistor_t

Defines the possible states of the channel pull-ups.

Enumerator
DIO_NO_RESISTOR 

Used to disable the internal resistor

DIO_PULLUP 

Used to enable the internal pull-up

DIO_PULLDOWN 

Used to enable the internal pull-down

DIO_MAX_RESISTOR 

Defines the maximum resistor value

◆ DioSpeed_t

enum DioSpeed_t

Defines the output speed settings available

Enumerator
DIO_LOW_SPEED 

Low speed is configured on the pin

DIO_MEDIUM_SPEED 

Medium speed is configured on the pin

DIO_HIGH_SPEED 

High speed is configured on the pin

DIO_VERY_SPEED 

Very speed is configured on the pin

DIO_MAX_SPEED 

Defines the maximum output speed

◆ DioType_t

enum DioType_t

Define the output type of the Input/output port.

Enumerator
DIO_PUSH_PULL 

Enable output push-pull

DIO_OPEN_DRAIN 

Enable output open-drain

DIO_MAX_TYPE 

Defines the maximum output type

Function Documentation

◆ DIO_configGet()

const DioConfig_t *const DIO_configGet ( void )

Description: This function is used to initialize the DIO based on the configuration table defined in dio_cfg module.

PRE-CONDITION: configuration table needs to be populated (sizeof > 0)

POST-CONDITION: A constant pointer to the first member of the
configuration table will be returned.

Returns
A pointer to the configuration table.

Example:

const Dio_Config_t * const DioConfig = DIO_configGet();
size_t configSize = DIO_configSizeGet();
DIO_Init(DioConfig, configSize);
size_t DIO_configSizeGet(void)
Definition dio_cfg.c:139
const DioConfig_t DioConfig[]
Definition dio_cfg.c:41
const DioConfig_t *const DIO_configGet(void)
Definition dio_cfg.c:98
See also
DIO_configGet
DIO_configSizeGet
DIO_init
DIO_channelRead
DIO_channelWrite
DIO_channelToggle
DIO_registerWrite
DIO_registerRead

◆ DIO_configSizeGet()

size_t DIO_configSizeGet ( void )

Description: This function is used to get the size of the configuration table.

PRE-CONDITION: configuration table needs to be populated (sizeof > 0)

POST-CONDITION: The size of the configuration table will be returned.

Returns
The size of the configuration table.

Example:

const Dio_Config_t * const DioConfig = DIO_configGet();
size_t configSize = DIO_configSizeGet();
DIO_Init(DioConfig, configSize);
See also
DIO_configGet
DIO_configSizeGet
DIO_init
DIO_channelRead
DIO_channelWrite
DIO_channelToggle
DIO_registerWrite
DIO_registerRead