fiber
Loading...
Searching...
No Matches
fiber::cPin Concept Reference

Concept for tri-state pin (high, low, input) that can be immediatelly read from and written to. More...

#include <cPin.hpp>

Concept definition

template<class Pin>
concept fiber::cPin = requires(Pin pin, bool boolean){
{ pin.high() } -> std::same_as<void>;
{ pin.low() } -> std::same_as<void>;
{ pin.write(boolean) } -> std::same_as<void>;
{ pin.input() } -> std::same_as<void>;
{ pin.output() } -> std::same_as<void>;
{ pin.dir(boolean) } -> std::same_as<void>;
{ pin.is_high() } -> std::same_as<bool>;
{ pin.is_low() } -> std::same_as<bool>;
{ pin.read() } -> std::same_as<bool>;
}
Concept for tri-state pin (high, low, input) that can be immediatelly read from and written to.
Definition cPin.hpp:175

Detailed Description

Concept for tri-state pin (high, low, input) that can be immediatelly read from and written to.

For pin without any practical delay, like pins of the micro controller.

Implements the following interface:


void write(bool b);

sets the pin output level to the passed state

  • param b: the new state for the pin
    • true: logic high
    • false: logic low

void high();

sets the pin to logic high


void low();

sets the pin to logic low


void dir(bool b);

sets the pin direction to the passed state

  • param b: the new direction for the pin
    • true: input
    • false: output

void input();

configurates the pin as an input-pin that can be read from.


void output();

configurates the pin as an output pin that can be written to


[[nodiscard]] bool read() ;

Returns: the logic value applied to the pin.


[[nodiscard]] bool is_high() ;

Returns: true is the pin is set to logic high.


[[nodiscard]] bool is_low() ;