Interface for JeeNode Ports - see the wiki docs for JeeNodes and pinouts. More...
#include <Ports.h>
Public Member Functions | |
| Port (uint8_t num) | |
| Contructor for a Port. | |
| void | mode (uint8_t value) const |
| Set the pin mode of a Port's D pin. More... | |
| uint8_t | digiRead () const |
| Reads the value of a Port's D pin. More... | |
| void | digiWrite (uint8_t value) const |
| Write High or Low to a Port's D pin. More... | |
| void | anaWrite (uint8_t val) const |
| Writes a PWM value to a Port's D pin. | |
| uint32_t | pulse (uint8_t state, uint32_t timeout=1000000L) const |
| Applies the Arduino pulseIn() function on a Port's D pin. More... | |
| void | mode2 (uint8_t value) const |
| Set the pin mode of a Port's A pin. More... | |
| uint16_t | anaRead () const |
| Reads an analog value from a Port's A pin. More... | |
| uint8_t | digiRead2 () const |
| Reads the value of a Port's A pin. More... | |
| void | digiWrite2 (uint8_t value) const |
| Write High or Low to a Port's A pin. More... | |
| uint32_t | pulse2 (uint8_t state, uint32_t timeout=1000000L) const |
| Applies the Arduino pulseIn() function on a Port's A pin. More... | |
| void | shift (uint8_t bitOrder, uint8_t value) const |
| Does Arduino shiftOut() with data on D and clock on A pin of the Port. More... | |
| uint16_t | shiftRead (uint8_t bitOrder, uint8_t count=8) const |
| Shift a number of bites in to read them. More... | |
| void | shiftWrite (uint8_t bitOrder, uint16_t value, uint8_t count=8) const |
| The shiftWrite() call is similar but more general than the shift() call in that it allows an adjustable number of bits to be sent, not just 8. More... | |
Static Public Member Functions | |
| static void | mode3 (uint8_t value) |
| Set the pin mode of the I pin on all Ports. More... | |
| static uint8_t | digiRead3 () |
| Reads the value of the I pin on all Ports. More... | |
| static void | digiWrite3 (uint8_t value) |
| Writes the value of the I pin on all Ports. More... | |
| static void | anaWrite3 (uint8_t val) |
| Writes a PWM value to the I pin of all Ports. | |
Protected Member Functions | |
| uint8_t | digiPin () const |
| uint8_t | digiPin2 () const |
| uint8_t | anaPin () const |
Static Protected Member Functions | |
| static uint8_t | digiPin3 () |
Protected Attributes | |
| uint8_t | portNum |
| The port number is a small integer mathing the hardware port used. More... | |
Interface for JeeNode Ports - see the wiki docs for JeeNodes and pinouts.
The Ports class is a thin wrapper around the Arduino's digitalRead(), digitalWrite(), analogRead(), etc. functions. It was designed to simplify the use of the four standard port headers on JeeNodes.
|
inlineprotected |
|
inline |
Reads an analog value from a Port's A pin.
|
inlineprotected |
|
inlineprotected |
|
inlinestaticprotected |
|
inline |
Reads the value of a Port's D pin.
|
inline |
Reads the value of a Port's A pin.
|
inlinestatic |
Reads the value of the I pin on all Ports.
|
inline |
Write High or Low to a Port's D pin.
| value | High or Low. |
|
inline |
Write High or Low to a Port's A pin.
| value | High or Low. |
|
inlinestatic |
Writes the value of the I pin on all Ports.
| value | High or Low. |
|
inline |
|
inline |
|
inlinestatic |
Set the pin mode of the I pin on all Ports.
The mode3() function member sets the I/O direction of the IRQ pin associated with a specific port. Note that this is the same pin on all ports.
| value | INPUT or OUTPUT. |
|
inline |
Applies the Arduino pulseIn() function on a Port's D pin.
Measure the length of a pulse in microseconds on the DIO (pulse) or AIO (pulse2) line. The optional timeout value specifies how many microseconds to wait for a pulse - of none is received, 0 is returned.
| state | Polarity of the pulse to wait for - HIGH (1) or LOW (0). |
| timeout | Max number of microseconds to wait. Default is 1,000,000, i.e. 1 second. |
|
inline |
Applies the Arduino pulseIn() function on a Port's A pin.
|
inline |
Does Arduino shiftOut() with data on D and clock on A pin of the Port.
This can be used to send out a pulse sequence of bits or to read such a pulse sequence in. The AIO line is cycled while the value bits are "shifted" and written out to (shift, shiftWrite) or read in from (shiftRead) the DIO pin.
| bitOrder | How to shift bits in or out: either LSBFIRST (0) or MSBFIRST (1), where LSB stands for Least Significant Bit and MSB for Most Significant Bit. |
| value | The value to shift out, with as many lower bits as needed. This argument is a byte for shift() and a word for the more general shiftWrite() function. |
| uint16_t Port::shiftRead | ( | uint8_t | bitOrder, |
| uint8_t | count = 8 |
||
| ) | const |
Shift a number of bites in to read them.
| bitOrder | How to shift bits in or out: either LSBFIRST (0) or MSBFIRST (1), where LSB stands for Least Significant Bit and MSB for Most Significant Bit. |
| count | The number of bits to shift in or out. Must be in the range 1 .. 16, the default is 8. |
| void Port::shiftWrite | ( | uint8_t | bitOrder, |
| uint16_t | value, | ||
| uint8_t | count = 8 |
||
| ) | const |
The shiftWrite() call is similar but more general than the shift() call in that it allows an adjustable number of bits to be sent, not just 8.
| bitOrder | How to shift bits in or out: either LSBFIRST (0) or MSBFIRST (1), where LSB stands for Least Significant Bit and MSB for Most Significant Bit. |
| value | The value to shift out, with as many lower bits as needed. This argument is a byte for shift() and a word for the more general shiftWrite() function. |
| count | The number of bits to shift in or out. Must be in the range 1 .. 16, the default is 8. |
|
protected |
The port number is a small integer mathing the hardware port used.
Port 0 is special, it designates the I2C hardware pins on a JeeNode.