Speeduino
Loading...
Searching...
No Matches
digitalPin.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:
16
18 void setPin(uint8_t pin, uint8_t mode) noexcept;
19
21 bool isValid(void) const
22 {
23 return _pin != NOT_A_PIN;
24 }
25
27 bool isPinHigh(void) const noexcept;
28
30 bool isPinLow(void) const noexcept
31 {
32 return !isPinHigh();
33 }
34
36 void setPinHigh(void) noexcept;
37
39 void setPinLow(void) noexcept;
40
41private:
42 uint8_t _pin = NOT_A_PIN;
43#if defined(UNIT_TEST)
44 bool _pinState = LOW;
45#endif
46};
constexpr uint8_t NOT_A_PIN
Definition board_definition.h:92
A class for input pin operations.
Definition digitalPin.h:14
bool isValid(void) const
Is the pin set?
Definition digitalPin.h:21
void setPinHigh(void) noexcept
Set the pin high.
Definition digitalPin.cpp:17
void setPin(uint8_t pin, uint8_t mode) noexcept
Set the input pin.
Definition digitalPin.cpp:7
void setPinLow(void) noexcept
Set the pin low.
Definition digitalPin.cpp:29
bool isPinHigh(void) const noexcept
Check if the pin is set high.
Definition digitalPin.cpp:40
bool isPinLow(void) const noexcept
Check if the pin is set low.
Definition digitalPin.h:30
Definition array.h:14