summaryrefslogtreecommitdiff
path: root/src/drivers/include/gpios.hpp
diff options
context:
space:
mode:
authorjacqueline <me@jacqueline.id.au>2024-03-20 11:43:33 +1100
committerjacqueline <me@jacqueline.id.au>2024-03-20 11:43:33 +1100
commita05d93a1e26181237a76da5ce398c6b08497d591 (patch)
tree3c71ba717dbb04b398ef3f19ad1ac0e0eaab3f98 /src/drivers/include/gpios.hpp
parent46e67437717975c10c62775a3f40bec84ac4f44c (diff)
downloadtangara-fw-a05d93a1e26181237a76da5ce398c6b08497d591.tar.gz
Start using the lock switch polarity bit in nvs
Diffstat (limited to 'src/drivers/include/gpios.hpp')
-rw-r--r--src/drivers/include/gpios.hpp9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/drivers/include/gpios.hpp b/src/drivers/include/gpios.hpp
index 55486be7..e27a3ade 100644
--- a/src/drivers/include/gpios.hpp
+++ b/src/drivers/include/gpios.hpp
@@ -79,12 +79,12 @@ class IGpios {
*/
virtual auto Get(Pin) const -> bool = 0;
- virtual auto IsLocked() const -> bool { return Get(Pin::kKeyLock); }
+ virtual auto IsLocked() const -> bool = 0;
};
class Gpios : public IGpios {
public:
- static auto Create() -> Gpios*;
+ static auto Create(bool invert_lock_switch) -> Gpios*;
~Gpios();
/*
@@ -106,6 +106,8 @@ class Gpios : public IGpios {
auto Get(Pin) const -> bool override;
+ auto IsLocked() const -> bool override;
+
/**
* Reads from the GPIO expander, populating `inputs` with the most recent
* values.
@@ -118,10 +120,11 @@ class Gpios : public IGpios {
Gpios& operator=(const Gpios&) = delete;
private:
- Gpios();
+ Gpios(bool invert_lock);
std::atomic<uint16_t> ports_;
std::atomic<uint16_t> inputs_;
+ const bool invert_lock_switch_;
};
} // namespace drivers