Serial Wombat Arduino Library

Loading...
Searching...
No Matches
Public Member Functions | List of all members
SerialWombatPulseOnChange Class Reference

Monitors other pin(s) or public data in the Serial Wombat chip and generates a pin pulse on change. More...

`#include <SerialWombatPulseOnChange.h>`

Inheritance diagram for SerialWombatPulseOnChange:
[legend]
Collaboration diagram for SerialWombatPulseOnChange:
[legend]

## Public Member Functions
| SerialWombatPulseOnChange (SerialWombatChip &serialWombat)
| Class constructor for SerialWombatPulseOnChange.
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.
int16_t | setEntryOnChange (uint8_t entryID, uint8_t sourcePin)
| Configure a change entry to pulse when a pin or public data changes.
int16_t | setEntryOnIncrease (uint8_t entryID, uint8_t sourcePin)
| Configure a change entry to pulse when a pin or public data increases.
int16_t | setEntryOnDecrease (uint8_t entryID, uint8_t sourcePin)
| Configure a change entry to pulse when a pin or public data Decreases.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
Public Member Functions inherited from SerialWombatPin
| SerialWombatPin (SerialWombatChip &serialWombatChip)
| Instantiates a Serial Wombat Pin.
| SerialWombatPin (SerialWombatChip &serialWombatChip, uint8_t pin)
| Instantiates a Serial Wombat Pin.
uint16_t | readPublicData ()
| Read the 16 Bit public data associated with this pin.
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.
void | digitalWrite (uint8_t val)
| Set output pin High or Low.
int | digitalRead ()
| Reads the state of the Pin.
uint16_t | writePublicData (uint16_t value)
| Write a 16 bit value to this pin.
uint8_t | pin ()
| Returns the current SW pin number. Used primarily for virtual calls by derived classes.
uint8_t | swPinModeNumber ()
| Returns the Mode number. Used primarily by derived classes to populate packet data.
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)
int16_t | enablePullup (bool enabled)
| Enables the weak pull up on a pin. Implemented on SW18AB and SW8B only.
int16_t | enablePulldown (bool enabled)
| Enables the weak pull down on a pin. Implemented on SW18AB and SW8B only.
int16_t | enableOpenDrain (bool enabled)
| Enables open drain mode on a pin. Implemented on SW18AB and SW8B only.
int16_t | forceDMA (bool enabled)
| Forces use of DMA instead of hardware timing resources on SW18AB.

## Additional Inherited Members
Protected Attributes inherited from SerialWombatPin
uint8_t | _pin = 255
SerialWombatChip & | _sw
uint8_t | _pinMode = 0

## Detailed Description

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:

- Pin data or public data changed
- Pin data or public data increased
- Pin data or public data decreased
- Pin data or public data equals a fixed value
- Pin data or public data below a fixed value
- Pin data or public data above a fixed value
- Pin data or public data not equal to a fixed value
- Pin data or public data crosses a fixed value
- Pin data or public data crosses (ascending) a fixed value
- Pin data or public data crosses (descending) a fixed value
- Pin data or public data equals another pin
- Pin data or public data below another pin
- Pin data or public data above another pin
- Pin data or public data not equal to another pin
- Pin data or public data is within a range
- Pin data or public data is outside a range

A video Tutorial on this pin mode is available:

TODO

TODO https://youtu.be/

Definition at line 82 of file SerialWombatPulseOnChange.h.

## Constructor & Destructor Documentation

## ◆ SerialWombatPulseOnChange()

SerialWombatPulseOnChange::SerialWombatPulseOnChange | ( | SerialWombatChip & | serialWombat | ) |
| inline

Class constructor for SerialWombatPulseOnChange.

Parameters

  serialWombat | The Serial Wombat chip on which the SerialWombatPulseTimer pinmode will be run

Definition at line 89 of file SerialWombatPulseOnChange.h.

## Member Function Documentation

## ◆ begin()

int16_t SerialWombatPulseOnChange::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 )
| inline

Initialization routine for SerialWombatPulseOnChange.

Parameters

  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.

Definition at line 105 of file SerialWombatPulseOnChange.h.

## ◆ setEntryOnChange()

int16_t SerialWombatPulseOnChange::setEntryOnChange | ( | uint8_t | entryID,
|  | uint8_t | sourcePin )
| inline

Configure a change entry to pulse when a pin or public data changes.

Parameters

  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

Returns
  returns a number 0 or greater for success, negative numbers indicate an error occured.

Definition at line 123 of file SerialWombatPulseOnChange.h.

## ◆ setEntryOnDecrease()

int16_t SerialWombatPulseOnChange::setEntryOnDecrease | ( | uint8_t | entryID,
|  | uint8_t | sourcePin )
| inline

Configure a change entry to pulse when a pin or public data Decreases.

Parameters

  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

Returns
  returns a number 0 or greater for success, negative numbers indicate an error occured.

Definition at line 147 of file SerialWombatPulseOnChange.h.

## ◆ setEntryOnEqualValue()

int16_t SerialWombatPulseOnChange::setEntryOnEqualValue | ( | uint8_t | entryID,
|  | uint8_t | sourcePin,
|  | uint16_t | value )
| inline

Configure a change entry to pulse when a pin or public data equals a specified value.

Parameters

  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

Returns
  returns a number 0 or greater for success, negative numbers indicate an error occured.

Definition at line 160 of file SerialWombatPulseOnChange.h.

## ◆ setEntryOnGreaterThanValue()

int16_t SerialWombatPulseOnChange::setEntryOnGreaterThanValue | ( | uint8_t | entryID,
|  | uint8_t | sourcePin,
|  | uint16_t | value )
| inline

Configure a change entry to pulse when a pin or public data is above a specified value.

Parameters

  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

Returns
  returns a number 0 or greater for success, negative numbers indicate an error occured.

Definition at line 188 of file SerialWombatPulseOnChange.h.

## ◆ setEntryOnIncrease()

int16_t SerialWombatPulseOnChange::setEntryOnIncrease | ( | uint8_t | entryID,
|  | uint8_t | sourcePin )
| inline

Configure a change entry to pulse when a pin or public data increases.

Parameters

  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

Returns
  returns a number 0 or greater for success, negative numbers indicate an error occured.

Definition at line 135 of file SerialWombatPulseOnChange.h.

## ◆ setEntryOnLessThanValue()

int16_t SerialWombatPulseOnChange::setEntryOnLessThanValue | ( | uint8_t | entryID,
|  | uint8_t | sourcePin,
|  | uint16_t | value )
| inline

Configure a change entry to pulse when a pin or public data is below a specified value.

Parameters

  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

Returns
  returns a number 0 or greater for success, negative numbers indicate an error occured.

Definition at line 174 of file SerialWombatPulseOnChange.h.

## ◆ setEntryOnNotEqualValue()

int16_t SerialWombatPulseOnChange::setEntryOnNotEqualValue | ( | uint8_t | entryID,
|  | uint8_t | sourcePin,
|  | uint16_t | value )
| inline

Configure a change entry to pulse when a pin or public data is not equal to a specified value.

Parameters

  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

Returns
  returns a number 0 or greater for success, negative numbers indicate an error occured.

Definition at line 204 of file SerialWombatPulseOnChange.h.

## ◆ setEntryOnPinCrossAscending()

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.

Parameters

  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

Returns
  returns a number 0 or greater for success, negative numbers indicate an error occured.

## ◆ setEntryOnPinCrossDescending()

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.

Parameters

  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

Returns
  returns a number 0 or greater for success, negative numbers indicate an error occured.

## ◆ setEntryOnPinCrossValue()

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.

Parameters

  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

Returns
  returns a number 0 or greater for success, negative numbers indicate an error occured.

## ◆ setEntryOnPinGTPin()

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.

Parameters

  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

Returns
  returns a number 0 or greater for success, negative numbers indicate an error occured.

## ◆ setEntryOnPinLTPin()

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.

Parameters

  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

Returns
  returns a number 0 or greater for success, negative numbers indicate an error occured.

## ◆ setEntryOnPinOutsideRange()

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.

Parameters

  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

Returns
  returns a number 0 or greater for success, negative numbers indicate an error occured.

## ◆ setEntryOnPinsEqual()

int16_t SerialWombatPulseOnChange::setEntryOnPinsEqual | ( | uint8_t | entryID,
|  | uint8_t | sourcePin,
|  | uint8_t | secondPin )
| inline

Configure a change entry to pulse when a pin or public data equals a second pin or public data's value.

Parameters

  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

Returns
  returns a number 0 or greater for success, negative numbers indicate an error occured.

Definition at line 218 of file SerialWombatPulseOnChange.h.

## ◆ setEntryOnPinsNotEqual()

int16_t SerialWombatPulseOnChange::setEntryOnPinsNotEqual | ( | uint8_t | entryID,
|  | uint8_t | sourcePin,
|  | uint8_t | secondPin )
| 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.

Parameters

  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

Returns
  returns a number 0 or greater for success, negative numbers indicate an error occured.

Definition at line 233 of file SerialWombatPulseOnChange.h.

## ◆ setEntryOnPinWithinRange()

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.

Parameters

  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

Returns
  returns a number 0 or greater for success, negative numbers indicate an error occured.