KM3NeT CLB  2.0
KM3NeT CLB v2 Embedded Software
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
gpio.h File Reference

GPIO Driver. More...

#include <stdint.h>
#include <stdbool.h>

Go to the source code of this file.

Macros

#define GPIO_AHRS_ENABLE   0
 Defines GPIO pins. More...
 
#define GPIO_BLINK_LED   1
 Led which blink to say I'm alive.
 
#define GPIO_SUICIDE   7
 Reset the CLB.
 

Enumerations

enum  GpioPinDir { gpioInput, gpioOutput }
 Defines direction of GPIO. More...
 

Functions

void gpioInit ()
 Initializes the GPIO. More...
 
void gpioPinConf (int pin, GpioPinDir dir)
 Configure PIN directionality. More...
 
void gpioPinSet (int pin, bool high)
 Sets the pin state. More...
 
bool gpioPinGet (int pin)
 Gets the PIN value, if set as input. More...
 
void gpioSetValue (uint32_t mask)
 Set the complete bitmask on the gpio pins. More...
 
uint32_t gpioGetValue ()
 Read all gpio pins at once. More...
 

Detailed Description

GPIO Driver.

Definition in file gpio.h.

Macro Definition Documentation

#define GPIO_AHRS_ENABLE   0

Defines GPIO pins.

Enable the Compass

Definition at line 42 of file gpio.h.

Enumeration Type Documentation

enum GpioPinDir

Defines direction of GPIO.

Enumerator
gpioInput 

GPIO is input.

gpioOutput 

GPIO is output.

Definition at line 33 of file gpio.h.

Function Documentation

uint32_t gpioGetValue ( )

Read all gpio pins at once.

Returns
The input of all ports as bit mask. 1 - high, 0 - low.

Definition at line 56 of file gpio.c.

void gpioInit ( )

Initializes the GPIO.

Sets all devices to output and off.

Definition at line 21 of file gpio.c.

void gpioPinConf ( int  pin,
GpioPinDir  dir 
)

Configure PIN directionality.

Parameters
pinThe pin number.
dirThe direction.

Definition at line 26 of file gpio.c.

bool gpioPinGet ( int  pin)

Gets the PIN value, if set as input.

Parameters
pinThe pin number.
Returns
The pin value.

Definition at line 45 of file gpio.c.

void gpioPinSet ( int  pin,
bool  high 
)

Sets the pin state.

Parameters
pinThe pin to set.
hightrue - Set it high (on), or false - off.

Definition at line 35 of file gpio.c.

void gpioSetValue ( uint32_t  mask)

Set the complete bitmask on the gpio pins.

Parameters
maskThe pins to set and clear (1 - set, 0 - clear).

Definition at line 50 of file gpio.c.