Serial Wombat Arduino Library
Loading...
Searching...
No Matches
SerialWombatIRRx Class Reference

A class for the Serial Wombat SW8B or SW18AB chips which received IR remote signals. Currently only NEC protocol is supported. More...

#include <SerialWombatIRRx.h>

Inheritance diagram for SerialWombatIRRx:
Collaboration diagram for SerialWombatIRRx:

Public Types

enum  publicDataOutput { COMMAND = 0 , ADDRESS = 1 , DATACOUNT = 2 }
 

Public Member Functions

 SerialWombatIRRx (SerialWombatChip &sw)
 Constructor for the SerialWombatIRRx class.
 
int16_t begin (uint8_t pin, uint8_t irMode=0, bool useRepeat=true, SerialWombatPinState_t activeState=SW_LOW, uint16_t publicDataTimeoutPeriod_mS=1000, uint16_t publicDataTimeoutValue=0xFFFF, bool useAddressFilter=false, uint16_t addressFilterValue=0x1234, SerialWombatIRRx::publicDataOutput dataOutput=SerialWombatIRRx::publicDataOutput::COMMAND)
 Initalize the SerialWombatIRRx.
 
int available ()
 
int read ()
 Reads a byte from the SerialWombatIRRx queue.
 
void flush ()
 Discard all bytes from the SerialWombatIRRx queue.
 
int peek ()
 Query the SerialWombatIRRx queue for the next avaialble byte, but don't remove it from the queue.
 
size_t write (uint8_t data)
 Write a byte to the SerialWombatIRRx queue (Does Nothing)
 
size_t write (const uint8_t *buffer, size_t size)
 Write bytes to the SerialWombatIRRx queue (Does nothing)
 
int availableForWrite ()
 Number of bytes avaialble to write to SerialWombatIRRx queue. Returns 0.
 
size_t readBytes (char *buffer, size_t length)
 Reads a specified number of bytes from the SerialWombatIRRx queue queue.
 
void setTimeout (long timeout_mS)
 implemented to fulfill Stream requirement.
 
SerialWombatIRRx operator= (SerialWombatIRRx &irrx)
 used to allow reference copy. Not for user use.
 
uint16_t readAddress ()
 
uint16_t readDataCount ()
 
- Public Member Functions inherited from SerialWombatPin
 SerialWombatPin (SerialWombatChip &serialWombatChip)
 Instantiates a Serial Wombat Pin.
 
 SerialWombatPin (SerialWombatChip &serialWombatChip, uint8_t pin)
 Instantiates a Serial Wombat Pin.
 
uint16_t readPublicData ()
 Read the 16 Bit public data associated with this pin.
 
void pinMode (uint8_t mode, bool pullDown=false, bool openDrain=false)
 Set pin to INPUT or OUTPUT, with options for pull Ups and open Drain settings.
 
void digitalWrite (uint8_t val)
 Set output pin High or Low.
 
int digitalRead ()
 Reads the state of the Pin.
 
uint16_t writePublicData (uint16_t value)
 Write a 16 bit value to this pin.
 
uint8_t pin ()
 Returns the current SW pin number. Used primarily for virtual calls by derived classes.
 
uint8_t swPinModeNumber ()
 Returns the Mode number. Used primarily by derived classes to populate packet data.
 
int16_t initPacketNoResponse (uint8_t packetNumber, uint8_t param0=0x55, uint8_t param1=0x55, uint8_t param2=0x55, uint8_t param3=0x55, uint8_t param4=0x55)
 
int16_t initPacketNoResponse (uint8_t packetNumber, uint16_t param0=0x55, uint8_t param1=0x55, uint8_t param2=0x55, uint8_t param3=0x55)
 
int16_t initPacketNoResponse (uint8_t packetNumber, uint16_t param0, uint16_t param1, uint8_t param2=0x55)
 
int16_t disable ()
 Disables the pin mode (if applicable)
 
int16_t enablePullup (bool enabled)
 Enables the weak pull up on a pin. Implemented on SW18AB and SW8B only.
 
int16_t enablePulldown (bool enabled)
 Enables the weak pull down on a pin. Implemented on SW18AB and SW8B only.
 
int16_t enableOpenDrain (bool enabled)
 Enables open drain mode on a pin. Implemented on SW18AB and SW8B only.
 
int16_t forceDMA (bool enabled)
 Forces use of DMA instead of hardware timing resources on SW18AB.
 

Protected Attributes

uint32_t timeout = 1
 
- Protected Attributes inherited from SerialWombatPin
uint8_t _pin = 255
 
SerialWombatChip_sw
 
uint8_t _pinMode = 0
 

Detailed Description

A class for the Serial Wombat SW8B or SW18AB chips which received IR remote signals. Currently only NEC protocol is supported.

A Tutorial video is avaialble:

COMING SOON

The class inherits from the Arduino Stream class, so queued button presses can be read like a Serial port.

Definition at line 47 of file SerialWombatIRRx.h.

Member Enumeration Documentation

◆ publicDataOutput

Enumerator
COMMAND 

The last 8 bit command received (address filtered if enabled)

ADDRESS 

the last 16 bit address received. Not Address filtered

DATACOUNT 

The number of data that have been queued (Affected by address filtering and repeat settings)

Definition at line 51 of file SerialWombatIRRx.h.

Constructor & Destructor Documentation

◆ SerialWombatIRRx()

SerialWombatIRRx::SerialWombatIRRx ( SerialWombatChip & sw)
inline

Constructor for the SerialWombatIRRx class.

Parameters
serialWombatThe Serial Wombat Chip on which the SerialWombatUART instance will run.

Definition at line 62 of file SerialWombatIRRx.h.

Member Function Documentation

◆ available()

int SerialWombatIRRx::available ( )
inline

Definition at line 125 of file SerialWombatIRRx.h.

◆ availableForWrite()

int SerialWombatIRRx::availableForWrite ( )
inline

Number of bytes avaialble to write to SerialWombatIRRx queue. Returns 0.

Returns
Zero. Writes are not suppored.

Definition at line 211 of file SerialWombatIRRx.h.

◆ begin()

int16_t SerialWombatIRRx::begin ( uint8_t pin,
uint8_t irMode = 0,
bool useRepeat = true,
SerialWombatPinState_t activeState = SW_LOW,
uint16_t publicDataTimeoutPeriod_mS = 1000,
uint16_t publicDataTimeoutValue = 0xFFFF,
bool useAddressFilter = false,
uint16_t addressFilterValue = 0x1234,
SerialWombatIRRx::publicDataOutput dataOutput = SerialWombatIRRx::publicDataOutput::COMMAND )
inline

Initalize the SerialWombatIRRx.

Parameters
controlPinKeypad scanning transitions will occur while this pin is being serviced by the Serial Wombat executive. Typically this will be the same as the row0 pin
row0pinpin attached to the topmost keypad row. On many marked keypads this row has 1,2,3 and A in it. Enter 255 if this column is unused
row1pinpin attached to the topcenter keypad row. On many marked keypads this row has 4,5,6 and B in it. Enter 255 if this row is unused
row2pinpin attached to the topmost keypad row. On many marked keypads this row has 7,8,9 and C in it. Enter 255 if this row is unused
row3pinpin attached to the topmost keypad row. On many marked keypads this row has *,0,# and D in it. Enter 255 if this row is unused
column0pinpin attached to the leftmost keypad column. On many marked keypads this column has 1,4,7 and * in it. Enter 255 if this column is unused
column1pinpin attached to the leftcenter keypad column. On many marked keypads this column has 1,5,8 and 0 in it. Enter 255 if this column is unused
column2pinpin attached to the rightcenter keypad column. On many marked keypads this column has 3,5,9 and # in it. Enter 255 if this column is unused
column3pinpin attached to the rightmost keypad column. On many marked keypads this column has A,B,C and D in it. Enter 255 if this column is unused
bufferMode0: Public data is Binary of 16 keys (Default) 1: Public data is last key index pressed 2: Public data is last key pressed or 16 for no key index 3: Public data is Ascii of last key pressed
queueMode0: Button presses are queued as indexes 1: Button Presses are queued as ASCII
rowTimingmS to delay after setting a pin row low before reading columns

Definition at line 80 of file SerialWombatIRRx.h.

◆ flush()

void SerialWombatIRRx::flush ( )
inline

Discard all bytes from the SerialWombatIRRx queue.

Definition at line 156 of file SerialWombatIRRx.h.

◆ operator=()

SerialWombatIRRx SerialWombatIRRx::operator= ( SerialWombatIRRx & irrx)
inline

used to allow reference copy. Not for user use.

Definition at line 291 of file SerialWombatIRRx.h.

◆ peek()

int SerialWombatIRRx::peek ( )
inline

Query the SerialWombatIRRx queue for the next avaialble byte, but don't remove it from the queue.

Returns
A byte from 0-255, or -1 if no bytes were avaialble

Definition at line 164 of file SerialWombatIRRx.h.

◆ read()

int SerialWombatIRRx::read ( )
inline

Reads a byte from the SerialWombatIRRx queue.

Returns
A byte from 0-255, or -1 if no bytes were avaialble

Definition at line 137 of file SerialWombatIRRx.h.

◆ readAddress()

uint16_t SerialWombatIRRx::readAddress ( )
inline

Definition at line 297 of file SerialWombatIRRx.h.

◆ readBytes()

size_t SerialWombatIRRx::readBytes ( char * buffer,
size_t length )
inline

Reads a specified number of bytes from the SerialWombatIRRx queue queue.

Parameters
bufferAn array into which to put received bytes
lengthThe maximum number of bytes to be received
Returns
the number of bytes written to buffer

This function will read bytes from the SerialWombatIRRx queue into buffer. If 'length' characters are not available to read then the value returned will be less than length.

Definition at line 226 of file SerialWombatIRRx.h.

◆ readDataCount()

uint16_t SerialWombatIRRx::readDataCount ( )
inline

Definition at line 308 of file SerialWombatIRRx.h.

◆ setTimeout()

void SerialWombatIRRx::setTimeout ( long timeout_mS)
inline

implemented to fulfill Stream requirement.

Definition at line 275 of file SerialWombatIRRx.h.

◆ write() [1/2]

size_t SerialWombatIRRx::write ( const uint8_t * buffer,
size_t size )
inline

Write bytes to the SerialWombatIRRx queue (Does nothing)

Parameters
bufferAn array of uint8_t bytes to send
sizethe number of bytes to send
Returns
the number of bytes sent

This function exists to fully implement the Stream class. It throws away the bytes.

Definition at line 201 of file SerialWombatIRRx.h.

◆ write() [2/2]

size_t SerialWombatIRRx::write ( uint8_t data)
inline

Write a byte to the SerialWombatIRRx queue (Does Nothing)

Parameters
dataByte to write
Returns
Number of bytes written

This function exists to fully implement the Stream class. It throws away the byte.

Definition at line 186 of file SerialWombatIRRx.h.

Member Data Documentation

◆ timeout

uint32_t SerialWombatIRRx::timeout = 1
protected

Definition at line 319 of file SerialWombatIRRx.h.