|
|
|
@ -1,3 +1,22 @@
|
|
|
|
|
/************************************************************************************************
|
|
|
|
|
* Authors : Kerem Yollu & Edwin Koch
|
|
|
|
|
* Date : 01.11.2021
|
|
|
|
|
* Version : 1.0
|
|
|
|
|
*
|
|
|
|
|
* Description :
|
|
|
|
|
* This header file for pin control is based on the most common configuation options
|
|
|
|
|
* curenty awailable for modern hardware.
|
|
|
|
|
* Depending of the used Chip, some function may vary or be unawailable.
|
|
|
|
|
* Please take a minute to go and explore the according Chips pin.c file to see woh each function
|
|
|
|
|
* is implmented.
|
|
|
|
|
*
|
|
|
|
|
* TODO:
|
|
|
|
|
* - 01.11.2021 : Should we add a seprate header in the cls layer containing the pinNo_t ?
|
|
|
|
|
* - 01.11.2021 : Depending on request implment a pinLock() function
|
|
|
|
|
*
|
|
|
|
|
* LICENCE : Please check the end of this file
|
|
|
|
|
************************************************************************************************/
|
|
|
|
|
|
|
|
|
|
#ifndef _GPIO_H_
|
|
|
|
|
#define _GPIO_H_
|
|
|
|
|
|
|
|
|
@ -62,7 +81,7 @@ typedef enum
|
|
|
|
|
floating,
|
|
|
|
|
pushPull,
|
|
|
|
|
openDrain
|
|
|
|
|
}state;
|
|
|
|
|
}stage;
|
|
|
|
|
|
|
|
|
|
typedef enum
|
|
|
|
|
{
|
|
|
|
@ -88,7 +107,7 @@ typedef enum
|
|
|
|
|
typedef struct
|
|
|
|
|
{
|
|
|
|
|
mode md;
|
|
|
|
|
state st;
|
|
|
|
|
stage st;
|
|
|
|
|
pullUpDown pud;
|
|
|
|
|
speed sp;
|
|
|
|
|
interrupt intr;
|
|
|
|
@ -110,20 +129,39 @@ typedef enum
|
|
|
|
|
NotGpio
|
|
|
|
|
}errors;
|
|
|
|
|
|
|
|
|
|
// Configuration function that will call all the necessary function for an sucessfull pin initialisation
|
|
|
|
|
void pinConfig(pinNo_t pinNo, mode mode, stage stage, pullUpDown resistance, speed speed);
|
|
|
|
|
// Modes to set the direction or function of the pin
|
|
|
|
|
void pinSetMode(pinNo_t pinNo, mode mode);
|
|
|
|
|
void pinSetOutputState(pinNo_t pinNo, state state);
|
|
|
|
|
void pinSetPullUpDonw(pinNo_t pinNo, pullUpDown resistance);
|
|
|
|
|
// Output Stage Push-Pull High-z ect...
|
|
|
|
|
void pinSetOutputStage(pinNo_t pinNo, stage stage);
|
|
|
|
|
// Depending of the hardare it is able to select the speed of given pins
|
|
|
|
|
void pinSetSpeed(pinNo_t pinNo, speed speed);
|
|
|
|
|
void pinConfig(pinNo_t pinNo, mode mode, state state, pullUpDown resistance, speed speed);
|
|
|
|
|
// If internal Pull-up or Pull-donws are wailable
|
|
|
|
|
void pinSetPullUpDonw(pinNo_t pinNo, pullUpDown resistance);
|
|
|
|
|
// If pin is set as alternate this function will modify the pins functionality
|
|
|
|
|
// If pin isn't set as alternate this function will set the pin to alternate mode.
|
|
|
|
|
void pinSetAlternate(pinNo_t pinNo, uint16_t alternate);
|
|
|
|
|
|
|
|
|
|
// Reads the pin's current value
|
|
|
|
|
uint8_t pinRead(pinNo_t pinNo);
|
|
|
|
|
// Toggles th pin's value
|
|
|
|
|
void pinToggle(pinNo_t pinNo);
|
|
|
|
|
// Sets the pin hihg or low.
|
|
|
|
|
void pinWrite(pinNo_t pinNo, uint8_t state);
|
|
|
|
|
|
|
|
|
|
// Initiates all the preriferals needed for the given pin
|
|
|
|
|
void pinInit(pinNo_t pinNo);
|
|
|
|
|
// Deactivates all the preriferals needed for the given pin
|
|
|
|
|
void pinDeInit(pinNo_t pinNo);
|
|
|
|
|
// Resets pin to default
|
|
|
|
|
void pinReset(pinNo_t pinNo);
|
|
|
|
|
|
|
|
|
|
// Dependeing on the platform an the form of information printing.
|
|
|
|
|
// Will pirnt tthe rurrent devices pin status and their configrarion.
|
|
|
|
|
void pinHardwareInfo(pinNo_t pinNo);
|
|
|
|
|
// Dependeing on the platfonr an the form of information printing.
|
|
|
|
|
// Handles the given error and stops all further execution.
|
|
|
|
|
void pinThrowError();
|
|
|
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
|