Speeduino
Loading...
Searching...
No Matches
inputPin.h
Go to the documentation of this file.
1#pragma once
2#include <Arduino.h>
3#include <stdint.h>
4#include "../../board_definition.h"
5
14{
15public:
18
20 bool isPinHigh(void) const;
21
23 bool isPinLow(void) const
24 {
25 return !isPinHigh();
26 }
27
29 bool isValid(void) const
30 {
31 return _pin != NOT_A_PIN;
32 }
33
34private:
35 uint8_t _pin = NOT_A_PIN;
36};
constexpr uint8_t NOT_A_PIN
Definition board_definition.h:86
A class for input pin operations.
Definition inputPin.h:14
void setPin(uint8_t pin, uint8_t mode=INPUT)
Set the input pin.
Definition inputPin.cpp:6
bool isValid(void) const
Is the pin set?
Definition inputPin.h:29
bool isPinHigh(void) const
Check if the pin is set high.
Definition inputPin.cpp:15
bool isPinLow(void) const
Check if the pin is set low.
Definition inputPin.h:23
static TIntegral readSerialIntegralTimeout(void)
Reads an integral type, timing out if necessary.
Definition comms.cpp:175