Serial Wombat Arduino Library

Loading...
Searching...
No Matches
Public Member Functions | Public Attributes | List of all members
PCB0041_Remcon Class Reference

A class representing a PCB0041 Remcon PCB. More...

`#include <PCB0041_Remcon.h>`

Inheritance diagram for PCB0041_Remcon:
[legend]
Collaboration diagram for PCB0041_Remcon:
[legend]

## Public Member Functions
| PCB0041_Remcon ()
int16_t | begin (uint8_t i2cAddress, uint16_t irTxAddress=0x1234, bool enableBlink=true)
| Initialize a PCB0048 Remcon pcb on a given I2C address.
Public Member Functions inherited from SerialWombatChip
void | configureDigitalPin (uint8_t pin, uint8_t highLow)
| Configure a pin to a digital state with the same parameters as Arduino's digitalWrite() function.
int16_t | initialize ()
| An internal function used to set up the Serial Wombat chip and this class. Call begin() instead of this function.
void | readUniqueIdentifier ()
| Read the unique identifier from the Serial Wombat chip and store it in uniqueIdentifier.
void | readDeviceIdentifier ()
| Read the device identifier from the Serial Wombat chip and store it in deviceIdentifier.
uint16_t | returnErrorCode (uint8_t *rx)
| Convert an ASCII Error code from a received packet into an integer error code.
| SerialWombatChip ()
int16_t | begin (HardwareSerial &serial, bool reset=true)
| initialize a Serial Wombat chip to use a Serial Interface.
int16_t | begin (uint8_t i2cAddress)
| initialize a Serial Wombat chip to use the default Wire I2C Interface and specified address.
int16_t | begin (TwoWire &wire, uint8_t i2cAddress, bool reset=true)
| initialize a Serial Wombat chip to use a specified I2C Interface and address.
| ~SerialWombatChip ()
int | sendPacket (uint8_t tx[], uint8_t rx[])
| Send an 8 byte packet to the Serial Wombat chip and wait for 8 bytes back.
int | sendPacket (uint8_t tx[])
| Send an 8 byte packet to the Serial Wombat chip.
int | sendPacket (uint8_t tx[], uint8_t rx[], bool retryIfEchoDoesntMatch, uint8_t beginningBytesToMatch=8, uint8_t endBytesToMatch=0)
| Send an 8 byte packet to the Serial Wombat chip and wait for 8 bytes back.
int | sendPacket (uint8_t tx[], bool retryIfEchoDoesntMatch)
| Send an 8 byte packet to the Serial Wombat chip.
int | sendPacketNoResponse (uint8_t tx[])
| Send an 8 byte packet to the Serial Wombat chip, don't wait for a response.
char * | readVersion (void)
| Request version string (combined model and firmware) and return pointer to it.
uint32_t | readVersion_uint32 (void)
| Request version as a uint32.
bool | isLatestFirmware (void)
| Check if the firmware is the latest version (or more precisely, if the firmware matches this verison of the Library)
uint16_t | readPublicData (uint8_t pin)
| Read the 16 Bit public data associated with a Serial Wombat Pin Mode.
uint16_t | readPublicData (SerialWombatDataSource dataSource)
| Read the 16 Bit public data associated with a Serial Wombat Pin Mode.
uint16_t | writePublicData (uint8_t pin, uint16_t value)
| Write a 16 bit value to a Serial Wombat pin Mode.
uint32_t | comparePublicDataToThreshold (uint16_t threshold=0)
uint16_t | readSupplyVoltage_mV (void)
| Measure the Serial Wombat chip's Supply voltage.
int16_t | readTemperature_100thsDegC (void)
| Measure the Serial Wombat chip's internal temperature.
void | hardwareReset ()
| Send a reset command to the Serial Wombat chip.
void | pinMode (uint8_t pin, uint8_t mode, bool pullDown=false, bool openDrain=false)
| Set a pin to INPUT or OUTPUT, with options for pull Ups and open Drain settings.
void | digitalWrite (uint8_t pin, uint8_t val)
| Set an output pin High or Low.
int | digitalRead (uint8_t pin)
| Reads the state of a Pin.
int | analogRead (uint8_t pin)
| Configures pin as analog input and does an immediate A/D conversion.
void | analogWrite (uint8_t pin, int val)
| Set a pin to PWM output.
bool | queryVersion ()
| Send a version request to the Serial Wombat chip.
uint32_t | readFramesExecuted ()
| Get the number of 1mS frames that have been executed since Serial Wombat chip reset.
uint16_t | readOverflowFrames ()
| Get the number of times an overflow Frame has occured.
void | jumpToBoot ()
| Jump to Bootloader and wait for a UART download of new firmware.
uint8_t | readRamAddress (uint16_t address)
| Read Address from RAM based on 16 bit address.
int16_t | writeRamAddress (uint16_t address, uint8_t value)
| Write byte to Address in RAM based on 16 bit address.
uint32_t | readFlashAddress (uint32_t address)
| Read Address from Flash based on 32 bit address.
int16_t | readUserBuffer (uint16_t index, uint8_t *buffer, uint16_t count)
| Read data from the Serial Wombat 18AB's internal RAM buffer.
void | sleep4B ()
| Shuts down most functions of the Serial Wombat 4B chip reducing power consumption.
void | sleep8B (uint16_t delay)
| Shuts down the Serial Wombat 8B chip reducing power consumption as low as 10uA.
void | wake ()
| Called to send a dummy packet to the Serial Wombat 8B chip to wake it from sleep and ready it for other commands.
bool | isSW04 ()
| Returns true if the instance received a model number corresponding to the Serial Wombat 18 series of chips at begin.
bool | isSW18 ()
| Returns true if the instance received a model number corresponding to the Serial Wombat 18 series of chips at begin.
bool | isSW08 ()
| Returns true if the instance received a model number corresponding to the Serial Wombat 08 series of chips at begin.
bool | isPinModeSupported (int pinMode)
| Check if a specific pin mode is supported by the firmware in the Serial Wombat chip. (8B and 18AB only)
bool | isPinModeSupported (SerialWombatPinMode_t pinMode)
| Check if a specific pin mode is supported by the firmware in the Serial Wombat chip. (8B and 18AB only)
int16_t | eraseFlashPage (uint32_t address)
| Erases a page in flash. Intended for use with the Bootloader, not by end users outside of bootloading sketch.
int16_t | writeFlashRow (uint32_t address)
| Writes a row in flash. Intended for use with the Bootloader, not by end users outside of bootloading sketc.
int16_t | setThroughputPin (uint8_t pin)
| Set a pin to be a throughput monitoring pin.
int16_t | setThroughputPin (uint32_t address)
| Set this chip Address (SW8B only)
int | writeUserBuffer (uint16_t index, uint8_t *buffer, uint16_t count)
| Write bytes to the User Memory Buffer in the Serial Wombat chip.
int | writeUserBuffer (uint16_t index, char *s)
| Write bytes to the User Memory Buffer in the Serial Wombat chip.
int | writeUserBuffer (uint16_t index, const char s[])
| Write bytes to the User Memory Buffer in the Serial Wombat chip.
int16_t | writeFrameTimerPin (uint8_t pin)
| Set a pin to be a frame timer for system utilization (SW18AB Only)
int16_t | readLastErrorCommand (uint8_t *cmd)
| Returns the last Serial Wombat command that produced a protocol error.
void | registerErrorHandler (SerialWombatErrorHandler_t handler)
| Registers an error handler that is called by the SerialWombatChip sendPacket() command when a protocol error is returned by the Serial Wombat.
int16_t | echo (uint8_t data[], uint8_t count=7)
| Echo a byte array back to the host. Used for testing and debugging.
int16_t | echo (char *data)
| Echo a byte array back to the host. Used for testing and debugging.
uint32_t | readBirthday ()
| Read the birthday of the Serial Wombat 18AB chip.
int16_t | readBrand (char *data)
| Read the brand of the Serial Wombat 18AB chip.

## Public Attributes
SerialWombatIRRx | irrx
SerialWombatIRTx | irtx
SerialWombatBlink | blink
Public Attributes inherited from SerialWombatChip
uint16_t | _supplyVoltagemV = 0
uint8_t | model [4] = { 0 }
| Contains the last model retreived by queryVersion() as a zero-terminated string.
uint8_t | fwVersion [4] = { 0 }
| Contains the last firmware Version retreived by queryVersion() as a zero-terminated string.
uint8_t | uniqueIdentifier [16]
uint8_t | uniqueIdentifierLength = 0
uint16_t | deviceIdentifier
uint16_t | deviceRevision
uint16_t | errorCount = 0
| Incremented every time a communication or command error is detected.
bool | inBoot = false
| Set to true if boot mode is indicated by a version query.
int16_t | lastErrorCode = 0
| The last error code returned as part of a protocol error message expressed as a positive integer.
uint32_t | sendReadyTime = 0
| Used as a countdown after a reset command is issued.
uint8_t | address = 0
| The I2C address of the SerialWombatChip instance.
uint8_t | communicationErrorRetries = 5
| How many times to retry a packet if communcation bus (such as I2C) error.

## Additional Inherited Members
Static Public Member Functions inherited from SerialWombatChip
static uint8_t | find (bool keepTrying=false)
| Search the I2C Bus addresses 0x68 to 0x6F for I2C devices, and test to see if they respond to Serial Wombat version commands. Returns first address that responds properly or 0 if none found.

## Detailed Description

A class representing a PCB0041 Remcon PCB.

The PCB0048_Mux class is a child class of SerialWombatChip. It initializes IR TX and RX and optionally connects Blink to RX. RX provides the current

Pin 3 is IR RX from the 38kHz demodulator Pin 6 and 7 go to an AND chip which drives an IR LED through a transistor. Pin 1 is connected to anode of a green LED and current limiting resistor. Pins 0,2, 4, and 5, are accessed like any othe Serial Wombat Pin. The Default firmware image loaded on this board at manufacturing supports the following pin modes: Digital I/O Analog Input Servo Output PWM Output

Pin modes are enabled with default parameters. If different parameters are desired, such as changing RX public data to button code then begin can be called again on that pin, such as irrx.begin (3, SerialWombatIRRx::publicDataOutput::COMMAND);

See examples for details

Other images can be loaded via the bootloader, but no other prebuilt images include IR functionality

See full documentation for this board at https://serialwombat.com/p41

A Tutorial video is also avaialble:

https://youtu.be/TODO

Definition at line 71 of file PCB0041_Remcon.h.

## Constructor & Destructor Documentation

## ◆ PCB0041_Remcon()

PCB0041_Remcon::PCB0041_Remcon | ( |  | ) |
| inline

Definition at line 74 of file PCB0041_Remcon.h.

## Member Function Documentation

## ◆ begin()

int16_t PCB0041_Remcon::begin | ( | uint8_t | i2cAddress,
|  | uint16_t | irTxAddress = 0x1234,
|  | bool | enableBlink = true )
| inline

Initialize a PCB0048 Remcon pcb on a given I2C address.

Wire must be initialized before calling this function

Parameters

  i2cAddress | The I2C address of the PCB
  irTxAddress | The 16 bit NEC address used to transmit codes
  blink | Whether to enable the LED on pin 1 to blink when IR commands are received

Returns
  Returns a negative number indicating an error code, or a non negative number indicating success

Definition at line 94 of file PCB0041_Remcon.h.

## Member Data Documentation

## ◆ blink

SerialWombatBlink PCB0041_Remcon::blink

Definition at line 79 of file PCB0041_Remcon.h.

## ◆ irrx

SerialWombatIRRx PCB0041_Remcon::irrx

Definition at line 77 of file PCB0041_Remcon.h.

## ◆ irtx

SerialWombatIRTx PCB0041_Remcon::irtx

Definition at line 78 of file PCB0041_Remcon.h.