LOGGER
Logger
Data Logging using ESP8266
|
#include <arduino.h>
#include <ESP8266WiFi.h>
#include "tca9539.h"
#include "huzzahpins.h"
#include "i2cservices.h"
#include "pincounter.h"
#include "sensorlibrary.h"
Classes | |
union | IoExpanderStatus_t |
struct | IOpinsDevice_t |
Macros | |
#define | tca9539Edit 1 |
version of this module | |
#define | TCA_BASE_ADDRESS 0 |
Address to read the pair of input bytes from. More... | |
#define | TCA_INPUT_ADDRESS (TCA_BASE_ADDRESS) |
Input byte pair. | |
#define | TCA_DESIRED_OUTPUT_ADDRESS (TCA_BASE_ADDRESS+2) |
output byte pair | |
#define | TCA_INVERSION_ADDRESS (TCA_BASE_ADDRESS+4) |
inversion byte pair | |
#define | TCA_CONFIGURATION_ADDRESS (TCA_BASE_ADDRESS+6) |
on when input byte pair | |
Functions | |
EXTERNDEF void | tca9539init () |
< version of this include file More... | |
EXTERNDEF uint32_t | tca9539readPin (uint8_t *pUniqueID, uint8_t pinNumber) |
EXTERNDEF int32_t | tca9539getDesiredOutputs (uint8_t address) |
EXTERNDEF bool | tca9539setDesiredOutputs (uint8_t address, uint16_t value) |
EXTERNDEF int32_t | tca9539getConfiguration (uint8_t address) |
EXTERNDEF bool | tca9539setConfiguration (uint8_t address, uint16_t value) |
EXTERNDEF bool | tca9539dumpState (Print *pPrinter, uint8_t address) |
EXTERNDEF void | tca9539emitConfiguror (Print *pPrint, uint8_t pinIndex, bool setIOconfig, bool ioIsOutput, bool ioIsOn) |
EXTERNDEF void | tca9539checkPinChanges () |
Support for the TCA9539 I/O expander part. The I/O registers for this part are the same as the PCA9535.
#define TCA_BASE_ADDRESS 0 |
Address to read the pair of input bytes from.
Base address of all part registers
EXTERNDEF void tca9539checkPinChanges | ( | ) |
Check pin changes. Call this when changes in sensors have been detected. This may be called when no changes in pin state have occured.
NOTE: knowlege that address 0x77 pins 16 and 17 are pulse counting pins is buried inside this module.
EXTERNDEF bool tca9539dumpState | ( | Print * | pPrinter, |
uint8_t | address | ||
) |
print the current state of a device
pPrinter | where to send the output |
address | I2C address of the device to print |
EXTERNDEF void tca9539emitConfiguror | ( | Print * | pPrint, |
uint8_t | pinIndex, | ||
bool | setIOconfig, | ||
bool | ioIsOutput, | ||
bool | ioIsOn | ||
) |
Emit the display and configuration for a TCA pin.
pPrint | where to print the selector |
pinIndex | current selected data type as an integer |
setIOconfig | true to set the IO configuration or pin state |
ioIsOutput | true if pin is an output |
ioIsOn | true if intended value is on |
EXTERNDEF int32_t tca9539getConfiguration | ( | uint8_t | address | ) |
Get the current device pin configuration. The data is read from a data structure and reported. A one in any bit position indicates that the bit is configured as an input.
address | I2C address of the device to read |
EXTERNDEF int32_t tca9539getDesiredOutputs | ( | uint8_t | address | ) |
Get the current device desired output state. The data is read from a data structure and reported.
address | I2C address of the device to read |
EXTERNDEF void tca9539init | ( | ) |
< version of this include file
Initialize I/O expander devices. Find the devices and put them into the list of devices.
EXTERNDEF uint32_t tca9539readPin | ( | uint8_t * | pUniqueID, |
uint8_t | pinNumber | ||
) |
Read a pin of the tca9539 part.
The uniqueID is an 8 byte array. The first bytes are the MAC address of this processor. The last byte is the I2C address for the specific part to read.
Pin number 0 is the lowest order bit. Pin number 15 is the highest order bit.
pUniqueID | ID of the part to read |
pinNumber | pin number to read |
EXTERNDEF bool tca9539setConfiguration | ( | uint8_t | address, |
uint16_t | value | ||
) |
Set the configuration of all pins. The configuration is logged in a data structure and is also sent to the device. A one in any bit position indicated that the pin is an input.
address | I2C address of the device to update |
value | New value for the pin configuration |
EXTERNDEF bool tca9539setDesiredOutputs | ( | uint8_t | address, |
uint16_t | value | ||
) |
Set the desired state of all output pins. The state is logged in a data structure and is also sent to the device.
address | I2C address of the device to update |
value | new value for the desired outputs state |