|
Serial Wombat Arduino Library
|
A class representing a PCB0048 Mux PCB. More...
#include <PCB0048_Mux.h>


Public Member Functions | |
| PCB0048_Mux () | |
| int16_t | begin (uint8_t i2cAddress) |
| Initialize a PCB0048_Mux 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 | |
| SerialWombatDigitalOutput_18AB | bus1 |
| SerialWombatDigitalOutput_18AB | bus2 |
| SerialWombatDigitalOutput_18AB | bus3 |
| SerialWombatDigitalOutput_18AB | bus7 |
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. | |
A class representing a PCB0048 Mux PCB.
The PCB0048_Mux class is a child class of SerialWombatChip. It initializes all I2C bridge digital I/Os to disabled and provides methods for them.
Pins 1,2,3 and 7 are used to control the Pins 0, 4, 5, and 6 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 Quadrature Encoder Input PWM Output H Bridge Frequency Output
Other images can be loaded via the bootloader. The pins selected for Mux control were chosen so that the hardware UART pins remain free for use with the communications firmware build.
Each bus segment is enabled by writing 0xFFFF to the appropriate bus pin, and disabled by writing 0x0000 For example: bus3.writePublicData(0x0000); //Disable bus segment 3 bus2.writePublicData(0xFFFF); // Enable bus segment bus2
See full documentation for this board at https://serialwombat.com/p48
A Tutorial video is also avaialble:
Definition at line 70 of file PCB0048_Mux.h.
|
inline |
Definition at line 73 of file PCB0048_Mux.h.
|
inline |
Initialize a PCB0048_Mux pcb on a given I2C address.
Wire must be initialized before calling this function
| i2cAddress | The I2C address of the PCB |
Definition at line 89 of file PCB0048_Mux.h.
| SerialWombatDigitalOutput_18AB PCB0048_Mux::bus1 |
Definition at line 76 of file PCB0048_Mux.h.
| SerialWombatDigitalOutput_18AB PCB0048_Mux::bus2 |
Definition at line 76 of file PCB0048_Mux.h.
| SerialWombatDigitalOutput_18AB PCB0048_Mux::bus3 |
Definition at line 76 of file PCB0048_Mux.h.
| SerialWombatDigitalOutput_18AB PCB0048_Mux::bus7 |
Definition at line 76 of file PCB0048_Mux.h.