Peritoneal Dialysis Capstone
Controlling catheter for peritoneal dialysis
Loading...
Searching...
No Matches
IHAL Class Referenceabstract

A hardware abstraction layer interface. More...

#include <IHAL.h>

Inheritance diagram for IHAL:

Public Member Functions

virtual ~IHAL ()=default
virtual AnalogValue analogRead (int pin)=0
 Samples an analog input pin.
virtual void analogWrite (int pin, AnalogValue value)=0
 Drives an analog output pin.
virtual AnalogValue getMaxAnalogReadQuant () const =0
 Returns the maximum quantized value of an analog read.
virtual AnalogValue getMaxAnalogWriteQuant () const =0
 Returns the maximum quantized value of an analog write.
virtual void configurePin (int pin, PinMode mode)=0
 Configures a pin for use as an input or output.
virtual DigitalValue digitalRead (int pin)=0
 Samples a digital input pin.
virtual void digitalWrite (int pin, DigitalValue value)=0
 Drives a digital output pin.
virtual void beginSerial ()=0
 Initializes the serial interface.
virtual size_t print (const char *s)=0
 Transmits an ASCII string over serial.
virtual size_t println (const char *s)=0
 Transmits an ASCII string with trailing newline over serial.
virtual void delayMs (unsigned long durationMs)=0
 Suspends execution for a specified duration in milliseconds.
virtual unsigned long getTimeMs ()=0
 Returns the number of milliseconds elapsed since the start of execution, modulo ULONG_MAX-1.

Detailed Description

A hardware abstraction layer interface.

This interface defines all the microcontroller operations needed by the application. It can be implemented for different platforms (e.g., Arduino, Raspberry Pi, ESP8266 etc.) to port the application to them.

Constructor & Destructor Documentation

◆ ~IHAL()

virtual IHAL::~IHAL ( )
virtualdefault

Member Function Documentation

◆ analogRead()

virtual AnalogValue IHAL::analogRead ( int pin)
pure virtual

Samples an analog input pin.

The pin must be valid for analog reading.

Parameters
pinThe pin number.
Returns
The quantized value in the range [0, N] where N is the maximum value indicated by getMaxAnalogReadQuant.

Implemented in ArduinoHAL.

◆ analogWrite()

virtual void IHAL::analogWrite ( int pin,
AnalogValue value )
pure virtual

Drives an analog output pin.

The pin must be valid for analog writing.

Parameters
pinThe pin number.
valueThe quantized value to write. Must be in the range [0, N] where N is the maximum value indicated by getMaxAnalogWriteQuant.

Implemented in ArduinoHAL.

◆ beginSerial()

virtual void IHAL::beginSerial ( )
pure virtual

Initializes the serial interface.

This method must be called before using the serial print functions.

Implemented in ArduinoHAL.

◆ configurePin()

virtual void IHAL::configurePin ( int pin,
PinMode mode )
pure virtual

Configures a pin for use as an input or output.

Parameters
pinThe pin number.
modeThe mode (input or output) to set.

Implemented in ArduinoHAL.

◆ delayMs()

virtual void IHAL::delayMs ( unsigned long durationMs)
pure virtual

Suspends execution for a specified duration in milliseconds.

Parameters
durationMsThe duration in milliseconds.

Implemented in ArduinoHAL.

◆ digitalRead()

virtual DigitalValue IHAL::digitalRead ( int pin)
pure virtual

Samples a digital input pin.

The pin must be valid for digital reading.

Parameters
pinThe pin number.
Returns
The digital value.

Implemented in ArduinoHAL.

◆ digitalWrite()

virtual void IHAL::digitalWrite ( int pin,
DigitalValue value )
pure virtual

Drives a digital output pin.

The pin must be valid for digital writing.

Parameters
pinThe pin number.
valueThe digital value to write.

Implemented in ArduinoHAL.

◆ getMaxAnalogReadQuant()

virtual AnalogValue IHAL::getMaxAnalogReadQuant ( ) const
pure virtual

Returns the maximum quantized value of an analog read.

For an analog read, a real input value in the range [0, 1] can be obtained by dividing the quantized value by this maximum value.

Implemented in ArduinoHAL.

◆ getMaxAnalogWriteQuant()

virtual AnalogValue IHAL::getMaxAnalogWriteQuant ( ) const
pure virtual

Returns the maximum quantized value of an analog write.

For an analog write, a real output value in the range [0, 1] can be converted to a quantized value by multiplying by this maximum value.

Implemented in ArduinoHAL.

◆ getTimeMs()

virtual unsigned long IHAL::getTimeMs ( )
pure virtual

Returns the number of milliseconds elapsed since the start of execution, modulo ULONG_MAX-1.

Implemented in ArduinoHAL.

◆ print()

virtual size_t IHAL::print ( const char * s)
pure virtual

Transmits an ASCII string over serial.

Parameters
sThe NUL-terminated ASCII string to write.
Returns
The number of bytes written.

Implemented in ArduinoHAL.

◆ println()

virtual size_t IHAL::println ( const char * s)
pure virtual

Transmits an ASCII string with trailing newline over serial.

The string s is written, followed by an appropriate end-of-line indicator (e.g., CR-LF).

Parameters
sThe NUL-terminated ASCII string to write.
Returns
The number of bytes written.

Implemented in ArduinoHAL.


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