Serial Wombat Arduino Library
|
Monitors other pin(s) or public data in the Serial Wombat chip and generates a pin pulse on change. More...
#include <SerialWombatPulseOnChange.h>
Public Member Functions | |
SerialWombatPulseOnChange (SerialWombatChip &serialWombat) | |
Class constructor for SerialWombatPulseOnChange. More... | |
int16_t | begin (uint8_t pin, SerialWombatPinState_t activeMode=SW_HIGH, SerialWombatPinState_t inactiveMode=SW_LOW, uint16_t pulseOnTime=50, uint16_t pulseOffTime=50, uint8_t orNotAnd=1, uint16_t PWMperiod=0, uint16_t PWMdutyCycle=0x8000) |
Initialization routine for SerialWombatPulseOnChange. More... | |
int16_t | setEntryOnChange (uint8_t entryID, uint8_t sourcePin) |
Configure a change entry to pulse when a pin or public data changes. More... | |
int16_t | setEntryOnIncrease (uint8_t entryID, uint8_t sourcePin) |
Configure a change entry to pulse when a pin or public data increases. More... | |
int16_t | setEntryOnDecrease (uint8_t entryID, uint8_t sourcePin) |
Configure a change entry to pulse when a pin or public data Decreases. More... | |
int16_t | setEntryOnEqualValue (uint8_t entryID, uint8_t sourcePin, uint16_t value) |
Configure a change entry to pulse when a pin or public data equals a specified value. More... | |
int16_t | setEntryOnLessThanValue (uint8_t entryID, uint8_t sourcePin, uint16_t value) |
Configure a change entry to pulse when a pin or public data is below a specified value. More... | |
int16_t | setEntryOnGreaterThanValue (uint8_t entryID, uint8_t sourcePin, uint16_t value) |
Configure a change entry to pulse when a pin or public data is above a specified value. More... | |
int16_t | setEntryOnNotEqualValue (uint8_t entryID, uint8_t sourcePin, uint16_t value) |
Configure a change entry to pulse when a pin or public data is not equal to a specified value. More... | |
int16_t | setEntryOnPinsEqual (uint8_t entryID, uint8_t sourcePin, uint8_t secondPin) |
Configure a change entry to pulse when a pin or public data equals a second pin or public data's value. More... | |
int16_t | setEntryOnPinsNotEqual (uint8_t entryID, uint8_t sourcePin, uint8_t secondPin) |
Configure a change entry to pulse when a pin or public data is not equal to a second pin or public data's value. More... | |
int16_t | setEntryOnPinGTPin (uint8_t entryID, uint8_t sourcePin, uint8_t secondPin) |
Configure a change entry to pulse when a pin or public data is greater than a second pin or public data's value. More... | |
int16_t | setEntryOnPinLTPin (uint8_t entryID, uint8_t sourcePin, uint8_t secondPin) |
Configure a change entry to pulse when a pin or public data is less than a second pin or public data's value. More... | |
int16_t | setEntryOnPinCrossValue (uint8_t entryID, uint8_t sourcePin, uint16_t value) |
Configure a change entry to pulse when a pin or public data crosses a specified value. More... | |
int16_t | setEntryOnPinCrossAscending (uint8_t entryID, uint8_t sourcePin, uint16_t value) |
Configure a change entry to pulse when a pin or public data rises above a specified value. More... | |
int16_t | setEntryOnPinCrossDescending (uint8_t entryID, uint8_t sourcePin, uint16_t value) |
Configure a change entry to pulse when a pin or public data falls below a specified value. More... | |
int16_t | setEntryOnPinWithinRange (uint8_t entryID, uint8_t sourcePin, uint16_t lowValue, uint16_t highValue) |
Configure a change entry to pulse when a pin or public data is within a specified range. More... | |
int16_t | setEntryOnPinOutsideRange (uint8_t entryID, uint8_t sourcePin, uint16_t lowValue, uint16_t highValue) |
Configure a change entry to pulse when a pin or public data is within a specified range. More... | |
Public Member Functions inherited from SerialWombatPin | |
SerialWombatPin (SerialWombatChip &serialWombatChip) | |
Instantiates a Serial Wombat Pin. More... | |
SerialWombatPin (SerialWombatChip &serialWombatChip, uint8_t pin) | |
Instantiates a Serial Wombat Pin. More... | |
uint16_t | readPublicData () |
Read the 16 Bit public data associated with this pin. More... | |
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. More... | |
void | digitalWrite (uint8_t val) |
Set output pin High or Low. More... | |
int | digitalRead () |
Reads the state of the Pin. More... | |
uint16_t | writePublicData (uint16_t value) |
Write a 16 bit value to this pin. More... | |
uint8_t | pin () |
Returns the current SW pin number. Used primarily for virtual calls by derived classes. More... | |
uint8_t | swPinModeNumber () |
Returns the Mode number. Used primarily by derived classes to populate packet data. More... | |
int16_t | initPacketNoResponse (uint8_t packetNumber, uint8_t param0=0x55, uint8_t param1=0x55, uint8_t param2=0x55, uint8_t param3=0x55, uint8_t param4=0x55) |
int16_t | initPacketNoResponse (uint8_t packetNumber, uint16_t param0=0x55, uint8_t param1=0x55, uint8_t param2=0x55, uint8_t param3=0x55) |
int16_t | initPacketNoResponse (uint8_t packetNumber, uint16_t param0, uint16_t param1, uint8_t param2=0x55) |
int16_t | disable () |
Disables the pin mode (if applicable) More... | |
Additional Inherited Members | |
Protected Attributes inherited from SerialWombatPin | |
uint8_t | _pin = 255 |
SerialWombatChip & | _sw |
uint8_t | _pinMode = 0 |
Monitors other pin(s) or public data in the Serial Wombat chip and generates a pin pulse on change.
This class controls the Pulse on Change pin mode of the Serial Wombat Chip. Pulse on Change is useful to generate a pulse that can drive an interrupt on the host Arduino, or for creating user alerts such as LED pulses or buzzer tones that acknowledge data reception or human input.
For instance, a pulse could be generated when the output value of a rotary encoder state machine on other pins changes value. Or an LED could be pulsed to command traffic on the Serial Wombat chip by making it pulse when SW_DATA_SOURCE_PACKETS_RECEIVED changes.
Reference the Public Data and Pin Modes section on the main page to learn more about public data and how public data on the Serial Wombat chip works.
The each pin can monitor up to 8 other pins or data sources for changes. A pulse will be generated when any of the criteria (orNotAnd == 1) or all (simultaneously) of the criteria (orNotAnd == 0) are met. Criteria can be any of the following:
A video Tutorial on this pin mode is available:
TODO
TODO https://youtu.be/
|
inline |
Class constructor for SerialWombatPulseOnChange.
serialWombat | The Serial Wombat chip on which the SerialWombatPulseTimer pinmode will be run |
|
inline |
Initialization routine for SerialWombatPulseOnChange.
pin | The Serial Wombat pin that will pulse on change |
pulseOnTime | The Number of mS that the pulse will last when the true condition occurs. Set to 65535 to stay on constantly until condition is false |
pulseOffTime | the number of mS that the pulse will stay off until another pulse can be triggered. |
orNotAnd | 0 = all initialized entries must be true to generate pulse. 1 = Any intitialized entry will generate a pulse if true |
PWMperiod | the period in uS of ouput pulse. Set to 0 for constant Active. |
PWMdutyCycle | for output pulse. Only valid if PWM Period is not 0. |
|
inline |
Configure a change entry to pulse when a pin or public data changes.
entryID | to set one entry in this pin's change entry table to OnChange. Valid values are 0-7 |
sourcePin | Pin or data source to monitor for change. Enumerated types should be casted to uint8_t |
|
inline |
Configure a change entry to pulse when a pin or public data Decreases.
entryID | to set one entry in this pin's change entry table to OnChange. Valid values are 0-7 |
sourcePin | Pin or data source to monitor for change. Enumerated types should be casted to uint8_t |
|
inline |
Configure a change entry to pulse when a pin or public data equals a specified value.
entryID | to set one entry in this pin's change entry table to OnChange. Valid values are 0-7 |
sourcePin | Pin or data source to monitor for change. Enumerated types should be casted to uint8_t |
value | A constant value to be compared against the public data specified by sourcePin |
|
inline |
Configure a change entry to pulse when a pin or public data is above a specified value.
entryID | to set one entry in this pin's change entry table to OnChange. Valid values are 0-7 |
sourcePin | Pin or data source to monitor for change. Enumerated types should be casted to uint8_t |
value | A constant value to be compared against the public data specified by sourcePin |
|
inline |
Configure a change entry to pulse when a pin or public data increases.
entryID | to set one entry in this pin's change entry table to OnChange. Valid values are 0-7 |
sourcePin | Pin or data source to monitor for change. Enumerated types should be casted to uint8_t |
|
inline |
Configure a change entry to pulse when a pin or public data is below a specified value.
entryID | to set one entry in this pin's change entry table to OnChange. Valid values are 0-7 |
sourcePin | Pin or data source to monitor for change. Enumerated types should be casted to uint8_t |
value | A constant value to be compared against the public data specified by sourcePin |
|
inline |
Configure a change entry to pulse when a pin or public data is not equal to a specified value.
entryID | to set one entry in this pin's change entry table to OnChange. Valid values are 0-7 |
sourcePin | Pin or data source to monitor for change. Enumerated types should be casted to uint8_t |
value | A constant value to be compared against the public data specified by sourcePin |
int16_t SerialWombatPulseOnChange::setEntryOnPinCrossAscending | ( | uint8_t | entryID, |
uint8_t | sourcePin, | ||
uint16_t | value | ||
) |
Configure a change entry to pulse when a pin or public data rises above a specified value.
entryID | to set one entry in this pin's change entry table to OnChange. Valid values are 0-7 |
sourcePin | Pin or data source to monitor for change. Enumerated types should be casted to uint8_t |
value | A constant value to be compared against the public data specified by sourcePin |
int16_t SerialWombatPulseOnChange::setEntryOnPinCrossDescending | ( | uint8_t | entryID, |
uint8_t | sourcePin, | ||
uint16_t | value | ||
) |
Configure a change entry to pulse when a pin or public data falls below a specified value.
entryID | to set one entry in this pin's change entry table to OnChange. Valid values are 0-7 |
sourcePin | Pin or data source to monitor for change. Enumerated types should be casted to uint8_t |
value | A constant value to be compared against the public data specified by sourcePin |
int16_t SerialWombatPulseOnChange::setEntryOnPinCrossValue | ( | uint8_t | entryID, |
uint8_t | sourcePin, | ||
uint16_t | value | ||
) |
Configure a change entry to pulse when a pin or public data crosses a specified value.
entryID | to set one entry in this pin's change entry table to OnChange. Valid values are 0-7 |
sourcePin | Pin or data source to monitor for change. Enumerated types should be casted to uint8_t |
value | A constant value to be compared against the public data specified by sourcePin |
int16_t SerialWombatPulseOnChange::setEntryOnPinGTPin | ( | uint8_t | entryID, |
uint8_t | sourcePin, | ||
uint8_t | secondPin | ||
) |
Configure a change entry to pulse when a pin or public data is greater than a second pin or public data's value.
entryID | to set one entry in this pin's change entry table to OnChange. Valid values are 0-7 |
sourcePin | Pin or data source to monitor for change. Enumerated types should be casted to uint8_t |
secondPin | Pin or public data whose data will be compared to the public data from sourcePin |
int16_t SerialWombatPulseOnChange::setEntryOnPinLTPin | ( | uint8_t | entryID, |
uint8_t | sourcePin, | ||
uint8_t | secondPin | ||
) |
Configure a change entry to pulse when a pin or public data is less than a second pin or public data's value.
entryID | to set one entry in this pin's change entry table to OnChange. Valid values are 0-7 |
sourcePin | Pin or data source to monitor for change. Enumerated types should be casted to uint8_t |
secondPin | Pin or public data whose data will be compared to the public data from sourcePin |
int16_t SerialWombatPulseOnChange::setEntryOnPinOutsideRange | ( | uint8_t | entryID, |
uint8_t | sourcePin, | ||
uint16_t | lowValue, | ||
uint16_t | highValue | ||
) |
Configure a change entry to pulse when a pin or public data is within a specified range.
entryID | to set one entry in this pin's change entry table to OnChange. Valid values are 0-7 |
sourcePin | Pin or data source to monitor for change. Enumerated types should be casted to uint8_t |
lowValue | A constant value to be compared against the public data specified by sourcePin |
highValue | A constant value to be compared against the public data specified by sourcePin |
|
inline |
Configure a change entry to pulse when a pin or public data equals a second pin or public data's value.
entryID | to set one entry in this pin's change entry table to OnChange. Valid values are 0-7 |
sourcePin | Pin or data source to monitor for change. Enumerated types should be casted to uint8_t |
secondPin | Pin or public data whose data will be compared to the public data from sourcePin |
|
inline |
Configure a change entry to pulse when a pin or public data is not equal to a second pin or public data's value.
entryID | to set one entry in this pin's change entry table to OnChange. Valid values are 0-7 |
sourcePin | Pin or data source to monitor for change. Enumerated types should be casted to uint8_t |
secondPin | Pin or public data whose data will be compared to the public data from sourcePin |
int16_t SerialWombatPulseOnChange::setEntryOnPinWithinRange | ( | uint8_t | entryID, |
uint8_t | sourcePin, | ||
uint16_t | lowValue, | ||
uint16_t | highValue | ||
) |
Configure a change entry to pulse when a pin or public data is within a specified range.
entryID | to set one entry in this pin's change entry table to OnChange. Valid values are 0-7 |
sourcePin | Pin or data source to monitor for change. Enumerated types should be casted to uint8_t |
lowValue | A constant value to be compared against the public data specified by sourcePin |
highValue | A constant value to be compared against the public data specified by sourcePin |