aboutsummaryrefslogtreecommitdiff
path: root/src/tm1637.h
diff options
context:
space:
mode:
authorlonkaars <loek@pipeframe.xyz>2022-03-19 11:24:39 +0100
committerlonkaars <loek@pipeframe.xyz>2022-03-19 11:24:39 +0100
commitb3344df3e3a3594f133c2c051df981d75e0112b8 (patch)
tree2c61bc9d4c67afa9b6d9794fdad041bc85260927 /src/tm1637.h
initial commit (i think my display is broken)
Diffstat (limited to 'src/tm1637.h')
-rw-r--r--src/tm1637.h29
1 files changed, 29 insertions, 0 deletions
diff --git a/src/tm1637.h b/src/tm1637.h
new file mode 100644
index 0000000..b9fa42c
--- /dev/null
+++ b/src/tm1637.h
@@ -0,0 +1,29 @@
+#pragma once
+
+#include <stdint.h>
+#include <stdbool.h>
+
+typedef struct {
+ uint8_t* data;
+ uint32_t length;
+} TM1637Sequence;
+
+/** @brief configure registers for tm1637 */
+void tm1637_begin();
+
+/**
+ * @brief configure display brightness
+ * @param brightness display brightness from 0 (dim) to 7 (bright)
+ * @param on whether the display is on
+ */
+void tm1637_dispcfg(uint8_t brightness, bool on);
+
+/**
+ * @brief send segment data to display
+ * @param segment address segment 0-3
+ * @param data data to set to segment where LSB=A and MSB-1=G. on segment 1 MSB=colon
+ */
+void tm1637_segmentsend(uint8_t segment, uint8_t data);
+
+
+TM1637Sequence _tm1637_send(TM1637Sequence command);