Serial Wombat Arduino Library

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

A Class that consumes CPU time on the Serial Wombat chip in order to facilitate testing. More...

`#include <SerialWombatThroughputConsumer.h>`

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

## Public Member Functions
| SerialWombatThroughputConsumer (SerialWombatChip &serialWombat)
| Constructor for SerialWombatThroughputConsumer class.
int16_t | begin (uint8_t pin)
int16_t | writeAll (uint16_t delay)
| Set all delay times to a specified number of uS / /.
int16_t | write (uint8_t frame, uint16_t delay)
| Set a frame delay time to a specified number of uS.
int16_t | delayInCommProcessing (uint16_t delay)
| Delay a specified number of uS within the packet processing routine.
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 that consumes CPU time on the Serial Wombat chip in order to facilitate testing.

This class is only supported on the Serial Wombat SW18AB chip. It is not supported on the Serial Wombat 4X line.

This class provides a means to consume throughput inside of a pin in order to test different CPU loading secenarios.

This class provides an array of 16 delays measured in uS. When each frame runs the cumulative frame counter is taken mod 16 to determine which delay to use. During this delay the pin goes high and waits in a loop for approximately the specified number of uS.

Definition at line 44 of file SerialWombatThroughputConsumer.h.

## Constructor & Destructor Documentation

## ◆ SerialWombatThroughputConsumer()

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

Constructor for SerialWombatThroughputConsumer class.

Parameters

  serialWombat | SerialWombatChip on which the ThroughputConsumer will run

Definition at line 51 of file SerialWombatThroughputConsumer.h.

## Member Function Documentation

## ◆ begin()

int16_t SerialWombatThroughputConsumer::begin | ( | uint8_t | pin | ) |
| inline

Definition at line 57 of file SerialWombatThroughputConsumer.h.

## ◆ delayInCommProcessing()

int16_t SerialWombatThroughputConsumer::delayInCommProcessing | ( | uint16_t | delay | ) |
| inline

Delay a specified number of uS within the packet processing routine.

Parameters

  delay | The number of uS to delay in each frame

Returns
  Returns a negative error code if errors occur during configuration

Definition at line 117 of file SerialWombatThroughputConsumer.h.

## ◆ write()

int16_t SerialWombatThroughputConsumer::write | ( | uint8_t | frame,
|  | uint16_t | delay )
| inline

Set a frame delay time to a specified number of uS.

Parameters

  frame | The frame number (0-15) to set
  delay | The number of uS to delay in each frame

Returns
  Returns a negative error code if errors occur during configuration

Definition at line 99 of file SerialWombatThroughputConsumer.h.

## ◆ writeAll()

int16_t SerialWombatThroughputConsumer::writeAll | ( | uint16_t | delay | ) |
| inline

Set all delay times to a specified number of uS / /.

/

Parameters

  delay | The number of uS to delay in each frame /

Returns
  Returns a negative error code if errors occur during configuration

Definition at line 73 of file SerialWombatThroughputConsumer.h.