|
Serial Wombat Arduino Library
|
A class representing a Serial Wombat Random Blink output. More...
#include <SerialWombatRandomBlink.h>


Public Member Functions | |
| SerialWombatRandomBlink (SerialWombatChip &serialWombat) | |
| Constructor for SerialWombatRandomBlink class. | |
| int16_t | begin (uint8_t pin, uint16_t onTimeMax, uint16_t offTimeMax, uint16_t onTimeMin=0, uint16_t offTimeMin=0, uint16_t onPWMMin=0xFFFF, uint16_t onPWMMax=0xFFFF, uint16_t offPWMMin=0, uint16_t offPWMMax=0) |
| Initialize a pin as Random Blink with common LED defaults. | |
| uint8_t | pin () |
| fulfills a virtual function requirement of SerialWombatAbstractScaledOutput | |
| uint8_t | swPinModeNumber () |
| fulfills a virtual function requirement of SerialWombatAbstractScaledOutput | |
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. | |
| void | setPinNumberForTesting (uint8_t pin) |
| A function designed for testing only. May have unpredictable results if used in real time. Not intended for general use. | |
Public Member Functions inherited from SerialWombatAbstractScaledOutput | |
| SerialWombatAbstractScaledOutput (SerialWombatChip &sw) | |
| Constructor for the SerialWombatAbstractScaledOutput Class. | |
| int16_t | writeTimeout (uint16_t timeout_mS, uint16_t timeoutOutputValue) |
| Enable a timeout value which will cause the output to go to a default value if not updated. | |
| int16_t | writeScalingEnabled (bool enabled, uint8_t sourcePin) |
| Enable scaling and set which pin or public data is used as the input source. | |
| int16_t | writeInputScaling (uint16_t inputMin, uint16_t inputMax) |
| Scale incoming values to a range of 0 to 65535. | |
| int16_t | writeOutputScaling (uint16_t outputMin, uint16_t outputMax) |
| Reduces the output range from 0 to 65535 to user specified range. | |
| int16_t | writeScalingInvertedInput (bool inverted) |
| if enabled subtract the input value from 65535 before doing any other processing. | |
| int16_t | writeScalingTargetValue (uint16_t target) |
| The target input value for PID control. | |
| int16_t | writeRateControl (Period samplePeriod, uint16_t maximumChangecounts, uint16_t maximumDecrementCounts=0) |
| Controls how fast an ouput can change in counts. | |
| int16_t | write1stOrderFiltering (Period samplePeriod, uint16_t filterConstant) |
| Controls how fast an ouput can change based on filtering. | |
| int16_t | writeHysteresis (uint16_t lowLimit, uint16_t lowOutputValue, uint16_t highLimit, uint16_t highOutputValue, uint16_t initialOutputValue) |
| Controls the output based on hystersis control. | |
| int16_t | writeRamp (uint16_t slowIncrement, uint16_t incrementThreshold, uint16_t fastIncrement, Period samplePeriod, RampMode rampMode) |
| Configure the scaled output block into Ramp control mode. | |
| int16_t | writePID (uint16_t kp, uint16_t ki, uint16_t kd, uint16_t target, Period samplePeriod, uint8_t targetPin=255, bool biDirectional=false) |
| Configure the scaled output block into PID control mode. | |
| uint16_t | readLastOutputValue () |
| Request Last Output Value. | |
| int16_t | writeScalingTargetValueResetIntegrator (uint16_t target) |
| int32_t | PIDGetLastError () |
| int32_t | PIDGetLastIntegrator () |
| int32_t | PIDGetLastIntegratorEffort () |
| int32_t | PIDGetLastProportionalEffort () |
| int32_t | PIDGetLastDerivativeEffort () |
| int32_t | PIDGetLastEffort () |
| uint16_t | ReadLastTarget () |
| int16_t | Enable2DLookupOutputScaling (uint16_t IndexInUserMemory) |
| Set Up 2D Lookup Output Scaling. | |
Additional Inherited Members | |
Public Types inherited from SerialWombatAbstractScaledOutput | |
| enum | Period { PERIOD_1mS = 0 , PERIOD_2mS = 1 , PERIOD_4mS = 2 , PERIOD_8mS = 3 , PERIOD_16mS = 4 , PERIOD_32mS = 5 , PERIOD_64mS = 6 , PERIOD_128mS = 7 , PERIOD_256mS = 8 , PERIOD_512mS = 9 , PERIOD_1024mS = 10 } |
| enum | RampMode { RAMP_MODE_BOTH = 0 , RAMP_MODE_INCREMENT = 1 , RAMP_MODE_DECREMENT = 2 } |
Protected Attributes inherited from SerialWombatPin | |
| uint8_t | _pin = 255 |
| SerialWombatChip & | _sw |
| uint8_t | _pinMode = 0 |
A class representing a Serial Wombat Random Blink output.
An instance of this class should be declared for each pin to be used as a Serial Wombat Random Blink output.
This pin mode is intended for use in decorative situations such as train sets cosplay, holiday decorations, props, and other applications where lights blink in a random pattern. Clearly this is easily implmeneted in any microcontroller or software system, but this pin mode provides a convenient way to achieve this without needing to burden the main host controller.
The Random Blink pin mode alternates between an on state and an off state. The duration of each state is chosen randomly between configured minimum and maximum values. The PWM value used during each state is also chosen randomly between configured minimum and maximum values.
The firmware runs the PWM output at 120 Hz. PWM values are 16-bit values from 0 to 65535, with 0 being fully off and 65535 being fully on.
By default the pins are configured as hard driving outputs, but they can also be configured as open drain outputs. If this is the case, the output scaling module can be used to invert output so that 65535 remains "on".
The scaled output filtering module can be used to make the output ramp from off to on rather than a hard blink.
Definition at line 62 of file SerialWombatRandomBlink.h.
|
inline |
Constructor for SerialWombatRandomBlink class.
| serialWombat | SerialWombat chip on which the Random Blink will run |
Definition at line 69 of file SerialWombatRandomBlink.h.
|
inline |
Initialize a pin as Random Blink with common LED defaults.
| pin | The pin to become a Random Blink output. |
| onTimeMin | Minimum randomly selected on time. |
| onTimeMax | Maximum randomly selected on time. |
| offTimeMin | Minimum randomly selected off time. |
| offTimeMax | Maximum randomly selected off time. |
| onPWMMin | Minimum randomly selected PWM value during the on state. |
| onPWMMax | Maximum randomly selected PWM value during the on state. |
| offPWMMin | Minimum randomly selected PWM value during the off state. |
| offPWMMax | Maximum randomly selected PWM value during the off state. |
Definition at line 88 of file SerialWombatRandomBlink.h.
|
inlinevirtual |
fulfills a virtual function requirement of SerialWombatAbstractScaledOutput
Implements SerialWombatAbstractScaledOutput.
Definition at line 137 of file SerialWombatRandomBlink.h.
|
inlinevirtual |
fulfills a virtual function requirement of SerialWombatAbstractScaledOutput
Implements SerialWombatAbstractScaledOutput.
Definition at line 146 of file SerialWombatRandomBlink.h.