Infrared4Arduino 1.2.3
Loading...
Searching...
No Matches
Public Member Functions | Static Public Member Functions | Static Public Attributes | Protected Member Functions | List of all members
Board Class Referenceabstract

This class serves as an HAL (Hardware Abstraction Layer). More...

#include <Board.h>

Inheritance diagram for Board:
Inheritance graph
[legend]

Public Member Functions

virtual void writeLow ()
 
virtual void writeHigh ()
 
virtual void writeLow (pin_t pin)
 
virtual void writeHigh (pin_t pin)
 
void setPinMode (pin_t pin, PinMode mode)
 
bool readDigital (pin_t pin)
 
virtual pin_t getPwmPin () const
 
virtual void checkValidSendPin (pin_t pin __attribute__((unused)))
 
virtual void enableSampler (pin_t pin __attribute__((unused)))
 Start the periodic ISR sampler routine. More...
 
virtual void disableSampler ()
 Turn off sampler routine. More...
 
void enablePwm (pin_t pin, frequency_t frequency, dutycycle_t dutyCycle)
 Start PWM, making output active. More...
 
void disablePwm ()
 Turn off PWM. More...
 
void sendPwmMark (microseconds_t time)
 
virtual void timerReset ()
 TODO. More...
 

Static Public Member Functions

static void delayMicroseconds (microseconds_t)
 Version of delayMicroseconds able to grok more than 16383 micros. More...
 
static BoardgetInstance ()
 
static constexpr pin_t defaultPwmPin ()
 
static constexpr bool hasHardwarePwm ()
 
static void debugPinHigh ()
 
static void debugPinLow ()
 
static void setupDebugPin ()
 

Static Public Attributes

static const unsigned long microsPerTick = 50UL
 
static constexpr pin_t NO_PIN = 255U
 Constant indicating no or invalid pin. More...
 
static constexpr dutycycle_t defaultDutyCycle = 40
 Default duty cycle to use. More...
 

Protected Member Functions

 Board ()
 
virtual void timerEnableIntr ()=0
 Start periodic sampling routine. More...
 
virtual void timerDisableIntr ()=0
 Turn off periodic interrupts. More...
 
virtual void timerConfigHz (frequency_t hz, dutycycle_t dutyCycle=defaultDutyCycle)=0
 Configure hardware PWM, but do not enable it. More...
 
virtual void timerConfigNormal ()=0
 Disables the PWM configuration. More...
 
virtual void timerEnablePwm ()=0
 Start PWM output. More...
 
virtual void timerDisablePwm ()=0
 Turn off PWM output. More...
 

Detailed Description

This class serves as an HAL (Hardware Abstraction Layer).

All access to the hardware should go through this class. (In particular, using digital[Read,Write] and ::pinMode is prohibited (exception: code that runs exclusively on the host).

It is a singleton class (since there is only one board), instantiated automatically to one of its subclasses.

Definition at line 33 of file Board.h.

Constructor & Destructor Documentation

◆ Board()

Board::Board ( )
inlineprotected

Definition at line 35 of file Board.h.

Member Function Documentation

◆ checkValidSendPin()

virtual void Board::checkValidSendPin ( pin_t pin   __attribute__(unused))
inlinevirtual

Definition at line 59 of file Board.h.

◆ debugPinHigh()

void Board::debugPinHigh ( )
inlinestatic

Definition at line 274 of file Board.h.

◆ debugPinLow()

void Board::debugPinLow ( )
inlinestatic

Definition at line 280 of file Board.h.

◆ defaultPwmPin()

constexpr pin_t Board::defaultPwmPin ( )
inlinestaticconstexpr

Definition at line 296 of file Board.h.

◆ delayMicroseconds()

void Board::delayMicroseconds ( microseconds_t  t)
static

Version of delayMicroseconds able to grok more than 16383 micros.

Parameters
tdelay time in microseconds_t

Definition at line 25 of file Board.cpp.

◆ disablePwm()

void Board::disablePwm ( )
inline

Turn off PWM.

Definition at line 103 of file Board.h.

◆ disableSampler()

virtual void Board::disableSampler ( )
inlinevirtual

Turn off sampler routine.

Definition at line 83 of file Board.h.

◆ enablePwm()

void Board::enablePwm ( pin_t  pin,
frequency_t  frequency,
dutycycle_t  dutyCycle 
)
inline

Start PWM, making output active.

Parameters
pin
frequency
dutyCycle

Definition at line 93 of file Board.h.

◆ enableSampler()

virtual void Board::enableSampler ( pin_t pin   __attribute__(unused))
inlinevirtual

Start the periodic ISR sampler routine.

Called from IrReceiveSampler.

Definition at line 74 of file Board.h.

◆ getInstance()

static Board * Board::getInstance ( )
inlinestatic

Definition at line 53 of file Board.h.

◆ getPwmPin()

pin_t Board::getPwmPin ( ) const
inlinevirtual

Definition at line 297 of file Board.h.

◆ hasHardwarePwm()

constexpr bool Board::hasHardwarePwm ( )
inlinestaticconstexpr

Definition at line 293 of file Board.h.

◆ readDigital()

bool Board::readDigital ( pin_t  pin)
inline

Definition at line 49 of file Board.h.

◆ sendPwmMark()

void Board::sendPwmMark ( microseconds_t  time)
inline

Definition at line 106 of file Board.h.

◆ setPinMode()

void Board::setPinMode ( pin_t  pin,
PinMode  mode 
)
inline

Definition at line 48 of file Board.h.

◆ setupDebugPin()

void Board::setupDebugPin ( )
inlinestatic

Definition at line 268 of file Board.h.

◆ timerConfigHz()

virtual void Board::timerConfigHz ( frequency_t  hz,
dutycycle_t  dutyCycle = defaultDutyCycle 
)
protectedpure virtual

Configure hardware PWM, but do not enable it.

Implemented in ATmega328P.

◆ timerConfigNormal()

virtual void Board::timerConfigNormal ( )
protectedpure virtual

Disables the PWM configuration.

Implemented in ATmega328P.

◆ timerDisableIntr()

virtual void Board::timerDisableIntr ( )
protectedpure virtual

Turn off periodic interrupts.

Implemented in ATmega328P.

◆ timerDisablePwm()

virtual void Board::timerDisablePwm ( )
protectedpure virtual

Turn off PWM output.

Implemented in ATmega328P.

◆ timerEnableIntr()

virtual void Board::timerEnableIntr ( )
protectedpure virtual

Start periodic sampling routine.

Implemented in ATmega328P.

◆ timerEnablePwm()

virtual void Board::timerEnablePwm ( )
protectedpure virtual

Start PWM output.

Implemented in ATmega328P.

◆ timerReset()

virtual void Board::timerReset ( )
inlinevirtual

TODO.

Definition at line 115 of file Board.h.

◆ writeHigh() [1/2]

void Board::writeHigh ( )
inlinevirtual

Definition at line 299 of file Board.h.

◆ writeHigh() [2/2]

virtual void Board::writeHigh ( pin_t  pin)
inlinevirtual

Definition at line 46 of file Board.h.

◆ writeLow() [1/2]

void Board::writeLow ( )
inlinevirtual

Definition at line 298 of file Board.h.

◆ writeLow() [2/2]

virtual void Board::writeLow ( pin_t  pin)
inlinevirtual

Definition at line 45 of file Board.h.

Member Data Documentation

◆ defaultDutyCycle

constexpr dutycycle_t Board::defaultDutyCycle = 40
staticconstexpr

Default duty cycle to use.

Do not confuse with IrSignal::defaultDutyCycle.

Definition at line 69 of file Board.h.

◆ microsPerTick

const unsigned long Board::microsPerTick = 50UL
static

Definition at line 57 of file Board.h.

◆ NO_PIN

constexpr pin_t Board::NO_PIN = 255U
staticconstexpr

Constant indicating no or invalid pin.

Definition at line 64 of file Board.h.


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