Serial Wombat Arduino Library

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

A Class which outputs pulses of a duration stored in a queue. More...

`#include <SerialWombatQueuedPulseOutput.h>`

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

## Public Member Functions
| SerialWombatQueuedPulseOutput (SerialWombatChip &serialWombatChip)
| Class constructor for SerialWombatQueuedPulseOutput pin mode.
int16_t | begin (uint8_t pin, bool initialState=0, bool idleState=0, bool unitsMs=0, uint16_t QueueIndex=0xFFFF)
| Initialize a queued pulse output mode /.
int16_t | queuePulses (uint16_t firstPulse, uint16_t secondPulse=0, bool emptyQueueFirst=false)
| Add a pulse or two pulses to the queue /.
int16_t | pause (bool paused)
| Pause or unpause the generation of new pulses /.
int16_t | queueEntriesFilled ()
int16_t | queueEntriesFree ()
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.

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

## Detailed Description

A Class which outputs pulses of a duration stored in a queue.

This class is useful for outputting a number of queued pulses of the same or different lengths. For instance, this mode can be used to output arbitrary square waveforms such as the demodulated signal used for an IR remote control.

It is also useful for precise pulsing of motors, LEDs, heaters pumps, relays or solenoids.

It could potentially also be used for UART style communication at non standard baud rates.

A video Tutorial on this pin mode is available:

//TODO - Video coming soon

TODO https://youtu.be/

Definition at line 58 of file SerialWombatQueuedPulseOutput.h.

## Constructor & Destructor Documentation

## ◆ SerialWombatQueuedPulseOutput()

SerialWombatQueuedPulseOutput::SerialWombatQueuedPulseOutput | ( | SerialWombatChip & | serialWombatChip | ) |
| inline

Class constructor for SerialWombatQueuedPulseOutput pin mode.

Parameters

  serialWombatChip | The Serial Wombat chip on which the SerialWombatQueuedPulseOutput pin mode will run

Definition at line 65 of file SerialWombatQueuedPulseOutput.h.

## Member Function Documentation

## ◆ begin()

int16_t SerialWombatQueuedPulseOutput::begin | ( | uint8_t | pin,
|  | bool | initialState = 0,
|  | bool | idleState = 0,
|  | bool | unitsMs = 0,
|  | uint16_t | QueueIndex = 0xFFFF )
| inline

Initialize a queued pulse output mode /.

/

Parameters

  pin | The pin used to output the queued output mode /
  initialState | 0 to initialize low, or 1 to initialize high /
  idleState | 0 to go low when queue empty, 1 to go high when queue empty /
  unitsMs | 0 to use uS as pulse time, 1 to use mS as pulse time /
  QueueIndex | if set to a value other than 0xFFFF use a previously created queue in User RAM rather than the small buffer in the pin's state machine memory /

Returns
  a negative number if an error occured.

Definition at line 76 of file SerialWombatQueuedPulseOutput.h.

## ◆ pause()

int16_t SerialWombatQueuedPulseOutput::pause | ( | bool | paused | ) |
| inline

Pause or unpause the generation of new pulses /.

/

Parameters

  paused | Whether the generation of pulses is paused or unpaused /

Returns
  negative number if an error occured.

Definition at line 122 of file SerialWombatQueuedPulseOutput.h.

## ◆ queueEntriesFilled()

int16_t SerialWombatQueuedPulseOutput::queueEntriesFilled | ( |  | ) |
| inline

Definition at line 127 of file SerialWombatQueuedPulseOutput.h.

## ◆ queueEntriesFree()

int16_t SerialWombatQueuedPulseOutput::queueEntriesFree | ( |  | ) |
| inline

Definition at line 150 of file SerialWombatQueuedPulseOutput.h.

## ◆ queuePulses()

int16_t SerialWombatQueuedPulseOutput::queuePulses | ( | uint16_t | firstPulse,
|  | uint16_t | secondPulse = 0,
|  | bool | emptyQueueFirst = false )
| inline

Add a pulse or two pulses to the queue /.

/

Parameters

  firstPulse | A number from 1 to 32767 logical ored with 0x8000 or 0x0000 to indicate a high or low pulse of a given duration (controlled by units in begin command). 0 indicates do nothing. /
  secondPulse | A number from 1 to 32767 logical ored with 0x8000 or 0x0000 to indicate a high or low pulse of a given duration (controlled by units in begin command). 0 indicates do nothing. /
  emptyQueueFirst | If true, the queue will be emptied before adding new pulses /

Returns
  number of pulses successfully queued or a negative number if an error occured.

Definition at line 90 of file SerialWombatQueuedPulseOutput.h.