ClearCore Library
Loading...
Searching...
No Matches
List of all members | Public Types | Public Member Functions
ClearCore::Connector Class Referenceabstract

Detailed Description

Base class for interacting with all ClearCore connector objects.

This virtual class defines the common functionality for a connector object.

It provides a generic interface that all connectors have. This includes

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

Base class for interacting with all ClearCore connector objects. More...

#include <Connector.h>

+ Inheritance diagram for ClearCore::Connector:

Public Types

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...
 

Public Member Functions

virtual ConnectorModes Mode ()
 Get the connector's operational mode.
 
virtual bool Mode (ConnectorModes newMode)=0
 Set the connector's operational mode.
 
virtual ConnectorTypes Type ()=0
 Get the connector type.
 
virtual bool IsWritable ()=0
 Determine whether values can be written to this 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.
 
virtual int16_t State ()=0
 Get the connector's last sampled value.
 
virtual bool State (int16_t newState)=0
 Set the state of a R/W connector.
 
virtual bool IsInHwFault ()=0
 Get whether the connector is in a hardware fault state.
 
uint32_t InputRegMask ()
 Get a bit mask representing this connector.
 

Member Enumeration Documentation

◆ ConnectorModes

All possible operational modes for a connector.

Note
Each type of connector supports only a limited subset of these modes.
Enumerator
INVALID_NONE 

[0] An invalid default mode.

INPUT_ANALOG 

[1] Analog input mode.

Note
This is the default mode setting for connectors A-9 through A-12.
INPUT_DIGITAL 

[2] Digital input mode.

Note
This is the default mode setting for connectors IO-0 through DI-8, and all pins on attached CCIO-8 expansion boards.
OUTPUT_ANALOG 

[3] Analog current source output mode.

OUTPUT_DIGITAL 

[4] Digital output mode.

OUTPUT_H_BRIDGE 

[5] H-Bridge mode, using differential PWM output.

OUTPUT_PWM 

[6] Periodic digital output mode, using pulse-width modulation (PWM)

OUTPUT_TONE 

[7] Tone generation mode, using H-Bridge's differential PWM output with tone generation features enabled.

OUTPUT_WAVE 

[8] Audio generation mode, playing a wave file from a flash drive.

CPM_MODE_A_DIRECT_B_DIRECT 

[9] ClearPath™ motor controller mode, compatible with operational modes that require user's direct control of the A and B input signals.

CPM_MODE_STEP_AND_DIR 

[10] ClearPath™ motor controller mode, compatible with Step and Direction operational modes.

CPM_MODE_A_DIRECT_B_PWM 

[11] ClearPath™ motor controller mode, compatible with operational modes where A is controlled by the user directly and B is controlled with a PWM signal (e.g., the Follow Digital Torque, Velocity, and/or Position commands).

CPM_MODE_A_PWM_B_PWM 

[12] ClearPath™ motor controller mode, compatible with Follow Digital Velocity: Bipolar PWM Command with Variable Torque operational mode where both inputs A and B are controlled with PWM signals.

TTL 

[13] Serial port mode, using standard TTL levels compatible with USB Serial Bridges.

RS232 

[14] Serial port mode, using inverted TTL levels to allow direct RS232 connections for ports tolerant of the lack of negative voltages.

SPI 

[15] Serial port mode, using the port in SPI mode for connections to serial devices using this format.

CCIO 

[16] Serial port mode for CCIO-8 connections.

USB_CDC 

[17] Serial port mode for USB.

◆ ConnectorTypes

The different types of ClearCore connectors.

Enumerator
DIGITAL_IN_TYPE 

[0] Digital input connector.

This connector has the following features:

  • Optional majority filtering
  • TTL or 24V input compatibility

Connectors of this type:

  • ConnectorDI6
  • ConnectorDI7
  • ConnectorDI8
DIGITAL_IN_OUT_TYPE 

[1] Digital input/output connector.

This connector has the following features:

  • Optional majority input filtering
  • TTL or 24V input compatibility
  • High power digital output

Connectors of this type:

  • ConnectorIO1
  • ConnectorIO2
  • ConnectorIO3
SHIFT_REG_TYPE 

[2] Virtual connector to access LED and configuration shift register

ANALOG_IN_DIGITAL_IN_TYPE 

[3] Analog and digital input connector.

This connector supports the following features:

  • Optional majority input filtering
  • TTL or 24V input compatibility
  • 0-10V analog input measurements

Connectors of this type:

  • ConnectorA9
  • ConnectorA10
  • ConnectorA11
  • ConnectorA12
ANALOG_OUT_DIGITAL_IN_OUT_TYPE 

[4] Digital input/output and analog output connector.

This connector supports the following features:

  • Optional majority input filtering
  • TTL or 24V input compatibility
  • High power digital output
  • 0-20mA analog current output

Connectors of this type:

  • ConnectorIO0
H_BRIDGE_TYPE 

[5] H-Bridge connector.

Utilizing V+ and IO pin as a pair these connectors can be setup to:

  • Drive a motor
  • Create tones to drive a speaker
  • Create bi-directional output via PWM

Connectors of this type:

  • ConnectorIO4
  • ConnectorIO5
See also
DIGITAL_IN_OUT_TYPE
CPM_TYPE 

[6] ClearPath™ motor connector.

This connector can control a ClearPath™ motor. Some of the control abilities available include:

  • Motor Enable
  • Step+Direction Move Generation
  • Control of the A and B inputs for use with the MC models.
  • Reading of the HLFB from ClearPath motors.

Connectors of this type:

  • ConnectorM0
  • ConnectorM1
  • ConnectorM2
  • ConnectorM3
SERIAL_TYPE 

[7] Serial port connector.

These connectors can:

  • be used as asynchronous serial ports with selectable baud rate and data formats.
  • be used as SPI master ports.

Connectors of this type:

  • ConnectorCOM0
  • ConnectorCOM1
SERIAL_USB_TYPE 

[8] Serial USB connector.

These connectors can:

  • be used as asynchronous serial ports.

Connectors of this type:

  • ConnectorUsb
CCIO_DIGITAL_IN_OUT_TYPE 

[9] ClearCore I/O Expansion Board digital I/O connector.

This connector has the following features:

  • Optional majority input filtering
  • TTL or 24V input compatibility

Member Function Documentation

◆ ConnectorIndex()

int32_t ClearCore::Connector::ConnectorIndex ( )
inline

Accessor for the bit index of this connector in the input register.

// Save IO-1's index for future use
int32_t io1Index = ConnectorIO1.ConnectorIndex();
int32_t ConnectorIndex()
Accessor for the bit index of this connector in the input register.
Definition Connector.h:380
DigitalInOut ConnectorIO1
IO-1 connector instance.
Returns
The connector bit index in the input register

◆ InputRegMask()

uint32_t ClearCore::Connector::InputRegMask ( )
inline

Get a bit mask representing this connector.

// Create a SysConnectorState mask to check IO-1
// Save whether IO-1 has risen
SysConnectorState risenInputs = InputMgr.InputsRisen(stateMask);
uint32_t InputRegMask()
Get a bit mask representing this connector.
Definition Connector.h:448
SysConnectorState InputsRisen(SysConnectorState mask=UINT32_MAX)
Clear on read accessor for inputs that have risen (transitioned from deasserted to asserted) sometime...
InputManager & InputMgr
Input manager.
Definition SysConnectors.h:174
Returns
A 32-bit mask of 0's, with a single 1 at the bit position of this connector's index. (See ClearCorePins to determine connector indices.)

◆ IsInHwFault()

virtual bool ClearCore::Connector::IsInHwFault ( )
pure virtual

Get whether the connector is in a hardware fault state.

// IO-1 is in a fault state
}
bool IsInHwFault() override
Get whether the connector is in a hardware fault state.
Definition DigitalInOut.h:187
Returns
True if the connector is in fault; false otherwise.

Implemented in ClearCore::CcioPin, ClearCore::DigitalInOut, and ClearCore::MotorDriver.

◆ IsWritable()

virtual bool ClearCore::Connector::IsWritable ( )
pure virtual

Determine whether values can be written to this connector.

// IO-1 is not currently set as an output
}
bool IsWritable() override
Get R/W status of the connector.
Definition DigitalInOut.h:132
Returns
true if this connector is writable, false if this connector is read-only.

Implemented in ClearCore::CcioPin, ClearCore::DigitalIn, ClearCore::DigitalInAnalogIn, ClearCore::DigitalInOut, ClearCore::DigitalInOutAnalogOut, ClearCore::DigitalInOutHBridge, ClearCore::LedDriver, ClearCore::MotorDriver, ClearCore::SerialDriver, and ClearCore::SerialUsb.

◆ Mode() [1/2]

virtual ConnectorModes ClearCore::Connector::Mode ( )
inlinevirtual

Get the connector's operational mode.

// IO-0 is currently an analog output.
}
@ OUTPUT_ANALOG
Definition Connector.h:94
virtual ConnectorModes Mode() override
Get the connector's operational mode.
Definition DigitalInOutAnalogOut.h:70
DigitalInOutAnalogOut ConnectorIO0
IO-0 connector instance.
Returns
The connector's current operational mode.

Reimplemented in ClearCore::CcioPin, ClearCore::DigitalIn, ClearCore::DigitalInAnalogIn, ClearCore::DigitalInOut, ClearCore::DigitalInOutAnalogOut, ClearCore::DigitalInOutHBridge, ClearCore::MotorDriver, ClearCore::SerialDriver, and ClearCore::SerialUsb.

◆ Mode() [2/2]

virtual bool ClearCore::Connector::Mode ( ConnectorModes  newMode)
pure virtual

Set the connector's operational mode.

// Set IO-0's mode to be an analog output
Parameters
[in]newModeThe new mode to be set.
Returns
Returns false if the mode is invalid or setup fails.

Implemented in ClearCore::CcioPin, ClearCore::DigitalIn, ClearCore::DigitalInAnalogIn, ClearCore::DigitalInOut, ClearCore::DigitalInOutAnalogOut, ClearCore::DigitalInOutHBridge, ClearCore::SerialDriver, and ClearCore::SerialUsb.

◆ Reinitialize()

void ClearCore::Connector::Reinitialize ( )
inline

Reinitialize this connector to the power-up state.

// IO-1 needs to be re-initialized
void Reinitialize()
Reinitialize this connector to the power-up state.
Definition Connector.h:365
Note
Connectors IO-0 through DI-8 and all CCIO-8 connectors will be set into INPUT_DIGITAL mode, while connectors A-9 through A-12 will be set into INPUT_ANALOG mode, the default modes for these connectors.

◆ State() [1/2]

virtual int16_t ClearCore::Connector::State ( )
pure virtual

Get the connector's last sampled value.

Return the current "value" for this connector. For connectors with more than one input or output the value returned here would depend on the specific connector. Access to this information would need to be provided by the implementation object.

For boolean items, this will return the values of C++ true and false. For analog items, this could be the RAW or processed ADC value, etc.

// IO-0's input is currently high
}
int16_t State() override
Get connector's last sampled digital value.
Returns
The latest sample.

Implemented in ClearCore::CcioPin, ClearCore::DigitalIn, ClearCore::DigitalInAnalogIn, ClearCore::DigitalInOut, ClearCore::DigitalInOutAnalogOut, ClearCore::DigitalInOutHBridge, and ClearCore::LedDriver.

◆ State() [2/2]

virtual bool ClearCore::Connector::State ( int16_t  newState)
pure virtual

Set the state of a R/W connector.

For read-write objects, this allows you to change the state of the connector item.

// Set IO-0's output to high
Parameters
[in]newStateFor mutable items, update the output.

Implemented in ClearCore::CcioPin, ClearCore::DigitalInOut, ClearCore::DigitalInOutAnalogOut, ClearCore::DigitalInOutHBridge, and ClearCore::LedDriver.

◆ Type()

virtual ConnectorTypes ClearCore::Connector::Type ( )
pure virtual

Get the connector type.

// IO-1 is a DigitalInOut
}
@ DIGITAL_IN_OUT_TYPE
Definition Connector.h:199
Connector::ConnectorTypes Type() override
Get connector type.
Definition DigitalInOut.h:117
Returns
Return the connector type for generic handling of connectors.

Implemented in ClearCore::CcioPin, ClearCore::DigitalIn, ClearCore::DigitalInAnalogIn, ClearCore::DigitalInOut, ClearCore::DigitalInOutAnalogOut, ClearCore::DigitalInOutHBridge, ClearCore::LedDriver, ClearCore::MotorDriver, ClearCore::SerialDriver, and ClearCore::SerialUsb.


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