#include <gpio.hpp>

Public Member Functions

 GPIO (LPC1758_GPIO_Type gpioId)
Constructor to choose the pin. More...
 
 ~GPIO ()
Destructor that will destroy the pin configuration. More...
 
void enablePullUp ()
Enables pull-up resistor. More...
 
void enablePullDown ()
Enables pull-down resistor. More...
 
void disablePullUpPullDown ()
Disables pull-up/down resistor. More...
 
void enableOpenDrainMode (bool openDrain=true)
Enables open drain mode. More...
 
void setAsInput (void)
Sets pin as input pin. More...
 
void setAsOutput (void)
Sets pin as output pin. More...
 
bool read (void) const
Reads logical value of the pin. More...
 
void setHigh (void)
Sets the pin to logical HIGH (3.3v) More...
 
void setLow (void)
Sets the pin to logical LOW (0.0v) More...
 
void set (bool on)
Set high/low based on boolean value. More...
 
void toggle (void)
Toggles the state of the GPIO. More...
 

Detailed Description

GPIO class for SJ-One Board or any LPC17xx CPU The pins on the SJ-One Board can be used as General Purpose Input/Output pins which can be attached to for example an LED or a switch externally.

Please see the pin labels on the board and then use this class to manipulate the pin(s). See the next examples :

Output pin example :

GPIO myPin(P1_19); // Control P1.19
myPin.setAsOutput(); // Use the pin as output pin
myPin.setHigh(); // Pin will now be at 3.3v
myPin.setLow(); // Pin will now be at 0.0v

Input pin example :

GPIO myPin(P1_20); // Control P1.20
myPin.setAsInput(); // Use the pin as output pin
bool value = myPin.read(); // Read value of the pin

Constructor & Destructor Documentation

GPIO::GPIO ( LPC1758_GPIO_Type  gpioId)

Constructor to choose the pin.

GPIO::~GPIO ( )

Destructor that will destroy the pin configuration.

Member Function Documentation

void GPIO::disablePullUpPullDown ( )

Disables pull-up/down resistor.

void GPIO::enableOpenDrainMode ( bool  openDrain = true)

Enables open drain mode.

void GPIO::enablePullDown ( )

Enables pull-down resistor.

void GPIO::enablePullUp ( )

Enables pull-up resistor.

bool GPIO::read ( void  ) const

Reads logical value of the pin.

void GPIO::set ( bool  on)

Set high/low based on boolean value.

void GPIO::setAsInput ( void  )

Sets pin as input pin.

Simple functions

void GPIO::setAsOutput ( void  )

Sets pin as output pin.

void GPIO::setHigh ( void  )

Sets the pin to logical HIGH (3.3v)

void GPIO::setLow ( void  )

Sets the pin to logical LOW (0.0v)

void GPIO::toggle ( void  )

Toggles the state of the GPIO.


The documentation for this class was generated from the following files:
  • /var/www/html/SJSU-DEV-Linux/firmware/default/lib/L4_IO/gpio.hpp
  • /var/www/html/SJSU-DEV-Linux/firmware/default/lib/L4_IO/src/gpio.cpp