Serial Wombat Arduino Library
Public Member Functions | Protected Attributes | List of all members
SerialWombatPin Class Reference

Describes a Serial Wombat Pin. Is base class for other pin modes. More...

#include <SerialWombatPin.h>

Inheritance diagram for SerialWombatPin:
SerialWombat18ABVGA SerialWombat18CapTouch SerialWombatAnalogInput SerialWombatDebouncedInput SerialWombatFrequencyOutput SerialWombatHBridge SerialWombatHSClock SerialWombatHSCounter SerialWombatLiquidCrystal SerialWombatProcessedInputPin SerialWombatProtectedOutput SerialWombatPS2Keyboard SerialWombatPulseOnChange SerialWombatPulseTimer SerialWombatPWM SerialWombatQuadEnc SerialWombatQueuedPulseOutput SerialWombatResistanceInput SerialWombatServo SerialWombatThroughputConsumer SerialWombatTM1637 SerialWombatUART SerialWombatUltrasonicDistanceSensor SerialWombatWatchdog SerialWombatWS2812

Public Member Functions

 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, bool pullDown=false, bool openDrain=false)
 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...
 
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) More...
 

Protected Attributes

uint8_t _pin = 255
 
SerialWombatChip_sw
 
uint8_t _pinMode = 0
 

Detailed Description

Describes a Serial Wombat Pin. Is base class for other pin modes.

This class describes a Serial Wombat Pin on a Serial Wombat Chip. This class can be used to control a pin as a simple Digital I/O pin. This class is used as a base class for many other pin mode classes.

Digital I/O related members such as digitalWrite or pinMode should not be called against derived classes as this may have unpredicable effects on the state machines run by those derived classes.

Constructor & Destructor Documentation

◆ SerialWombatPin() [1/2]

SerialWombatPin::SerialWombatPin ( SerialWombatChip serialWombatChip)
inline

Instantiates a Serial Wombat Pin.

Parameters
serialWombatChipThe chip on which the Serial Wombat Pin exists

◆ SerialWombatPin() [2/2]

SerialWombatPin::SerialWombatPin ( SerialWombatChip serialWombatChip,
uint8_t  pin 
)
inline

Instantiates a Serial Wombat Pin.

Parameters
serialWombatChipThe chip on which the Serial Wombat Pin exists
pinThe pin number of the pin (WP number, not package pin number) of the pin

Member Function Documentation

◆ digitalRead()

int SerialWombatPin::digitalRead ( )
inline

Reads the state of the Pin.

This function is based on the pin's public data, not a raw reading.

Returns
Returns LOW if pin is low or public data is 0. Returns HIGH if pin is high or public data is > 0

◆ digitalWrite()

void SerialWombatPin::digitalWrite ( uint8_t  val)
inline

Set output pin High or Low.

Before calling this function, the pin should be configured as an input or output with pinMode()

Parameters
pinThe Serial Wombat pin to set. Valid values for SW4A: 0-3 SW4B: 1-3
valValid values are HIGH or LOW not use SW_INPUT, SW_HIGH or SW_LOW here, as these have different meanings

◆ disable()

int16_t SerialWombatPin::disable ( )
inline

Disables the pin mode (if applicable)

◆ initPacketNoResponse() [1/3]

int16_t SerialWombatPin::initPacketNoResponse ( uint8_t  packetNumber,
uint16_t  param0,
uint16_t  param1,
uint8_t  param2 = 0x55 
)
inline

◆ initPacketNoResponse() [2/3]

int16_t SerialWombatPin::initPacketNoResponse ( uint8_t  packetNumber,
uint16_t  param0 = 0x55,
uint8_t  param1 = 0x55,
uint8_t  param2 = 0x55,
uint8_t  param3 = 0x55 
)
inline

◆ initPacketNoResponse() [3/3]

int16_t SerialWombatPin::initPacketNoResponse ( uint8_t  packetNumber,
uint8_t  param0 = 0x55,
uint8_t  param1 = 0x55,
uint8_t  param2 = 0x55,
uint8_t  param3 = 0x55,
uint8_t  param4 = 0x55 
)
inline

◆ pin()

uint8_t SerialWombatPin::pin ( )
inline

Returns the current SW pin number. Used primarily for virtual calls by derived classes.

Returns
Returns the current SW pin number.

◆ pinMode()

void SerialWombatPin::pinMode ( uint8_t  mode,
bool  pullDown = false,
bool  openDrain = false 
)
inline

Set pin to INPUT or OUTPUT, with options for pull Ups and open Drain settings.

Parameters
modeValid values are INPUT, OUTPUT or INPUT_PULLUP as defined by arduino. Do not use SW_INPUT, SW_HIGH or SW_LOW here, as these have different meanings
pullDownIf True, a weak pull down will be enabled on this pin (No effect on SW4A/SW4B)
openDrainIf True, output becomes openDrain output rather than push / pull

◆ readPublicData()

uint16_t SerialWombatPin::readPublicData ( )
inline

Read the 16 Bit public data associated with this pin.

Reads and returns the 16 bit value associated with this pin.

Returns
16 bit public data for this pin.

◆ swPinModeNumber()

uint8_t SerialWombatPin::swPinModeNumber ( )
inline

Returns the Mode number. Used primarily by derived classes to populate packet data.

Returns
Returns the pin mode number

◆ writePublicData()

uint16_t SerialWombatPin::writePublicData ( uint16_t  value)
inline

Write a 16 bit value to this pin.

Parameters
valueThe 16 bit value to write

Member Data Documentation

◆ _pin

uint8_t SerialWombatPin::_pin = 255
protected

◆ _pinMode

uint8_t SerialWombatPin::_pinMode = 0
protected

◆ _sw

SerialWombatChip& SerialWombatPin::_sw
protected