myWRIO
C++ framework for NationalInstruments myRIO
myRIO::DIO Class Reference

Digital input/output. More...

#include <DIO.h>

Static Public Member Functions

static void writeLed (int led, bool state)
 Write to a led. More...
 
static void writePin (int pin, bool state)
 Write to a pin. More...
 
static int readPin (int pin)
 Read the state of a pin. More...
 

Static Private Member Functions

static void parsePin (int pin, uint32_t *dirReg, uint32_t *pinsReg, bool io)
 Parses the necessary registers to read or write a pin. More...
 

Static Private Attributes

static uint8_t DOLED30_Status = 0
 Say LED2 is HIGH, so DOLED30 is 0100. More...
 

Detailed Description

Digital input/output.

Definition at line 85 of file DIO.h.

Member Function Documentation

◆ parsePin()

void DIO::parsePin ( int  pin,
uint32_t *  dirReg,
uint32_t *  pinsReg,
bool  io 
)
staticprivate

Parses the necessary registers to read or write a pin.

Parameters
pinthe concerned pin, one of A0, A1... C7
dirRegwill contain the direction register for the pin
pinsRegwill contain the port in/out register for the pin
ioone of IN/OUT

Definition at line 26 of file DIO.cpp.

◆ readPin()

int DIO::readPin ( int  pin)
static

Read the state of a pin.

Parameters
pinthe pin of the myRio that you want to read from
Returns
the state of the pin

Definition at line 83 of file DIO.cpp.

◆ writeLed()

void DIO::writeLed ( int  led,
bool  state 
)
static

Write to a led.

Parameters
ledthe led that you want to write to
statethe state of the led; 1 = HIGH , 0 = LOW
Examples
example_blink.cpp, and project_car.cpp.

Definition at line 12 of file DIO.cpp.

◆ writePin()

void DIO::writePin ( int  pin,
bool  state 
)
static

Write to a pin.

Parameters
pinthe pin of the myRio that you want to write to
statethe state of the pin; 1 = HIGH , 0 = LOW

Definition at line 49 of file DIO.cpp.

Member Data Documentation

◆ DOLED30_Status

uint8_t DIO::DOLED30_Status = 0
staticprivate

Say LED2 is HIGH, so DOLED30 is 0100.

If you set LED3 to HIGH, so 1000, without saving the other LEDs, you will only be able to use them one at a time.

Definition at line 92 of file DIO.h.


The documentation for this class was generated from the following files: