Skip to content

Class hal::interrupt_pin

ClassList > hal > interrupt_pin

Digital interrupt pin hardware abstraction. More...

  • #include <interrupt_pin.hpp>

Inherited by the following classes: hal::lpc40::interrupt_pin, hal::mock::interrupt_pin, hal::soft::inert_interrupt_pin

Classes

Type Name
struct settings
Generic settings for interrupt pins.

Public Types

Type Name
typedef void(bool p_state) handler
Interrupt pin handler.
enum trigger_edge
The condition in which an interrupt it's triggered.

Public Functions

Type Name
status configure (const settings & p_settings)
Configure the interrupt pin to match the settings supplied.
void on_trigger (hal::callback< handler > p_callback)
Set the callback for when the interrupt occurs.
virtual ~interrupt_pin () = default

Detailed Description

Use this to automatically call a function when a pin's state has transitioned.

The transition states are:

  • falling edge: the pin reads a transitions from HIGH to LOW
  • rising edge: the pin reads a transitions from LOW to HIGH
  • both: the pin reads any state change

Public Types Documentation

typedef handler

Interrupt pin handler.

using hal::interrupt_pin::handler =  void(bool p_state);

param p_state - if true state of the pin when the interrupt was triggered was HIGH, otherwise LOW

enum trigger_edge

enum hal::interrupt_pin::trigger_edge {
    falling = 0,
    rising = 1,
    both = 2
};

Public Functions Documentation

function configure

Configure the interrupt pin to match the settings supplied.

inline status hal::interrupt_pin::configure (
    const settings & p_settings
) 

Parameters:

  • p_settings - settings to apply to interrupt pin

Returns:

status - success or failure

Exception:

  • std::errc::invalid_argument if the settings could not be achieved.

function on_trigger

Set the callback for when the interrupt occurs.

inline void hal::interrupt_pin::on_trigger (
    hal::callback < handler > p_callback
) 

Any state transitions before this function is called are lost.

Parameters:

  • p_callback - function to execute when the trigger condition occurs.

function ~interrupt_pin

virtual hal::interrupt_pin::~interrupt_pin () = default

The documentation for this class was generated from the following file libraries/include/libhal/interrupt_pin.hpp