29#ifndef __DIGITALIN_H__
30#define __DIGITALIN_H__
75#ifndef HIDE_FROM_DOXYGEN
125 uint16_t samples = (units ==
FILTER_UNIT_MS) ? 5 * length : length;
126 m_filterLength = samples;
127 m_filterTicksLeft = samples;
147 return m_filterLength;
229#ifndef HIDE_FROM_DOXYGEN
249 bool State(int16_t newState)
override {
281#ifndef HIDE_FROM_DOXYGEN
298 int8_t ExternalInterrupt()
override {
341 InputManager::InterruptTrigger::RISING,
363 ShiftRegister::Masks m_ledMask;
366 uint32_t m_inputPort;
367 uint32_t m_inputDataBit;
368 uint32_t m_inputDataMask;
372 bool m_interruptAvail;
374 uint32_t *m_changeRegPtr;
375 uint32_t *m_inRegPtr;
376 uint32_t *m_inputRegRTPtr;
379 bool m_stateFiltered;
382 uint16_t m_filterLength;
384 uint16_t m_filterTicksLeft;
389 DigitalIn(
enum ShiftRegister::Masks ledMask,
390 const PeripheralRoute *inputInfo);
402 void Refresh()
override;
412 void UpdateFilterState();
Base class for all connector classes.
Defines the Peripheral Route structure, used in HardwareMapping.
LED shift register access class.
ClearCorePins
ClearCore PIN definitions.
Definition SysConnectors.h:54
Base class for interacting with all ClearCore connector objects.
Definition Connector.h:62
virtual bool IsInHwFault()=0
Get whether the connector is in a hardware fault state.
virtual ConnectorModes Mode()
Get the connector's operational mode.
Definition Connector.h:309
ConnectorModes
All possible operational modes for a connector.
Definition Connector.h:74
@ INPUT_DIGITAL
Definition Connector.h:90
ConnectorTypes
The different types of ClearCore connectors.
Definition Connector.h:172
@ DIGITAL_IN_TYPE
Definition Connector.h:185
ClearCore digital input connector class.
Definition DigitalIn.h:70
void InterruptEnable(bool enable)
Enable or disable the interrupt on this connector.
virtual ConnectorModes Mode() override
Get the connector's operational mode.
Definition DigitalIn.h:161
uint16_t FilterLength()
Get the connector's digital filter length in samples. The default is 3 samples.
Definition DigitalIn.h:146
void FilterLength(uint16_t length, FilterUnits units=FILTER_UNIT_SAMPLES)
Set the connector's digital transition filter length. The default digital filter length for digital i...
Definition DigitalIn.h:122
Connector::ConnectorTypes Type() override
Get connector type.
Definition DigitalIn.h:193
bool InterruptHandlerSet(voidFuncPtr callback=nullptr, InputManager::InterruptTrigger trigger=InputManager::InterruptTrigger::RISING, bool enable=true)
Register the interrupt service routine to be triggered when the given input state condition is met on...
virtual bool Mode(ConnectorModes newMode) override
Set the connector's operational mode.
Definition DigitalIn.h:172
bool InputRisen()
Clear on read accessor for this connector's rising input state.
int16_t State() override
Get the connector's last majority-filtered sampled value.
bool InputFallen()
Clear on read accessor for this connector's falling input state.
FilterUnits
Units for the digital filter length.
Definition DigitalIn.h:91
@ FILTER_UNIT_SAMPLES
Definition DigitalIn.h:95
@ FILTER_UNIT_MS
Definition DigitalIn.h:93
bool IsWritable() override
Get R/W status of the connector.
Definition DigitalIn.h:208
ClearCore Board Supervisory System Manager.
Definition SysManager.h:58
Namespace to encompass the ClearCore board API.
Definition AdcManager.h:36
void(* voidFuncPtr)(void)
Definition DigitalIn.h:43