summaryrefslogtreecommitdiff
path: root/src/drivers/include
diff options
context:
space:
mode:
Diffstat (limited to 'src/drivers/include')
-rw-r--r--src/drivers/include/drivers/display.hpp2
-rw-r--r--src/drivers/include/drivers/gpios.hpp22
2 files changed, 21 insertions, 3 deletions
diff --git a/src/drivers/include/drivers/display.hpp b/src/drivers/include/drivers/display.hpp
index 21ca3e2d..e5001c48 100644
--- a/src/drivers/include/drivers/display.hpp
+++ b/src/drivers/include/drivers/display.hpp
@@ -65,8 +65,6 @@ class Display {
void SendInitialisationSequence(const uint8_t* data);
void SendCommandWithData(uint8_t command, const uint8_t* data, size_t length);
- void SendCmd(const uint8_t* data, size_t length);
- void SendData(const uint8_t* data, size_t length);
void SendTransaction(TransactionType type,
const uint8_t* data,
diff --git a/src/drivers/include/drivers/gpios.hpp b/src/drivers/include/drivers/gpios.hpp
index e27a3ade..5010e45f 100644
--- a/src/drivers/include/drivers/gpios.hpp
+++ b/src/drivers/include/drivers/gpios.hpp
@@ -61,7 +61,7 @@ class IGpios {
};
/* Nicer value names for use with kSdMuxSwitch. */
- enum SdController {
+ enum SdTarget {
SD_MUX_ESP = 0,
SD_MUX_SAMD = 1,
};
@@ -80,6 +80,15 @@ class IGpios {
virtual auto Get(Pin) const -> bool = 0;
virtual auto IsLocked() const -> bool = 0;
+
+ /*
+ * Enables or disable the SD mux. When the mux is disabled, the SD card is
+ * isolated from the rest of the SPI bus.
+ */
+ virtual auto SdMuxEnable(bool en) -> void = 0;
+
+ /* Switches whether the SD card is connected to the ESP32 or SAMD21. */
+ virtual auto SdMuxTarget(SdTarget target) -> void = 0;
};
class Gpios : public IGpios {
@@ -96,6 +105,8 @@ class Gpios : public IGpios {
*/
auto WriteSync(Pin, bool) -> bool override;
+ auto ShouldRead() -> bool;
+
virtual auto WriteBuffered(Pin, bool) -> void;
/**
@@ -114,6 +125,11 @@ class Gpios : public IGpios {
*/
auto Read(void) -> bool;
+ auto SdMuxEnable(bool en) -> void override;
+ auto SdMuxTarget(SdTarget target) -> void override;
+
+ auto SdMuxTarget() -> SdTarget;
+
// Not copyable or movable. There should usually only ever be once instance
// of this class, and that instance will likely have a static lifetime.
Gpios(const Gpios&) = delete;
@@ -125,6 +141,10 @@ class Gpios : public IGpios {
std::atomic<uint16_t> ports_;
std::atomic<uint16_t> inputs_;
const bool invert_lock_switch_;
+ bool has_written_;
+
+ std::mutex mux_mutex_;
+ bool mux_en_;
};
} // namespace drivers