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

Member Enumeration Documentation

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.

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

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();
Returns
The connector bit index in the input register
uint32_t ClearCore::Connector::InputRegMask ( )
inline

Get a bit mask representing this connector.

// Create a SysConnectorState mask to check IO-1
SysConnectorState stateMask(ConnectorIO1.InputRegMask());
// Save whether IO-1 has risen
SysConnectorState risenInputs = InputMgr.InputsRisen(stateMask);
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.)
virtual bool ClearCore::Connector::IsInHwFault ( )
pure virtual

Get whether the connector is in a hardware fault state.

// IO-1 is in a fault state
}
Returns
True if the connector is in fault; false otherwise.

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

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
}
Returns
true if this connector is writable, false if this connector is read-only.

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

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

Get the connector's operational mode.

// IO-0 is currently an analog output.
}
Returns
The connector's current operational mode.

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

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::SerialUsb, ClearCore::DigitalIn, ClearCore::DigitalInOutHBridge, ClearCore::DigitalInAnalogIn, ClearCore::DigitalInOut, ClearCore::SerialDriver, ClearCore::CcioPin, and ClearCore::DigitalInOutAnalogOut.

void ClearCore::Connector::Reinitialize ( )
inline

Reinitialize this connector to the power-up state.

// IO-1 needs to be re-initialized
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.
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
}
Returns
The latest sample.

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

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::DigitalInOutHBridge, ClearCore::DigitalInOut, ClearCore::DigitalInOutAnalogOut, ClearCore::CcioPin, and ClearCore::LedDriver.

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

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