 |
Serial Wombat Arduino Library
|
Go to the documentation of this file. 1 #ifndef SERIAL_WOMBAT_H__
2 #define SERIAL_WOMBAT_H__
40 #define SW_LE16(_a) (uint8_t)((_a) & 0xFF), (uint8_t)((_a) >>8)
44 #define SW_LE32(_a) (uint8_t)((_a) & 0xFF), (uint8_t)((_a) >>8) , (uint8_t)((_a) >>16), (uint8_t)((_a) >>24)
174 #define ERROR_HOST_INCORRECT_NUMBER_BYTES_WRITTEN 0x10000
175 #define ERROR_HOST_DATA_TOO_LONG 0x10001
176 #define ERROR_HOST_NACK_ADDRESS 0x10002
177 #define ERROR_HOST_NACK_DATA 0x10003
178 #define ERROR_HOST_OTHER_I2C_ERROR 0x10004
180 #define WOMBAT_MAXIMUM_PINS 20
285 char version[8] = { 0 };
286 HardwareSerial * Serial = NULL;
287 TwoWire* i2cInterface = NULL;
292 bool _asleep =
false;
293 void configureDigitalPin(uint8_t pin, uint8_t highLow)
295 uint8_t tx[8] = { 200,pin,0,0,0,0,0,0x55 };
297 switch (_pinmode[pin])
310 else if (highLow == HIGH)
331 tx[6] = _openDrain[pin];
332 tx[5] = _pullDown[pin];
335 uint32_t sendReadyTime = 0;
338 int16_t retvalue = -1;
342 readUniqueIdentifier();
343 readDeviceIdentifier();
347 void readUniqueIdentifier()
350 if (version[0] ==
'S' && version[1] ==
'0' && version[2] ==
'4')
378 void readDeviceIdentifier()
380 if (version[0] ==
'S' && version[1] ==
'0' && version[2] ==
'4')
397 uint16_t returnErrorCode(uint8_t* rx)
399 uint16_t result = rx[1] -
'0';
401 result += rx[2] -
'0';
403 result += rx[3] -
'0';
405 result += rx[4] -
'0';
407 result += rx[5] -
'0';
413 bool _currentlyCommunicating =
false;
426 int16_t
begin(HardwareSerial &serial);
440 int16_t
begin(HardwareSerial& serial,
bool reset);
451 int16_t
begin(uint8_t i2cAddress);
466 auto begin(TwoWire& wire, uint8_t i2cAddress,
bool reset =
true) ->
468 i2cInterface = &wire;
471 Wire.beginTransmission(i2cAddress);
472 int error = Wire.endTransmission();
483 sendReadyTime = millis() + 1000;
529 int sendPacket(uint8_t tx[], uint8_t rx[],
bool retryIfEchoDoesntMatch, uint8_t beginningBytesToMatch = 8, uint8_t endBytesToMatch = 0);
539 int sendPacket(uint8_t tx[],
bool retryIfEchoDoesntMatch);
562 uint8_t tx[] = {
'V',0x55,0x55,0x55,0x55,0x55,0x55,0x55 };
565 memcpy(version, &rx[1], 7);
567 memcpy(
model, &rx[1], 3);
584 return ((((uint32_t)
fwVersion[0]) << 16) |
600 uint8_t tx[] = { 0x81,pin,255,255,0x55,0x55,0x55,0x55 };
603 return(rx[2] + (uint16_t)rx[3] * 256);
627 uint8_t tx[] = { 0x82,pin,(uint8_t)(value & 0xFF),(uint8_t)(value >> 8) ,255,0x55,0x55,0x55 };
630 return (rx[2] + rx[3] * 256);
654 uint32_t mv = 1024 * 65536 / counts;
683 result = result - 65536;
685 return ((int16_t)result);
701 uint8_t tx[9] =
"ReSeT!#*";
714 void pinMode(uint8_t pin, uint8_t mode,
bool pullDown =
false,
bool openDrain =
false)
720 _pullDown[pin] = openDrain;
721 _openDrain[pin] = openDrain;
722 _pinmode[pin] = mode;
723 configureDigitalPin(pin, mode);
735 configureDigitalPin(pin, val);
785 uint8_t dutyCycleLow = 0;
807 uint8_t tx[8] = {
'V',0x55,0x55,0x55,0x55,0x55,0x55,0x55 };
810 if (rx[0] ==
'V' && (rx[1] ==
'S' || rx[1] ==
'B'))
835 uint8_t tx[8] = { 0x81,67,68,0x55,0x55,0x55,0x55,0x55 };
838 uint32_t returnval = rx[2] + (((uint32_t)rx[3]) << 8) + (((uint32_t)rx[4]) << 16) + (((uint32_t)rx[5]) << 24);
866 uint8_t tx[] =
"BoOtLoAd";
892 uint8_t tx[8] = { 0xA0,
SW_LE16(
address),0x55,0x55,0x55,0x55,0x55 };
944 return(((uint32_t)rx[4]) + (((uint32_t)rx[5]) <<8) + (((uint32_t)rx[6]) <<16) + (((uint32_t)rx[7]) <<24));
959 uint8_t tx[8] = {
'S',
'l',
'E',
'e',
'P',
'!',
'#',
'*'};
967 uint8_t tx[8] = {
'!',
'!',
'!',
'!',
'!',
'!',
'!',
'!' };
1066 uint16_t bytesSent = 0;
1073 uint8_t bytesToSend = 4;
1076 bytesToSend = (uint8_t)count;
1084 uint8_t tx[8] = { 0x84,
SW_LE16(index), bytesToSend,0x55,0x55,0x55,0x55 };
1088 for (i = 0; i < bytesToSend; ++i)
1090 tx[4 + i] = buffer[i];
1097 bytesSent = bytesToSend;
1103 uint8_t tx[8] = { 0x85,0x55,0x55,0x55,0x55,0x55,0x55,0x55 };
1106 for (i = 0; i < 7; ++i)
1108 tx[1 + i] = buffer[bytesSent + i];
1121 uint8_t bytesToSend = 4;
1124 bytesToSend = (uint8_t)count;
1132 uint8_t tx[8] = { 0x84,
SW_LE16(index + bytesSent), bytesToSend,0x55,0x55,0x55,0x55 };
1136 for (i = 0; i < bytesToSend; ++i)
1138 tx[4 + i] = buffer[i + bytesSent];
1145 bytesSent += bytesToSend;
1187 uint16_t bytesRead = 0;
1188 while (bytesRead < count)
1195 for (
int i = 1; i < 8; ++i)
1197 buffer[bytesRead] = rx[i];
1199 if (bytesRead >= count)
1220 uint8_t tx[] = { 0xA6,0,0xB2, 0xA5, 0x61, 0x73, 0xF8 ,0xA2 };
1239 uint8_t tx[] = { 0xB3,0,(uint8_t)
'C', (uint8_t)
'A', (uint8_t)
'P',(uint8_t)
'T',(uint8_t)
'U',(uint8_t)
'R' };
1249 uint8_t tx[] = { 0xB3,1,(uint8_t)
'C', (uint8_t)
'A', (uint8_t)
'P',(uint8_t)
'T',(uint8_t)
'U',(uint8_t)
'R' };
1267 uint8_t tx[] = { 0xB3,2,(uint8_t)
'C', (uint8_t)
'A', (uint8_t)
'P',(uint8_t)
'T',(uint8_t)
'U',(uint8_t)
'R' };
1297 static uint8_t
find(
bool keepTrying =
false)
1301 for (
int i2cAddress = 0x68; i2cAddress <= 0x6F; ++i2cAddress)
1303 Wire.beginTransmission(i2cAddress);
1304 int error = Wire.endTransmission();
1309 uint8_t tx[8] = {
'V',0x55,0x55,0x55,0x55,0x55,0x55,0x55 };
1311 Wire.beginTransmission(i2cAddress);
1313 Wire.endTransmission();
1314 Wire.requestFrom((uint8_t)i2cAddress, (uint8_t)8);
1317 while (Wire.available() && count < 8)
1319 rx[count] = Wire.read();
1324 if (rx[0] ==
'V' && rx[1] ==
'S')
1332 }
while (keepTrying);
1351 for (
int i = 1; i < 8; ++i)
1378 errorHandler = handler;
1387 int16_t
echo(uint8_t data[], uint8_t count = 7)
1389 uint8_t tx[] =
"!UUUUUUU";
1390 for (
int i = 0; i < 7 && i < count; ++i)
1392 tx[i + 1] = (uint8_t)data[i];
1400 int length = strlen(data);
1401 uint8_t tx[] =
"!UUUUUUU";
1402 for (
int i = 0; i < 7 && i < length; ++i)
1404 tx[i + 1] = (uint8_t)data[i];
1430 for (
int i = 0; i < 32; ++i)
1433 if ((val & 0xFF) != 0xFF)
1435 data[i ] = (char)(val & 0xFF);
1511 void pinMode(uint8_t mode,
bool pullDown =
false,
bool openDrain =
false)
@ SW_DATA_SOURCE_1HZ_SAW
(168) Sawtooth wave that goes from 0 to 65535 to 0 every 1024 frames
@ CONFIGURE_PIN_MODE10
(210)
@ CMD_READ_BUFFER_ASCII
('G')
int16_t writeFrameTimerPin(uint8_t pin)
Set a pin to be a frame timer for system utilization (SW18AB Only)
Definition: SerialWombat.h:1283
Class for a Serial Wombat chip. Each Serial Wombat chip on a project should have its own instance.
Definition: SerialWombat.h:279
int16_t begin(HardwareSerial &serial)
initialize a Serial Wombat chip to use a Serial Interface.
Definition: SerialWombat.cpp:41
@ PIN_MODE_ANALOGINPUT
(2)
Definition: SerialWombat.h:240
@ COMMAND_READ_LAST_ERROR_PACKET
(0xA7)
@ COMMAND_ENABLE_2ND_UART
(0xA6)
void jumpToBoot()
Jump to Bootloader and wait for a UART download of new firmware.
Definition: SerialWombat.h:864
@ SW_DATA_SOURCE_PIN_8
(8) 16 bit public data provided by Pin 8
int writeUserBuffer(uint16_t index, char *s)
Write bytes to the User Memory Buffer in the Serial Wombat chip.
Definition: SerialWombat.h:1160
@ PIN_MODE_PULSE_ON_CHANGE
(25)
Definition: SerialWombat.h:259
@ PIN_MODE_SW18AB_CAPTOUCH
(22)
Definition: SerialWombat.h:256
@ PIN_MODE_HS_CLOCK
Definition: SerialWombat.h:263
@ PIN_MODE_UART1_RX_TX
(23)
Definition: SerialWombat.h:257
@ COMMAND_BINARY_QUEUE_INFORMATION
(0x94)
@ PIN_MODE_DEBOUNCE
(10)
Definition: SerialWombat.h:246
@ SW_DATA_SOURCE_1024mvCounts
(66) The number of ADC counts that result from a 1.024V reading
@ CONFIGURE_PIN_MODE0
(200)
void(* SerialWombatErrorHandler_t)(uint16_t errorNumber, SerialWombatChip *sw)
Definition: SerialWombat.h:272
@ COMMAND_UART0_RX_7BYTES
(0xB1)
int16_t lastErrorCode
The last error code returned as part of a protocol error message expressed as a positive integer.
Definition: SerialWombat.h:1337
uint16_t readPublicData(SerialWombatDataSource dataSource)
Read the 16 Bit public data associated with a Serial Wombat Pin Mode.
Definition: SerialWombat.h:615
@ SW_DATA_SOURCE_PIN_9
(9) 16 bit public data provided by Pin 9
int digitalRead(uint8_t pin)
Reads the state of a Pin / /.
Definition: SerialWombat.h:743
int sendPacketNoResponse(uint8_t tx[])
Send an 8 byte packet to the Serial Wombat chip, don't wait for a response.
Definition: SerialWombat.cpp:315
SerialWombatPinMode_t
Definition: SerialWombat.h:237
int analogRead(uint8_t pin)
Configures pin as analog input and does an immediate A/D conversion.
Definition: SerialWombat.h:764
SerialWombatPin(SerialWombatChip &serialWombatChip)
Instantiates a Serial Wombat Pin.
Definition: SerialWombat.h:1477
uint8_t swPinModeNumber()
Returns the Mode number. Used primarily by derived classes to populate packet data.
Definition: SerialWombat.h:1559
@ SW_DATA_SOURCE_LFSR
(78) A Linear Feedback Shift Register that produces a Pseudo random sequence of 16 bit values
@ SW_DATA_SOURCE_PIN_15
(15) 16 bit public data provided by Pin 15
SerialWombatChip & _sw
Definition: SerialWombat.h:1566
@ SW_DATA_SOURCE_PIN_16_MV
(116) Pin 16 public output expressed in mV (for analog modes only)
@ CONFIGURE_PIN_MODE7
(207)
void analogWrite(uint8_t pin, int val)
Set a pin to PWM output.
Definition: SerialWombat.h:783
@ PIN_MODE_WATCHDOG
(7)
Definition: SerialWombat.h:244
@ PIN_MODE_CONTROLLED
(1)
Definition: SerialWombat.h:239
@ PIN_MODE_SW_UART
(13)
Definition: SerialWombat.h:249
bool queryVersion()
Send a version request to the Serial Wombat chip.
Definition: SerialWombat.h:805
int16_t setThroughputPin(uint8_t pin)
Set a pin to be a throughput monitoring pin.
Definition: SerialWombat.h:1051
int16_t enable2ndCommandInterface(bool enabled=true)
Enable UART command interface in addition to I2C (SW18AB Only)
Definition: SerialWombat.h:1218
@ PIN_MODE_PS2KEYBOARD
(32)
Definition: SerialWombat.h:266
uint16_t writePublicData(uint16_t value)
Write a 16 bit value to this pin.
Definition: SerialWombat.h:1546
uint16_t readSupplyVoltage_mV(void)
Measure the Serial Wombat chip's Supply voltage.
Definition: SerialWombat.h:643
@ CONFIGURE_PIN_MODE3
(203)
bool inBoot
Set to true if boot mode is indicated by a version query.
Definition: SerialWombat.h:1040
uint16_t _supplyVoltagemV
Definition: SerialWombat.h:1004
@ PIN_MODE_RESISTANCEINPUT
(24)
Definition: SerialWombat.h:258
uint32_t readFramesExecuted()
Get the number of 1mS frames that have been executed since Serial Wombat chip reset.
Definition: SerialWombat.h:833
@ SW_DATA_SOURCE_2SEC_SAW
(171)Sawtooth wave that goes from 0 to 65535 to 0 every 2048 frames
@ SW_DATA_SOURCE_VBG_COUNTS_VS_VREF
(76) A/D conversion of VBG against VRef . Used for mfg calibration
@ PIN_MODE_TM1637
(11)
Definition: SerialWombat.h:247
void wake()
Called to send a dummy packet to the Serial Wombat chip to wake it from sleep and ready it for other ...
Definition: SerialWombat.h:965
@ SW_DATA_SOURCE_PIN_17_MV
(117) Pin 17 public output expressed in mV (for analog modes only)
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.
Definition: SerialWombat.h:714
@ PIN_MODE_PWM
(16)
Definition: SerialWombat.h:252
@ SW_DATA_SOURCE_2HZ_SAW
(165) Sawtooth wave that goes from 0 to 65535 to 0 every 512 frames
@ COMMAND_BINARY_WRITE_RAM
(0xA3)
@ COMMAND_BINARY_WRITE_USER_BUFFER
(0x84)
@ CONFIGURE_PIN_MODE8
(208)
@ COMMAND_UART1_TX_7BYTES
(0xB2)
@ SW_DATA_SOURCE_PIN_4_MV
(104) Pin 4 public output expressed in mV (for analog modes only)
@ PIN_MODE_SERVO
(3)
Definition: SerialWombat.h:241
@ SW_DATA_SOURCE_SYSTEM_UTILIZATION
(74) A number between 0 and 65535 that scales to the average length of pin processing frames between ...
@ COMMAND_BINARY_QUEUE_READ_BYTES
(0x93)
@ CONFIGURE_PIN_MODE4
(204)
void SerialWombatSerialErrorHandlerBrief(uint16_t error, SerialWombatChip *sw)
a sample error handler that can be registered with registerErrorHandler to report protocol errors on ...
Definition: SerialWombat.cpp:385
SerialWombatChip()
Definition: SerialWombat.cpp:30
@ SW_DATA_SOURCE_65SEC_SAW
(177 )Sawtooth wave that goes from 0 to 65535 to 0 every 65536 frames
void hardwareReset()
Send a reset command to the Serial Wombat chip.
Definition: SerialWombat.h:699
@ PIN_MODE_PULSETIMER
(18)
Definition: SerialWombat.h:254
uint8_t uniqueIdentifierLength
Definition: SerialWombat.h:1023
int digitalRead()
Reads the state of the Pin.
Definition: SerialWombat.h:1536
int16_t eraseFlashPage(uint32_t address)
Erases a page in flash. Intended for use with the Bootloader, not by end users outside of bootloading...
Definition: SerialWombat.h:978
int16_t readLastErrorCommand(uint8_t *cmd)
Returns the last Serial Wombat command that produced a protocol error.
Definition: SerialWombat.h:1345
@ SW_DATA_SOURCE_NONE
(255 ) Used to mean "No Source Selected"
@ SW_HIGH
Definition: SerialWombat.h:50
@ SW_DATA_SOURCE_PIN_2
(2) 16 bit public data provided by Pin 2
@ SW_DATA_SOURCE_FRAMES_RUN_LSW
(67) The number of frames run since reset, least significant 16 bits
@ SW_DATA_SOURCE_DROPPED_FRAMES
(73) The number of times since reset that a frame ran so far behind that it crossed two subsequent 1m...
@ COMMAND_BINARY_WRITE_USER_BUFFER_CONTINUE
(0x85)
@ SW_DATA_SOURCE_VCC_mVOLTS
(75) The system source voltage in mV
void digitalWrite(uint8_t pin, uint8_t val)
Set an output pin High or Low.
Definition: SerialWombat.h:733
@ SW_DATA_SOURCE_TEMPERATURE
(70)The internal core temperature expressed in 100ths deg C
@ CMD_SET_BUFFER_ASCII
('S')
SerialWombatPin(SerialWombatChip &serialWombatChip, uint8_t pin)
Instantiates a Serial Wombat Pin.
Definition: SerialWombat.h:1486
@ SW_DATA_SOURCE_PIN_14
(14) 16 bit public data provided by Pin 14
@ PIN_MODE_MATRIX_KEYPAD
(15)
Definition: SerialWombat.h:251
@ SW_DATA_SOURCE_PIN_0_MV
(100) Pin 0 public output expressed in mV (for analog modes only)
int readUserBuffer(uint16_t index, uint8_t *buffer, uint16_t count)
Read bytes from the User Memory Buffer in the Serial Wombat chip.
Definition: SerialWombat.h:1185
uint16_t readOverflowFrames()
Get the number of times an overflow Frame has occured.
Definition: SerialWombat.h:850
@ CONFIGURE_PIN_MODE9
(209)
uint16_t deviceIdentifier
Definition: SerialWombat.h:1029
@ SW_DATA_SOURCE_8SEC_SAW
(174)Sawtooth wave that goes from 0 to 65535 to 0 every 8192 frames
SerialWombatCommands
Definition: SerialWombat.h:182
#define SW_LE32(_a)
Convert a uint32_t to four bytes in little endian format for array initialization.
Definition: SerialWombat.h:44
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 ...
Definition: SerialWombat.h:1297
uint16_t readPublicData(uint8_t pin)
Read the 16 Bit public data associated with a Serial Wombat Pin Mode.
Definition: SerialWombat.h:598
Describes a Serial Wombat Pin. Is base class for other pin modes.
Definition: SerialWombat.h:1470
@ SW_DATA_SOURCE_PIN_0
(0) 16 bit public data provided by Pin 0
@ PIN_MODE_HS_COUNTER
< (29)
Definition: SerialWombat.h:264
uint32_t readFlashAddress(uint32_t address)
Read Address from Flash based on 32 bit address.
Definition: SerialWombat.h:939
int16_t readTemperature_100thsDegC(void)
Measure the Serial Wombat chip's internal temperature.
Definition: SerialWombat.h:676
uint8_t uniqueIdentifier[16]
Definition: SerialWombat.h:1017
#define WOMBAT_MAXIMUM_PINS
Definition: SerialWombat.h:180
@ CONFIGURE_CHANNEL_MODE_HW_3
(223)
int16_t writeFlashRow(uint32_t address)
Writes a row in flash. Intended for use with the Bootloader, not by end users outside of bootloading ...
Definition: SerialWombat.h:989
uint16_t errorCount
Incremented every time a communication or command error is detected.
Definition: SerialWombat.h:1037
uint8_t readRamAddress(uint16_t address)
Read Address from RAM based on 16 bit address.
Definition: SerialWombat.h:890
uint8_t _pinMode
Definition: SerialWombat.h:1567
uint32_t readBirthday()
Definition: SerialWombat.h:1409
@ SW_DATA_SOURCE_PIN_3
(3) 16 bit public data provided by Pin 3
int16_t writeRamAddress(uint16_t address, uint8_t value)
Write byte to Address in RAM based on 16 bit address.
Definition: SerialWombat.h:918
@ COMMAND_BINARY_READ_FLASH
(0xA1)
@ SW_DATA_SOURCE_PACKETS_RECEIVED
(71) The nubmer of incoming command packets that have been processed since reset (rolls over at 65535...
@ CONFIGURE_CHANNEL_MODE_HW_2
(222)
int sendPacket(uint8_t tx[], uint8_t rx[])
Send an 8 byte packet to the Serial Wombat chip and wait for 8 bytes back.
Definition: SerialWombat.cpp:139
auto begin(TwoWire &wire, uint8_t i2cAddress, bool reset=true) -> int16_t
initialize a Serial Wombat chip to use a specified I2C Interface and address.
Definition: SerialWombat.h:466
@ CONFIGURE_PIN_MODE_HW_0
(220)
@ PIN_MODE_WS2812
(12)
Definition: SerialWombat.h:248
@ PIN_MODE_UNKNOWN
(0xFF)
Definition: SerialWombat.h:267
@ COMMAND_CALIBRATE_ANALOG
(0xA5)
@ SW_DATA_SOURCE_PIN_10
(10) 16 bit public data provided by Pin 10
@ COMMAND_BINARY_WRITE_FLASH
(0xA4)
uint16_t deviceRevision
Definition: SerialWombat.h:1035
uint16_t readPublicData()
Read the 16 Bit public data associated with this pin.
Definition: SerialWombat.h:1497
@ SW_DATA_SOURCE_PIN_16
(16) 16 bit public data provided by Pin 16
@ SW_DATA_SOURCE_PIN_1
(1) 16 bit public data provided by Pin 1
@ SW_DATA_SOURCE_2SEC_SQUARE
(170)Square wave that alternates between 0 and 65535 every 1024 frames
void sleep()
Shuts down most functions of the Serial Wombat chip reducing power consumption.
Definition: SerialWombat.h:957
uint16_t writePublicData(uint8_t pin, uint16_t value)
Write a 16 bit value to a Serial Wombat pin Mode.
Definition: SerialWombat.h:625
@ SW_DATA_SOURCE_FRAMES_RUN_MSW
(68) The number of frames run since reset, most significant 16 bits
int writeUserBuffer(uint16_t index, uint8_t *buffer, uint16_t count)
Write bytes to the User Memory Buffer in the Serial Wombat chip.
Definition: SerialWombat.h:1064
@ SW_DATA_SOURCE_PIN_3_MV
(103) Pin 3 public output expressed in mV (for analog modes only)
SerialWombatPinState_t
Definition: SerialWombat.h:47
@ CONFIGURE_PIN_OUTPUTSCALE
(210)
char * readVersion(void)
Request version string (combined model and firmware) and return pointer to it.
Definition: SerialWombat.h:560
@ COMMAND_BINARY_CONFIGURE
(0x9F)
uint32_t readVersion_uint32(void)
Request version as a uint32.
Definition: SerialWombat.h:581
uint8_t fwVersion[4]
Contains the last firmware Version retreived by queryVersion() as a zero-terminated string.
Definition: SerialWombat.h:1010
@ SW_INPUT
Definition: SerialWombat.h:51
~SerialWombatChip()
Definition: SerialWombat.cpp:36
uint8_t pin()
Returns the current SW pin number. Used primarily for virtual calls by derived classes.
Definition: SerialWombat.h:1553
int16_t echo(char *data)
Definition: SerialWombat.h:1398
@ SW_DATA_SOURCE_INCREMENTING_NUMBER
(65) An number that increments each time it is accessed.
This class name is depricated. Do not use for new development. Use SerialWombatChip instead.
Definition: SerialWombat.h:1455
@ CONFIGURE_CHANNEL_MODE_HW_1
(221)
@ SW_LOW
Definition: SerialWombat.h:49
@ PIN_MODE_THROUGHPUT_CONSUMER
(4)
Definition: SerialWombat.h:242
@ SW_DATA_SOURCE_PIN_18
(18) 16 bit public data provided by Pin 18
@ SW_DATA_SOURCE_PIN_4
(4) 16 bit public data provided by Pin 4
SerialWombatDataSource
A list of Serial Wombat public data sources.
Definition: SerialWombat.h:56
@ PIN_MODE_INPUT_PROCESSOR
(14)
Definition: SerialWombat.h:250
@ COMMAND_UART1_RX_7BYTES
(0xB3)
int16_t echo(uint8_t data[], uint8_t count=7)
Definition: SerialWombat.h:1387
@ SW_DATA_SOURCE_PIN_13
(13) 16 bit public data provided by Pin 13
uint8_t _pin
Definition: SerialWombat.h:1565
@ COMMAND_BINARY_READ_USER_BUFFER
(0x83)
int16_t startStartupCommandCapture()
Start capture of startup commands (SW18AB Only)
Definition: SerialWombat.h:1237
@ SW_DATA_SOURCE_PIN_1_MV
(101) Pin 1 public output expressed in mV (for analog modes only)
@ SW_DATA_SOURCE_PIN_17
(17) 16 bit public data provided by Pin 17
@ SW_DATA_SOURCE_PIN_19_MV
(119) Pin 19 public output expressed in mV (for analog modes only)
@ PIN_MODE_QUADRATUREENCODER
(5)
Definition: SerialWombat.h:243
int16_t stopStartupCommandCapture()
Stop capture of startup commands (SW18AB Only)
Definition: SerialWombat.h:1247
uint8_t communicationErrorRetries
How many times to retry a packet if communcation bus (such as I2C) error.
Definition: SerialWombat.h:1385
@ CONFIGURE_PIN_MODE2
(202)
@ PIN_MODE_FRAME_TIMER
(21)
Definition: SerialWombat.h:255
@ CONFIGURE_PIN_INPUTPROCESS
(211)
@ PIN_MODE_LIQUIDCRYSTAL
(28)
Definition: SerialWombat.h:262
@ COMMAND_BINARY_READ_PIN_BUFFFER
(0x81)
#define SW_LE16(_a)
Convert a uint16_t to two bytes in little endian format for array initialization.
Definition: SerialWombat.h:41
@ PIN_MODE_PROTECTED_OUTPUT
(8)
Definition: SerialWombat.h:245
uint8_t model[4]
Contains the last model retreived by queryVersion() as a zero-terminated string.
Definition: SerialWombat.h:1007
@ SW_DATA_SOURCE_ERRORS
(72)The number of incoming packets that have caused errors since reset (rolls over at 65535)
void digitalWrite(uint8_t val)
Set output pin High or Low.
Definition: SerialWombat.h:1524
int writeUserBuffer(uint16_t index, const char s[])
Write bytes to the User Memory Buffer in the Serial Wombat chip.
Definition: SerialWombat.h:1172
@ SW_DATA_SOURCE_65SEC_SQUARE
(176) Square wave that alternates between 0 and 65535 every 32768 frames
@ SW_DATA_SOURCE_0x55
(85) 0x55 is a reserved value for resyncing. Returns 0x55 0x55
@ SW_DATA_SOURCE_PIN_7
(7) 16 bit public data provided by Pin 7
void registerErrorHandler(SerialWombatErrorHandler_t handler)
Registers an error handler that is called by the SerialWombatChip sendPacket() command when a protoco...
Definition: SerialWombat.h:1376
@ SW_DATA_SOURCE_2HZ_SQUARE
(164) Square wave that alternates between 0 and 65535 every 256 frames
bool isSW18()
Returns true if the instance received a model number corresponding to the Serial Wombat 18 series of ...
Definition: SerialWombat.h:972
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.
Definition: SerialWombat.h:1511
@ SW_DATA_SOURCE_PIN_5
(5) 16 bit public data provided by Pin 5
@ CONFIGURE_PIN_MODE5
(205)
@ CONFIGURE_PIN_MODE_DISABLE
(219)
@ PIN_MODE_ULTRASONIC_DISTANCE
(27)
Definition: SerialWombat.h:261
@ PIN_MODE_DIGITALIO
(0)
Definition: SerialWombat.h:238
@ SW_DATA_SOURCE_PIN_19
(19) 16 bit public data provided by Pin 19
@ SW_DATA_SOURCE_8SEC_SQUARE
(173)Square wave that alternates between 0 and 65535 every 4096 frames
int16_t readBrand(char *data)
Definition: SerialWombat.h:1425
@ CONFIGURE_PIN_MODE1
(201)
@ COMMAND_BINARY_READ_RAM
(0xA0)
@ CONFIGURE_PIN_MODE6
(206)
@ SW_DATA_SOURCE_PIN_6
(6) 16 bit public data provided by Pin 6
void SerialWombatSerialErrorHandlerVerbose(uint16_t error, SerialWombatChip *sw)
@ COMMAND_BINARY_QUEUE_ADD_7BYTES
(0x92)
@ SW_DATA_SOURCE_PIN_12
(12) 16 bit public data provided by Pin 12
@ SW_DATA_SOURCE_PIN_2_MV
(102) Pin 2 public output expressed in mV (for analog modes only)
int16_t writeStartupCommandCapture()
Write captured startup commands to flash (SW18AB Only)
Definition: SerialWombat.h:1265
@ COMMAND_BINARY_SET_PIN_BUFFFER
(0x82)
@ PIN_MODE_UART_RX_TX
(17)
Definition: SerialWombat.h:253
@ SW_DATA_SOURCE_1HZ_SQUARE
(167) Square wave that alternates between 0 and 65535 every 512 frames
@ SW_DATA_SOURCE_PIN_18_MV
(118) Pin 18 public output expressed in mV (for analog modes only)
@ PIN_MODE_HS_SERVO
(26)
Definition: SerialWombat.h:260
@ PIN_MODE_VGA
(31)
Definition: SerialWombat.h:265
@ COMMAND_BINARY_QUEUE_INITIALIZE
(0x90)
uint8_t address
The I2C address of the SerialWombatChip instance.
Definition: SerialWombat.h:1382
@ COMMAND_BINARY_READ_EEPROM
(0xA2)
@ COMMAND_UART0_TX_7BYTES
(0xB0)
@ SW_DATA_SOURCE_OVERRUN_FRAMES
(69) The number of frames that ran more than 1mS
@ COMMAND_BINARY_QUEUE_ADD_BYTES
(0x91)
@ SW_DATA_SOURCE_PIN_11
(11) 16 bit public data provided by Pin 11