summaryrefslogtreecommitdiff
path: root/keyboards/ergodox/ergodone/expander.h
diff options
context:
space:
mode:
authorYu He <yuhe00@gmail.com>2017-08-12 16:05:05 +0200
committerJack Humbert <jack.humb@gmail.com>2017-08-16 17:31:12 -0400
commit52f4a38cb39e3640e0479b794815eae38a49f503 (patch)
treede79702f626281ee44f68c6c543db750e09c55de /keyboards/ergodox/ergodone/expander.h
parentf02430b131961e97e06a8f57719f48fdbe4a2fe8 (diff)
Add support for the ErgoDone
Diffstat (limited to 'keyboards/ergodox/ergodone/expander.h')
-rw-r--r--keyboards/ergodox/ergodone/expander.h48
1 files changed, 48 insertions, 0 deletions
diff --git a/keyboards/ergodox/ergodone/expander.h b/keyboards/ergodox/ergodone/expander.h
new file mode 100644
index 0000000000..8676fed693
--- /dev/null
+++ b/keyboards/ergodox/ergodone/expander.h
@@ -0,0 +1,48 @@
+#ifndef EXPANDER_H
+#define EXPANDER_H
+
+#include <stdint.h>
+#include "matrix.h"
+
+#define MCP23017
+#define MCP23017_A0 0
+#define MCP23017_A1 0
+#define MCP23017_A2 0
+
+#ifdef MCP23017
+#define EXPANDER_ADDR ((0x20|(MCP23017_A0<<0)|(MCP23017_A1<<1)|(MCP23017_A2<<2)) << 1)
+enum EXPANDER_REG_BANK0 {
+ EXPANDER_REG_IODIRA = 0,
+ EXPANDER_REG_IODIRB,
+ EXPANDER_REG_IPOLA,
+ EXPANDER_REG_IPOLB,
+ EXPANDER_REG_GPINTENA,
+ EXPANDER_REG_GPINTENB,
+ EXPANDER_REG_DEFVALA,
+ EXPANDER_REG_DEFVALB,
+ EXPANDER_REG_INTCONA,
+ EXPANDER_REG_INTCONB,
+ EXPANDER_REG_IOCONA,
+ EXPANDER_REG_IOCONB,
+ EXPANDER_REG_GPPUA,
+ EXPANDER_REG_GPPUB,
+ EXPANDER_REG_INTFA,
+ EXPANDER_REG_INTFB,
+ EXPANDER_REG_INTCAPA,
+ EXPANDER_REG_INTCAPB,
+ EXPANDER_REG_GPIOA,
+ EXPANDER_REG_GPIOB,
+ EXPANDER_REG_OLATA,
+ EXPANDER_REG_OLATB
+};
+#endif
+
+void expander_init(void);
+void expander_scan(void);
+void expander_read_cols(void);
+uint8_t expander_get_col(uint8_t col);
+matrix_row_t expander_read_row(void);
+void expander_unselect_rows(void);
+void expander_select_row(uint8_t row);
+
+#endif