hd44780_params.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2017 HAW Hamburg
3  *
4  * This file is subject to the terms and conditions of the GNU Lesser
5  * General Public License v2.1. See the file LICENSE in the top level
6  * directory for more details.
7  */
8 
18 #ifndef HD44780_PARAMS_H
19 #define HD44780_PARAMS_H
20 
21 #include "board.h"
22 #ifdef MODULE_PCF857X
23 #include "pcf857x.h"
24 #else
25 #include "periph/gpio.h"
26 #endif
27 
28 #ifdef __cplusplus
29 extern "C"
30 {
31 #endif
32 
33 /* The default pins corresponds to Arduino pins on the Arduino Zero board. */
34 
35 #ifndef HD44780_PARAM_COLS
36 #define HD44780_PARAM_COLS (16U)
37 #endif
38 #ifndef HD44780_PARAM_ROWS
39 #define HD44780_PARAM_ROWS (2U)
40 #endif
41 
42 #ifndef MODULE_PCF857X
43 
44 #ifndef HD44780_PARAM_PIN_RS
45 #define HD44780_PARAM_PIN_RS GPIO_PIN(0, 14) /* Arduino D2 */
46 #endif
47 #ifndef HD44780_PARAM_PIN_RW
48 #define HD44780_PARAM_PIN_RW GPIO_UNDEF
49 #endif
50 #ifndef HD44780_PARAM_PIN_ENABLE
51 #define HD44780_PARAM_PIN_ENABLE GPIO_PIN(0, 9) /* Arduino D3 */
52 #endif
53 #ifndef HD44780_PARAM_PINS_DATA
54 #define HD44780_PARAM_PINS_DATA { GPIO_PIN(0, 8), /* Arduino D4 */ \
55  GPIO_PIN(0, 15), /* Arduino D5 */ \
56  GPIO_PIN(0, 20), /* Arduino D6 */ \
57  GPIO_PIN(0, 21), /* Arduino D7 */ \
58  GPIO_UNDEF, \
59  GPIO_UNDEF, \
60  GPIO_UNDEF, \
61  GPIO_UNDEF }
62 #endif
63 
64 #else /* !MODULE_PCF857X */
65 
66 #ifndef HD44780_PARAM_PIN_RS
67 #define HD44780_PARAM_PIN_RS PCF857X_GPIO_PIN(0, 0) /* Bit 0 */
68 #endif
69 #ifndef HD44780_PARAM_PIN_RW
70 #define HD44780_PARAM_PIN_RW PCF857X_GPIO_PIN(0, 1) /* Bit 1 */
71 #endif
72 #ifndef HD44780_PARAM_PIN_ENABLE
73 #define HD44780_PARAM_PIN_ENABLE PCF857X_GPIO_PIN(0, 2) /* Bit 2 */
74 #endif
75 #ifndef HD44780_PARAM_PINS_DATA
76 #define HD44780_PARAM_PINS_DATA { PCF857X_GPIO_PIN(0, 4), /* Bit 4 */ \
77  PCF857X_GPIO_PIN(0, 5), /* Bit 5 */ \
78  PCF857X_GPIO_PIN(0, 6), /* Bit 6 */ \
79  PCF857X_GPIO_PIN(0, 7), /* Bit 7 */ \
80  GPIO_UNDEF, \
81  GPIO_UNDEF, \
82  GPIO_UNDEF, \
83  GPIO_UNDEF }
84 #endif
85 
86 #endif /* !MODULE_PCF857X */
87 
88 #ifndef HD44780_PARAMS
89 #define HD44780_PARAMS { .cols = HD44780_PARAM_COLS, \
90  .rows = HD44780_PARAM_ROWS, \
91  .rs = HD44780_PARAM_PIN_RS, \
92  .rw = HD44780_PARAM_PIN_RW, \
93  .enable = HD44780_PARAM_PIN_ENABLE, \
94  .data = HD44780_PARAM_PINS_DATA }
95 #endif
96 
101 {
102  HD44780_PARAMS,
103 };
104 
105 #ifdef __cplusplus
106 }
107 #endif
108 
109 #endif /* HD44780_PARAMS_H */
Low-level GPIO peripheral driver interface definitions.
static const hd44780_params_t hd44780_params[]
LCM1602C configuration.
Parameters needed for device initialization.
Definition: hd44780.h:60