summaryrefslogtreecommitdiffstats
path: root/hal/pin.hpp
diff options
context:
space:
mode:
authorNao Pross <naopross@thearcway.org>2018-05-05 18:35:39 +0200
committerNao Pross <naopross@thearcway.org>2018-05-05 18:35:39 +0200
commit7c6e90299de97b51f6ba17d1a50cedb824d0c82f (patch)
tree2a032bbec8a11e1b5f7a189ff2750936982576fc /hal/pin.hpp
parentFix split() (diff)
downloadSAMLiquidSmoke-7c6e90299de97b51f6ba17d1a50cedb824d0c82f.tar.gz
SAMLiquidSmoke-7c6e90299de97b51f6ba17d1a50cedb824d0c82f.zip
Add gpio::is_set() to read from _latch register, update command parsing
Diffstat (limited to 'hal/pin.hpp')
-rw-r--r--hal/pin.hpp12
1 files changed, 10 insertions, 2 deletions
diff --git a/hal/pin.hpp b/hal/pin.hpp
index bbb80dc..ab9d3ad 100644
--- a/hal/pin.hpp
+++ b/hal/pin.hpp
@@ -17,12 +17,19 @@ class gpio
public:
virtual ~gpio() {}
- // digital functions
+ // digital mode methods
virtual void set_mode(unsigned m) = 0;
+
+ // digital output methods
virtual void set(unsigned s) = 0;
- virtual unsigned read() const = 0;
+ virtual unsigned is_set() const = 0;
virtual void toggle() = 0;
+ // digital input methods
+ virtual unsigned read() const = 0;
+
+ // TODO: analog mode methods
+
protected:
gpio() {}
};
@@ -47,6 +54,7 @@ public:
void set_mode(mode m);
unsigned read() const;
+ unsigned is_set() const;
void set(unsigned s);
void set(state s);