AVRly - AVR Development Resources
pin_defines.c
1
/******************************************************************************
2
@copyright Copyright © 2022 by Jason Duffy.
3
4
Permission is hereby granted, free of charge, to any person obtaining a copy
5
of this software and associated documentation files (the "Software"), to deal
6
in the Software without restriction, including without limitation the rights
7
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8
copies of the Software, and to permit persons to whom the Software is
9
furnished to do so, subject to the following conditions:
10
11
The above copyright notice and this permission notice shall be included in all
12
copies or substantial portions of the Software.
13
14
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20
SOFTWARE.
21
******************************************************************************/
22
23
/**
24
* @file pin_defines.h
25
* @ingroup hd44780_lcd
26
* @author Jason Duffy
27
* @date 1st March 2022
28
* @brief Definitions for pin mapping (for hd44780_lcd)
29
* @bug No known bugs.
30
*
31
* This file provides definitions for pin/port references used in the hd44780
32
* driver. If you are using it in 8 bit mode, you need to wire all 8 data pins
33
* D0 - D7 to pins Px0 - Px7 of a single port, and define that port as
34
* LCD_DATA_PORT. You do not need to define LCD_D0 - LCD_D3 in this file though
35
* as they are not referred to by pin in the code, only by whole port.
36
*
37
* If you are using the display in 4 bit mode, you can wire the 4 data pins
38
* D4 - D7 to any 4 pins on the port you defined as LCD_DATA_PORT, just make
39
* sure they are in the correct order (you cannot wire them as D7, D5, D6, D4
40
* for instance). The LCD_CTRL_PORT can either be a separate port, or it can
41
* be on the same port as the data pins (this only applies in 4 bit mode).
42
*
43
* If you'd like to expand this project, you need to keep just one
44
* pin_defines.h file per project. All pins and ports can be defined here, then
45
* just #include "pin_defines.h" in any file that uses these definitions.
46
* Remember to prefix your pin/port names with the name of the module or device
47
* they belong to.
48
*/
49
50
#ifndef PIN_DEFINES_DOT_H
51
#define PIN_DEFINES_DOT_H
52
53
// LCD ports, pins & data direction registers
54
#define LCD_DATA_PORT PORTD
55
#define LCD_DATA_DDR DDRD
56
#define LCD_DATA_PIN PIND
57
#define LCD_CTRL_PORT PORTD
58
#define LCD_CTRL_DDR DDRD
59
60
// LCD pinout
61
#define LCD_RS PD0
62
#define LCD_EN PD2
63
64
#define LCD_D7 PD7
65
#define LCD_D6 PD6
66
#define LCD_D5 PD5
67
#define LCD_D4 PD4
68
69
70
#endif
//PIN_DEFINES_DOT_H
71
72
/*** end of file ***/
content
modules
displays
hd44780_lcd
example
pin_defines.c
Generated by
1.9.4