AceSegment  0.4.0
An adjustable, configurable, and extensible framework for rendering seven segment LED displays.
Hardware.h
1 /*
2 MIT License
3 
4 Copyright (c) 2018 Brian T. Park
5 
6 Permission is hereby granted, free of charge, to any person obtaining a copy
7 of this software and associated documentation files (the "Software"), to deal
8 in the Software without restriction, including without limitation the rights
9 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 copies of the Software, and to permit persons to whom the Software is
11 furnished to do so, subject to the following conditions:
12 
13 The above copyright notice and this permission notice shall be included in all
14 copies or substantial portions of the Software.
15 
16 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22 SOFTWARE.
23 */
24 
25 #ifndef ACE_SEGMENT_HARDWARE_H
26 #define ACE_SEGMENT_HARDWARE_H
27 
28 #include <stdint.h>
29 #include <Arduino.h>
30 
31 namespace ace_segment {
32 
38 class Hardware {
39  public:
41  void digitalWrite(uint8_t pin, uint8_t value) const {
42  #if defined(ARDUINO_API_VERSION)
43  arduino::digitalWrite(pin, value);
44  #else
45  ::digitalWrite(pin, value);
46  #endif
47  }
48 
50  void pinMode(uint8_t pin, uint8_t mode) const {
51  #if defined(ARDUINO_API_VERSION)
52  arduino::pinMode(pin, mode);
53  #else
54  ::pinMode(pin, mode);
55  #endif
56  }
57 
59  unsigned long micros() const {
60  return ::micros();
61  }
62 
64  unsigned long millis() const {
65  return ::millis();
66  }
67 };
68 
69 }
70 
71 #endif
ace_segment::Hardware
Class that provides a layer of indirection to various hardware pins and timing class.
Definition: Hardware.h:38
ace_segment::Hardware::millis
unsigned long millis() const
Get the current millis
Definition: Hardware.h:64
ace_segment::Hardware::pinMode
void pinMode(uint8_t pin, uint8_t mode) const
Set pin mode.
Definition: Hardware.h:50
ace_segment::Hardware::micros
unsigned long micros() const
Get the current micros
Definition: Hardware.h:59
ace_segment::Hardware::digitalWrite
void digitalWrite(uint8_t pin, uint8_t value) const
Write value to pin.
Definition: Hardware.h:41