ClearCore Library
Loading...
Searching...
No Matches
List of all members | Public Member Functions
ClearCore::CcioPin Class Reference

Detailed Description

Connector class for an individual CCIO-8 pin.

Manages individual CCIO-8 pins.

For more detailed information on the CCIO-8 system, check out the ClearCore I/O Expansion Board informational page.

For more detailed information on the ClearCore Connector interface, check out the ClearCore Connector System informational page.

Connector class for an individual CCIO-8 pin. More...

#include <CcioPin.h>

+ Inheritance diagram for ClearCore::CcioPin:
+ Collaboration diagram for ClearCore::CcioPin:

Public Member Functions

virtual ConnectorModes Mode () override
 Get the connector's operational mode.
 
virtual bool Mode (ConnectorModes newMode) override
 Set the connector's operational mode.
 
Connector::ConnectorTypes Type () override
 Get connector type.
 
bool IsWritable () override
 Get R/W status of the connector.
 
int16_t State () override
 In input mode, get the connector's last filtered sampled value. In output mode, get the connector's output state.
 
bool State (int16_t newState) override
 Set the output state of the connector.
 
void FilterLength (uint16_t samples)
 Set the connector's digital filter length in samples. The default is 3 samples.
 
void Filter_ms (uint16_t len)
 Set the connector's digital filter length in ms.
 
bool IsInHwFault () override
 Check whether the connector is in a hardware fault state.
 
bool InputRisen ()
 Clear on read accessor for this connector's rising input state.
 
bool InputFallen ()
 Clear on read accessor for this connector's falling input state.
 
void OutputPulsesStart (uint32_t onTime, uint32_t offTime, uint16_t pulseCount=0, bool blockUntilDone=false)
 Start an output pulse.
 
void OutputPulsesStop (bool stopImmediately=true)
 Stop an output pulse.
 
- Public Member Functions inherited from ClearCore::Connector
void Reinitialize ()
 Reinitialize this connector to the power-up state.
 
int32_t ConnectorIndex ()
 Accessor for the bit index of this connector in the input register.
 
uint32_t InputRegMask ()
 Get a bit mask representing this connector.
 

Additional Inherited Members

- Public Types inherited from ClearCore::Connector
enum  ConnectorModes {
  INVALID_NONE , INPUT_ANALOG , INPUT_DIGITAL , OUTPUT_ANALOG ,
  OUTPUT_DIGITAL , OUTPUT_H_BRIDGE , OUTPUT_PWM , OUTPUT_TONE ,
  OUTPUT_WAVE , CPM_MODE_A_DIRECT_B_DIRECT , CPM_MODE_STEP_AND_DIR , CPM_MODE_A_DIRECT_B_PWM ,
  CPM_MODE_A_PWM_B_PWM , TTL , RS232 , SPI ,
  CCIO , USB_CDC
}
 All possible operational modes for a connector. More...
 
enum  ConnectorTypes {
  DIGITAL_IN_TYPE , DIGITAL_IN_OUT_TYPE , SHIFT_REG_TYPE , ANALOG_IN_DIGITAL_IN_TYPE ,
  ANALOG_OUT_DIGITAL_IN_OUT_TYPE , H_BRIDGE_TYPE , CPM_TYPE , SERIAL_TYPE ,
  SERIAL_USB_TYPE , CCIO_DIGITAL_IN_OUT_TYPE
}
 The different types of ClearCore connectors. More...
 

Member Function Documentation

◆ Filter_ms()

void ClearCore::CcioPin::Filter_ms ( uint16_t  len)

Set the connector's digital filter length in ms.

Restarts any filtering in progress.

// Sets the filter to 10ms
@ CLEARCORE_PIN_CCIOA0
CCIO-8 board 1, connector 0.
Definition SysConnectors.h:89
CcioPin * PinByIndex(ClearCorePins connectorIndex)
Accessor for the individual CCIO-8 pin connectors.
void Filter_ms(uint16_t len)
Set the connector's digital filter length in ms.
CcioBoardManager & CcioMgr
CCIO-8 manager.
Parameters
[in]lenThe length of the filter in ms.
Note
The maximum filter time is 13000 milliseconds.

◆ FilterLength()

void ClearCore::CcioPin::FilterLength ( uint16_t  samples)
inline

Set the connector's digital filter length in samples. The default is 3 samples.

This will set the length of the filter equal to (samples * CCIO-8 refresh rate) for this connector.

Restarts any filtering in progress.

// Sets the filter to 10 samples (2ms)
void FilterLength(uint16_t samples)
Set the connector's digital filter length in samples. The default is 3 samples.
Definition CcioPin.h:170
Parameters
[in]samplesThe number of samples to filter.
Note
One sample time is 200 microseconds.

◆ InputFallen()

bool ClearCore::CcioPin::InputFallen ( )

Clear on read accessor for this connector's falling input state.

// The first CCIO-8 board's connector 0 input has transitioned from
// TRUE to FALSE since the last read.
}
bool InputFallen()
Clear on read accessor for this connector's falling input state.
Returns
true if the input has fallen since the last call

◆ InputRisen()

bool ClearCore::CcioPin::InputRisen ( )

Clear on read accessor for this connector's rising input state.

// The first CCIO-8 board's connector 0 input has transitioned from
// FALSE to TRUE since the last read.
}
bool InputRisen()
Clear on read accessor for this connector's rising input state.
Returns
true if the input has risen since the last call

◆ IsInHwFault()

bool ClearCore::CcioPin::IsInHwFault ( )
overridevirtual

Check whether the connector is in a hardware fault state.

// The first CCIO-8 board's connector 0 is in a fault state.
}
bool IsInHwFault() override
Check whether the connector is in a hardware fault state.
Returns
Connector is in fault

Implements ClearCore::Connector.

◆ IsWritable()

bool ClearCore::CcioPin::IsWritable ( )
inlineoverridevirtual

Get R/W status of the connector.

// The first CCIO-8 board's connector 0 is currently set as an
// output.
}
bool IsWritable() override
Get R/W status of the connector.
Definition CcioPin.h:120
Returns
True if in OUTPUT_DIGITAL mode, false otherwise

Implements ClearCore::Connector.

◆ Mode() [1/2]

virtual ConnectorModes ClearCore::CcioPin::Mode ( )
inlineoverridevirtual

Get the connector's operational mode.

// Connector 0 on the first CCIO-8 board is currently configured
// as a digital input.
}
virtual ConnectorModes Mode() override
Get the connector's operational mode.
Definition CcioPin.h:71
@ INPUT_DIGITAL
Definition Connector.h:90
Returns
The connector's current operational mode.

Reimplemented from ClearCore::Connector.

Examples
CCIO8Examples/ClearCoreIOExpansionBoard/ClearCoreIOExpansionBoard.cpp, CCIO8Examples/ReadCCIODigitalInput/ReadCCIODigitalInput.cpp, CCIO8Examples/WriteCCIODigitalOutput/WriteCCIODigitalOutput.cpp, ClearCoreIOExpansionBoard.cpp, ReadCCIODigitalInput.cpp, and WriteCCIODigitalOutput.cpp.

◆ Mode() [2/2]

virtual bool ClearCore::CcioPin::Mode ( ConnectorModes  newMode)
overridevirtual

Set the connector's operational mode.

Configure the connector to operate in a new I/O mode.

// Configure the first CCIO-8 board's connector 0 as a digital output.
@ OUTPUT_DIGITAL
Definition Connector.h:98
Parameters
[in]newModeThe new mode to be set. The valid modes for this connector type are:
Returns
Returns false if the mode is invalid or setup fails.

Implements ClearCore::Connector.

◆ OutputPulsesStart()

void ClearCore::CcioPin::OutputPulsesStart ( uint32_t  onTime,
uint32_t  offTime,
uint16_t  pulseCount = 0,
bool  blockUntilDone = false 
)

Start an output pulse.

This allows you to start a pulse on the output that is on for onTime milliseconds and off for offTime milliseconds and will stop after pulseCount cycles. A pulseCount of 0 will cause the pulse to run endlessly. If a pulse is already running, calling this will allow you to override the previous pulse (after the next change in state).

// Begin a 100ms on/200ms off pulse on the first CCIO-8 board's
// connector 0 output that will complete 20 cycles and prevent further
// code execution until the cycles are complete.
20, true);
void OutputPulsesStart(uint32_t onTime, uint32_t offTime, uint16_t pulseCount=0, bool blockUntilDone=false)
Start an output pulse.
Parameters
[in]onTimeThe amount of time the input will be held on [ms].
[in]offTimeThe amount of time the input will be held off [ms].
[in]pulseCount(optional) The amount of cycles the pulse will run for. Default: 0 (pulse runs endlessly).
[in]blockUntilDone(optional) If true, the function doesn't return until the pulses have been sent. Default: false.

◆ OutputPulsesStop()

void ClearCore::CcioPin::OutputPulsesStop ( bool  stopImmediately = true)

Stop an output pulse.

This allows you to stop the currently running pulse on this output. The output will always be set to FALSE after canceling a pulse.

// Stop the active output pulse on the first CCIO-8's connector 0
void OutputPulsesStop(bool stopImmediately=true)
Stop an output pulse.
Parameters
[in]stopImmediately(optional) If true, the output pulses will be stopped immediately; if false, any active pulse will be completed first. Default: true.

◆ State() [1/2]

int16_t ClearCore::CcioPin::State ( )
overridevirtual

In input mode, get the connector's last filtered sampled value. In output mode, get the connector's output state.

// The first CCIO-8 board's connector 0 input is high.
}
int16_t State() override
In input mode, get the connector's last filtered sampled value. In output mode, get the connector's o...
Returns
The latest filtered value on this connector when in input mode; the output state when in output mode.

Implements ClearCore::Connector.

Examples
CCIO8Examples/ClearCoreIOExpansionBoard/ClearCoreIOExpansionBoard.cpp, CCIO8Examples/ReadCCIODigitalInput/ReadCCIODigitalInput.cpp, CCIO8Examples/WriteCCIODigitalOutput/WriteCCIODigitalOutput.cpp, ClearCoreIOExpansionBoard.cpp, ReadCCIODigitalInput.cpp, and WriteCCIODigitalOutput.cpp.

◆ State() [2/2]

bool ClearCore::CcioPin::State ( int16_t  newState)
overridevirtual

Set the output state of the connector.

This allows you to change the output value of the connector item.

// Set the first CCIO-8 board's connector 0 output to high.
Parameters
[in]newStateThe value to be output.

Implements ClearCore::Connector.

◆ Type()

Connector::ConnectorTypes ClearCore::CcioPin::Type ( )
inlineoverridevirtual

Get connector type.

if (ConnectorAlias->Type() == CCIO_DIGITAL_IN_OUT_TYPE) {
// This generic connector variable is a CCIO-8 pin.
}
@ CCIO_DIGITAL_IN_OUT_TYPE
Definition Connector.h:295
Returns
The type of the current connector.

Implements ClearCore::Connector.


The documentation for this class was generated from the following file: