aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/tdisp/HD44780/tdisp_lld_board_olimex_e407.h
diff options
context:
space:
mode:
authorJoel Bodenmann <joel@unormal.org>2013-03-02 22:13:44 +0100
committerJoel Bodenmann <joel@unormal.org>2013-03-02 22:13:44 +0100
commit100d686f948050385ff29c8425a99db2aa0f0248 (patch)
treead3e5f00d0b52331912b6c3255991d2a86682834 /drivers/tdisp/HD44780/tdisp_lld_board_olimex_e407.h
parentbdf79ec9adc242ffeaae0f9a5fdfb51a2a5bbaf0 (diff)
downloaduGFX-100d686f948050385ff29c8425a99db2aa0f0248.tar.gz
uGFX-100d686f948050385ff29c8425a99db2aa0f0248.tar.bz2
uGFX-100d686f948050385ff29c8425a99db2aa0f0248.zip
TDISP update
Diffstat (limited to 'drivers/tdisp/HD44780/tdisp_lld_board_olimex_e407.h')
-rw-r--r--drivers/tdisp/HD44780/tdisp_lld_board_olimex_e407.h72
1 files changed, 72 insertions, 0 deletions
diff --git a/drivers/tdisp/HD44780/tdisp_lld_board_olimex_e407.h b/drivers/tdisp/HD44780/tdisp_lld_board_olimex_e407.h
new file mode 100644
index 00000000..311d8d9f
--- /dev/null
+++ b/drivers/tdisp/HD44780/tdisp_lld_board_olimex_e407.h
@@ -0,0 +1,72 @@
+/*
+ ChibiOS/GFX - Copyright (C) 2012
+ Joel Bodenmann aka Tectu <joel@unormal.org>
+
+ This file is part of ChibiOS/GFX.
+
+ ChibiOS/GFX is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ ChibiOS/GFX is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+*/
+
+/**
+ * @file drivers/tdisp/HD44780/tdisp_lld_board_unknown.h
+ * @brief TDISP driver subsystem board interface for the HD44780 display
+ *
+ * @addtogroup TDISP
+ * @{
+ */
+
+#ifndef _TDISP_LLD_BOARD_H
+#define _TDISP_LLD_BOARD_H
+
+/* Configure these to match the hardware connections on your board */
+#define BUS_4BITS FALSE
+#define PORT_DATA GPIOG
+#define PORT_CTRL GPIOE
+#define PIN_RS 0
+#define PIN_RW 1
+#define PIN_EN 2
+
+static void init_board(void) {
+ palSetGroupMode(PORT_CTRL, PAL_WHOLE_PORT, 0, PAL_MODE_OUTPUT_PUSHPULL);
+ palSetGroupMode(PORT_DATA, PAL_WHOLE_PORT, 0, PAL_MODE_OUTPUT_PUSHPULL);
+ palClearPad(PORT_CTRL, PIN_RW);
+}
+
+static void writeToLCD(uint8_t data) {
+ palWritePort(PORT_DATA, data);
+ palSetPad(PORT_CTRL, PIN_EN);
+ chThdSleepMicroseconds(1);
+ palClearPad(PORT_CTRL, PIN_EN);
+ chThdSleepMicroseconds(5);
+}
+
+static void write_cmd(uint8_t data) {
+ palClearPad(PORT_CTRL, PIN_RS);
+ #if BUS_4BITS
+ writeToLCD(data>>4);
+ #endif
+ writeToLCD(data);
+}
+
+static void write_data(uint8_t data) {
+ palSetPad(PORT_CTRL, PIN_RS);
+ #if BUS_4BITS
+ writeToLCD(data>>4);
+ #endif
+ writeToLCD(data);
+}
+
+#endif /* _TDISP_LLD_BOARD_H */
+/** @} */
+