115 uint8_t row0pin, uint8_t row1pin, uint8_t row2pin, uint8_t row3pin,
116 uint8_t column0pin, uint8_t column1pin, uint8_t column2pin, uint8_t column3pin,
117 uint8_t bufferMode = 0, uint8_t queueMode = 1, uint8_t rowTiming = 5)
129 int16_t result =
_sw.sendPacket(tx);
143 result =
_sw.sendPacket(tx5);
157 return _sw.sendPacket(tx8);
178 SW_LE16(mask),0x55,0x55,0x55 };
179 return _sw.sendPacket(tx);
202 tableIndex,asciiValue,0x55,0x55,0x55};
203 return _sw.sendPacket(tx);
213 _sw.sendPacket(tx, rx);
225 if (
_sw.sendPacket(tx, rx) < 0)
252 _sw.sendPacket(tx, rx);
285 size_t write(
const uint8_t* buffer,
size_t size)
313 int bytesAvailable = 0;
314 uint32_t timeoutMillis = millis() +
timeout;
315 while (length > 0 && timeoutMillis > millis())
326 _sw.sendPacket(tx, rx);
327 bytesAvailable = rx[3];
329 if (bytesAvailable == 0)
335 timeoutMillis = millis() +
timeout;
337 uint8_t bytesReturned = bytecount;
338 if (rx[3] < bytecount)
340 bytesReturned = rx[3];
342 for (
int i = 0; i < bytesReturned; ++i)
344 buffer[index] = rx[i + 4];
406 _keyIndex = keyIndex;
423 _keyIndex,0x55,0x55,0x55 };
425 int result = _keypad._sw.sendPacket(tx, rx);
446 _keyIndex,0x55,0x55,0x55 };
448 int result = _keypad._sw.sendPacket(tx, rx);
452 uint16_t time = rx[6] + 256 * rx[7];
472 _keyIndex,0x55,0x55,0x55 };
474 int result = _keypad._sw.sendPacket(tx, rx);
478 uint16_t time = rx[6] + 256 * rx[7];
#define SW_LE16(_a)
Convert a uint16_t to two bytes in little endian format for array initialization.
@ CONFIGURE_PIN_MODE0
(200)
@ CONFIGURE_PIN_MODE5
(205)
@ CONFIGURE_PIN_MODE8
(208)
@ CONFIGURE_PIN_MODE6
(206)
@ CONFIGURE_PIN_MODE9
(209)
@ CONFIGURE_PIN_MODE7
(207)
@ PIN_MODE_MATRIX_KEYPAD
(15)
Class for a Serial Wombat chip. Each Serial Wombat chip on a project should have its own instance.
A class for the Serial Wombat SW18AB chips which scans matrix keypads up to 4x4.
int peek()
Query the SerialWombatMatrixKeypad queue for the next avaialble byte, but don't remove it from the qu...
int16_t begin(uint8_t controlPin, uint8_t row0pin, uint8_t row1pin, uint8_t row2pin, uint8_t row3pin, uint8_t column0pin, uint8_t column1pin, uint8_t column2pin, uint8_t column3pin, uint8_t bufferMode=0, uint8_t queueMode=1, uint8_t rowTiming=5)
Initalize the SerialWombatMatrixKeypad.
SerialWombatMatrixKeypad(SerialWombatChip &serialWombat)
Constructor for the SerialWombatMatrixKeypad class.
int16_t writeAsciiTable(uint8_t tableIndex, uint8_t asciiValue)
Change the default ASCII output for each key.
int availableForWrite()
Number of bytes avaialble to write to SerialWombatMatrixKeypad queue. Returns 0.
void setTimeout(long timeout_mS)
implemented to fulfill Stream requirement.
int available()
Queries the SerialWombatMatrixKeypad for number bytes available to read.
size_t write(const uint8_t *buffer, size_t size)
Write bytes to the SerialWombatMatrixKeypad queue (Does nothing)
int16_t writeQueueMask(uint16_t mask)
Set a binary mask for which keys are added to Queue.
SerialWombatMatrixKeypad operator=(SerialWombatMatrixKeypad &kp)
used to allow reference copy. Not for user use.
void flush()
Discard all bytes from the SerialWombatMatrixKeypad queue.
int read()
Reads a byte from the SerialWombatMatrixKeypad queue.
size_t readBytes(char *buffer, size_t length)
Reads a specified number of bytes from the SerialWombatMatrixKeypad queue queue.
size_t write(uint8_t data)
Write a byte to the SerialWombatMatrixKeypad queue (Does Nothing)