|
Files | |
file | mindsensors-numericpad.h |
Mindsensors Numeric Keypad Sensor driver. | |
Defines | |
#define | MSNP_I2C_ADDR 0xB4 |
#define | MSNP_DATA_REG 0x00 |
#define | KEY_STATUS_REG 0x00 |
Functions | |
bool | _MSNPinit (tSensors link) |
bool | MSNPscanKeys (tSensors link, int &pressedKeys, unsigned byte &key, int &number) |
int | MSNPscanKeys (tSensors link) |
Variables | |
tByteArray | MSNP_I2CRequest |
tByteArray | MSNP_I2CReply |
const unsigned byte | MSNP_KeyMap [] = { '#', '9', '6', '3', '0', '8', '2', '5', '*', '7', '1', '4' } |
const signed byte | MSNP_NumMap [] = { -1, 9, 6, 3, 0, 8, 2, 5, -2, 7, 1, 4} |
const unsigned byte | MSNP_ConfigGroup1 [] = {10, MSNP_I2C_ADDR, 0x2B, 0x01, 0x01, 0x00, 0x00, 0x01, 0x01, 0xFF, 0x02} |
const unsigned byte | MSNP_ConfigGroup2 [] = {16, MSNP_I2C_ADDR, 0x41, 0x0F, 0x0A, 0x0F, 0x0A, 0x0F, 0x0A, 0x0F, 0x0A, 0x0F, 0x0A, 0x0F, 0x0A, 0x0F, 0x0A} |
const unsigned byte | MSNP_ConfigGroup3 [] = {14, MSNP_I2C_ADDR, 0x4F, 0x0F, 0x0A, 0x0F, 0x0A, 0x0F, 0x0A, 0x0F, 0x0A, 0x0F, 0x0A, 0x0F, 0x0A} |
const unsigned byte | MSNP_ConfigGroup4 [] = { 5, MSNP_I2C_ADDR, 0x5C, 0x0B, 0x20, 0x0C} |
const unsigned byte | MSNP_ConfigGroup5 [] = { 3, MSNP_I2C_ADDR, 0x7B, 0x0B} |
const unsigned byte | MSNP_ConfigGroup6 [] = { 5, MSNP_I2C_ADDR, 0x7D, 0x9C, 0x65, 0x8C} |
bool | _MSNPinitialised [] = {false, false, false, false} |
Numeric Keypad Numeric Keypad Sensor
#define KEY_STATUS_REG 0x00 |
Definition at line 48 of file mindsensors-numericpad.h.
#define MSNP_DATA_REG 0x00 |
Data registers start at 0x00
Definition at line 42 of file mindsensors-numericpad.h.
#define MSNP_I2C_ADDR 0xB4 |
Numeric Pad I2C device address
Definition at line 41 of file mindsensors-numericpad.h.
bool _MSNPinit | ( | tSensors | link ) |
Initialise the numeric pad sensor chip. This must be done at the beginning of every power cycle
Note: this is an internal function and should not be called directly.
link | the MSNP port number |
Definition at line 70 of file mindsensors-numericpad.h.
int MSNPscanKeys | ( | tSensors | link ) |
Scan the keypad for pressed keys. This returns immediately.
link | the MSNP port number |
Definition at line 147 of file mindsensors-numericpad.h.
bool MSNPscanKeys | ( | tSensors | link, |
int & | pressedKeys, | ||
unsigned byte & | key, | ||
int & | number | ||
) |
Scan the keypad for pressed keys. This returns immediately.
link | the MSNP port number |
pressedKeys | a binary representation of all keys pressed |
key | character representation of the first key pressed, X if no key was pressed |
number | the numeric equivalent, 0-9 for digits, -1 for # and -2 for *, -255 when nothing is pressed |
Definition at line 109 of file mindsensors-numericpad.h.
bool _MSNPinitialised[] = {false, false, false, false} |
Definition at line 60 of file mindsensors-numericpad.h.
const unsigned byte MSNP_ConfigGroup1[] = {10, MSNP_I2C_ADDR, 0x2B, 0x01, 0x01, 0x00, 0x00, 0x01, 0x01, 0xFF, 0x02} |
Definition at line 53 of file mindsensors-numericpad.h.
const unsigned byte MSNP_ConfigGroup2[] = {16, MSNP_I2C_ADDR, 0x41, 0x0F, 0x0A, 0x0F, 0x0A, 0x0F, 0x0A, 0x0F, 0x0A, 0x0F, 0x0A, 0x0F, 0x0A, 0x0F, 0x0A} |
Definition at line 54 of file mindsensors-numericpad.h.
const unsigned byte MSNP_ConfigGroup3[] = {14, MSNP_I2C_ADDR, 0x4F, 0x0F, 0x0A, 0x0F, 0x0A, 0x0F, 0x0A, 0x0F, 0x0A, 0x0F, 0x0A, 0x0F, 0x0A} |
Definition at line 55 of file mindsensors-numericpad.h.
const unsigned byte MSNP_ConfigGroup4[] = { 5, MSNP_I2C_ADDR, 0x5C, 0x0B, 0x20, 0x0C} |
Definition at line 56 of file mindsensors-numericpad.h.
const unsigned byte MSNP_ConfigGroup5[] = { 3, MSNP_I2C_ADDR, 0x7B, 0x0B} |
Definition at line 57 of file mindsensors-numericpad.h.
const unsigned byte MSNP_ConfigGroup6[] = { 5, MSNP_I2C_ADDR, 0x7D, 0x9C, 0x65, 0x8C} |
Definition at line 58 of file mindsensors-numericpad.h.
Array to hold I2C reply data
Definition at line 45 of file mindsensors-numericpad.h.
Array to hold I2C command data
Definition at line 44 of file mindsensors-numericpad.h.
const unsigned byte MSNP_KeyMap[] = { '#', '9', '6', '3', '0', '8', '2', '5', '*', '7', '1', '4' } |
Definition at line 50 of file mindsensors-numericpad.h.
const signed byte MSNP_NumMap[] = { -1, 9, 6, 3, 0, 8, 2, 5, -2, 7, 1, 4} |
Definition at line 51 of file mindsensors-numericpad.h.