|
Serial Wombat Arduino Library
|
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>


Public Types | |
| enum | publicDataOutput { COMMAND = 0 , ADDRESS = 1 , DATACOUNT = 2 } |
Public Member Functions | |
| SerialWombatIRRx (SerialWombatChip &serialWombatChip) | |
| 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 () |
| Returns the number of bytes available in the SerialWombatIRRx queue. | |
| 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 () |
| Returns the address of the last received IR command. | |
| uint16_t | readDataCount () |
| Returns the total number of queued commands (rolls over at 65535) | |
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. | |
| void | setPinNumberForTesting (uint8_t pin) |
| A function designed for testing only. May have unpredictable results if used in real time. Not intended for general use. | |
Protected Attributes | |
| uint32_t | timeout = 1 |
Protected Attributes inherited from SerialWombatPin | |
| uint8_t | _pin = 255 |
| SerialWombatChip & | _sw |
| uint8_t | _pinMode = 0 |
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.
Definition at line 51 of file SerialWombatIRRx.h.
|
inline |
Constructor for the SerialWombatIRRx class.
| serialWombatChip | The Serial Wombat Chip on which the SerialWombatUART instance will run. |
Definition at line 62 of file SerialWombatIRRx.h.
|
inline |
Returns the number of bytes available in the SerialWombatIRRx queue.
Definition at line 126 of file SerialWombatIRRx.h.
|
inline |
Number of bytes avaialble to write to SerialWombatIRRx queue. Returns 0.
Definition at line 212 of file SerialWombatIRRx.h.
|
inline |
Initalize the SerialWombatIRRx.
| pin | The Serial Wombat pin number to use for the IR receiver |
| irMode | 0 for NEC protocol, other values reserved for future protocols |
| useRepeat | If true, queue value on repeat commands |
| activeState | The state of the pin which indicates an active IR signal (SW_LOW or SW_HIGH) |
| publicDataTimeoutPeriod_mS | The number of milliseconds to wait for the next byte to be received before timing out |
| publicDataTimeoutValue | The value to return when a timeout occurs |
| useAddressFilter | If true, only queue commands from the specified address |
| addressFilterValue | The address to filter on if useAddressFilter is true |
| dataOutput | The type of data to output (COMMAND, ADDRESS, or DATACOUNT) |
Definition at line 78 of file SerialWombatIRRx.h.
|
inline |
Discard all bytes from the SerialWombatIRRx queue.
Definition at line 157 of file SerialWombatIRRx.h.
|
inline |
used to allow reference copy. Not for user use.
Definition at line 292 of file SerialWombatIRRx.h.
|
inline |
Query the SerialWombatIRRx queue for the next avaialble byte, but don't remove it from the queue.
Definition at line 165 of file SerialWombatIRRx.h.
|
inline |
Reads a byte from the SerialWombatIRRx queue.
Definition at line 138 of file SerialWombatIRRx.h.
|
inline |
Returns the address of the last received IR command.
Definition at line 301 of file SerialWombatIRRx.h.
|
inline |
Reads a specified number of bytes from the SerialWombatIRRx queue queue.
| buffer | An array into which to put received bytes |
| length | The maximum number of bytes to be received |
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 227 of file SerialWombatIRRx.h.
|
inline |
Returns the total number of queued commands (rolls over at 65535)
Definition at line 315 of file SerialWombatIRRx.h.
|
inline |
implemented to fulfill Stream requirement.
Definition at line 276 of file SerialWombatIRRx.h.
|
inline |
Write bytes to the SerialWombatIRRx queue (Does nothing)
| buffer | An array of uint8_t bytes to send |
| size | the number of bytes to send |
This function exists to fully implement the Stream class. It throws away the bytes.
Definition at line 202 of file SerialWombatIRRx.h.
|
inline |
Write a byte to the SerialWombatIRRx queue (Does Nothing)
| data | Byte to write |
This function exists to fully implement the Stream class. It throws away the byte.
Definition at line 187 of file SerialWombatIRRx.h.
|
protected |
Definition at line 326 of file SerialWombatIRRx.h.