Serial Wombat Arduino Library
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:
SerialWombatPin

Public Member Functions

 SerialWombatThroughputConsumer (SerialWombatChip &serialWombat)
 Constructor for SerialWombatThroughputConsumer class. More...
 
int16_t begin (uint8_t pin)
 Initialize an instance of the Throughput Conumer class. All delays are set to 0. More...
 
int16_t writeAll (uint16_t delay)
 Set all delay times to a specified number of uS. More...
 
int16_t write (uint8_t frame, uint16_t delay)
 Set a frame delay time to a specified number of uS. More...
 
int16_t delayInCommProcessing (uint16_t delay)
 Delay a specified number of uS within the packet processing routine. 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)
 Set pin to INPUT or OUTPUT. More...
 
void pinMode (uint8_t mode, bool pullDown, bool openDrain)
 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...
 

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.

Constructor & Destructor Documentation

◆ SerialWombatThroughputConsumer()

SerialWombatThroughputConsumer::SerialWombatThroughputConsumer ( SerialWombatChip serialWombat)

Constructor for SerialWombatThroughputConsumer class.

Parameters
serialWombatSerialWombatChip on which the ThroughputConsumer will run

Member Function Documentation

◆ begin()

int16_t SerialWombatThroughputConsumer::begin ( uint8_t  pin)

Initialize an instance of the Throughput Conumer class. All delays are set to 0.

Returns
Returns a negative error code if initialization failed.

◆ delayInCommProcessing()

int16_t SerialWombatThroughputConsumer::delayInCommProcessing ( uint16_t  delay)

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

Parameters
delayThe number of uS to delay in each frame
Returns
Returns a negative error code if errors occur during configuration

◆ write()

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

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

Parameters
frameThe frame number (0-15) to set
delayThe number of uS to delay in each frame
Returns
Returns a negative error code if errors occur during configuration

◆ writeAll()

int16_t SerialWombatThroughputConsumer::writeAll ( uint16_t  delay)

Set all delay times to a specified number of uS.

Parameters
delayThe number of uS to delay in each frame
Returns
Returns a negative error code if errors occur during configuration