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