summaryrefslogtreecommitdiffstats
path: root/Sensor Watch Starter Project/hpl/slcd/hpl_slcd_cm_7_seg_mapping.h
diff options
context:
space:
mode:
authorJoey Castillo <jose.castillo@gmail.com>2021-07-20 16:26:54 -0400
committerJoey Castillo <jose.castillo@gmail.com>2021-07-20 16:26:54 -0400
commitb4b81f476c991a8d1620e1a9e010fcff847b3c04 (patch)
treeb84acced159d862c078855fcfebe0f3db7607d7b /Sensor Watch Starter Project/hpl/slcd/hpl_slcd_cm_7_seg_mapping.h
parentbc1ee49d80252defad1fcf0723cd4af68a374c06 (diff)
downloadSensor-Watch-b4b81f476c991a8d1620e1a9e010fcff847b3c04.tar.gz
Sensor-Watch-b4b81f476c991a8d1620e1a9e010fcff847b3c04.tar.bz2
Sensor-Watch-b4b81f476c991a8d1620e1a9e010fcff847b3c04.zip
bring in all the atmel studio stuff
Diffstat (limited to 'Sensor Watch Starter Project/hpl/slcd/hpl_slcd_cm_7_seg_mapping.h')
-rw-r--r--Sensor Watch Starter Project/hpl/slcd/hpl_slcd_cm_7_seg_mapping.h68
1 files changed, 68 insertions, 0 deletions
diff --git a/Sensor Watch Starter Project/hpl/slcd/hpl_slcd_cm_7_seg_mapping.h b/Sensor Watch Starter Project/hpl/slcd/hpl_slcd_cm_7_seg_mapping.h
new file mode 100644
index 00000000..eae344c8
--- /dev/null
+++ b/Sensor Watch Starter Project/hpl/slcd/hpl_slcd_cm_7_seg_mapping.h
@@ -0,0 +1,68 @@
+#include <hpl_slcd_config.h>
+
+/**
+ * character segments position index
+ *
+ * For a 7 segments character, each segment has an unique position index.
+ * The segment layout and position index value is shown as below.
+ * The symbol '-', '|' represent the SLCD character segment, and the
+ * number represent each segment's position index, which equals to macro
+ * SEG7_0 to SEG7_7.
+ * The character lookup mapping table use those position index (SEG7_0..SEG7_7)
+ * to compose some visible arabic numerals, letters or some specific ASCII.
+ * For example char '0' can be represented by use position index 0,1,2,3,4,5.
+ * (SEG7_0 | SEG7_1 | SEG7_2 | SEG7_3 | SEG7_4 | SEG7_5).
+ * More predefined character lookup can be found at below "7-segments character
+ * lookup mapping table"
+ * -0
+ * |5 |1
+ * -6
+ * |4 |2
+ * -3
+ */
+
+/**
+ * Character segment position remapping setting
+ *
+ * An SLCD screen typically use several hardware segments to display a
+ * character(for example from COM3/SEG0 to COM3/SEG7).
+ * The lowest COM and SEG index is 0 (COM3/SEG0 index is 0).
+ * The "hardware character segments index" maybe different with the "character
+ * segments position index". The remapping setting allow application to adjust
+ * those sequence.
+ *
+ */
+#define SEG7_0 (0x1 << CONF_SLCD_CM_7SEGS_0_SETTING)
+#define SEG7_1 (0x1 << CONF_SLCD_CM_7SEGS_1_SETTING)
+#define SEG7_2 (0x1 << CONF_SLCD_CM_7SEGS_2_SETTING)
+#define SEG7_3 (0x1 << CONF_SLCD_CM_7SEGS_3_SETTING)
+#define SEG7_4 (0x1 << CONF_SLCD_CM_7SEGS_4_SETTING)
+#define SEG7_5 (0x1 << CONF_SLCD_CM_7SEGS_5_SETTING)
+#define SEG7_6 (0x1 << CONF_SLCD_CM_7SEGS_6_SETTING)
+
+/**
+ * 7-segments character mask value
+ */
+#define SEG7_MASK (0xFFFFFF & ~(SEG7_0 | SEG7_1 | SEG7_2 | SEG7_3 | SEG7_4 | SEG7_5 | SEG7_6))
+
+/**
+ * 7-segments character lookup mapping table.
+ *
+ * Array value of slcd_char_mapping struct, application can add or remove
+ * item from it.
+ */
+#define SLCD_SEG7_LUT \
+ { \
+ {0, 0}, {'0', SEG7_0 | SEG7_1 | SEG7_2 | SEG7_3 | SEG7_4 | SEG7_5}, {'1', SEG7_1 | SEG7_2}, \
+ {'2', SEG7_0 | SEG7_1 | SEG7_3 | SEG7_4 | SEG7_6}, {'3', SEG7_0 | SEG7_1 | SEG7_2 | SEG7_3 | SEG7_6}, \
+ {'4', SEG7_1 | SEG7_2 | SEG7_5 | SEG7_6}, {'5', SEG7_0 | SEG7_2 | SEG7_3 | SEG7_5 | SEG7_6}, \
+ {'6', SEG7_0 | SEG7_2 | SEG7_3 | SEG7_4 | SEG7_5 | SEG7_6}, {'7', SEG7_0 | SEG7_1 | SEG7_2}, \
+ {'8', SEG7_0 | SEG7_1 | SEG7_2 | SEG7_3 | SEG7_4 | SEG7_5 | SEG7_6}, \
+ {'9', SEG7_0 | SEG7_1 | SEG7_2 | SEG7_5 | SEG7_6}, \
+ {'a', SEG7_0 | SEG7_1 | SEG7_2 | SEG7_4 | SEG7_5 | SEG7_6}, \
+ {'b', SEG7_2 | SEG7_3 | SEG7_4 | SEG7_5 | SEG7_6}, {'c', SEG7_0 | SEG7_3 | SEG7_4 | SEG7_5}, \
+ {'d', SEG7_1 | SEG7_2 | SEG7_3 | SEG7_4 | SEG7_6}, {'e', SEG7_0 | SEG7_3 | SEG7_4 | SEG7_5 | SEG7_6}, \
+ { \
+ 'f', SEG7_0 | SEG7_4 | SEG7_5 | SEG7_6 \
+ } \
+ }