avr/display/display.h

72 lines
1.9 KiB
C
Raw Permalink Normal View History

2022-06-26 16:45:27 +00:00
/*
Copyright 2022, Savanni D'Gerinel <savanni@luminescent-dreams.com>
This file is part of Savanni's AVR library.
2022-06-30 13:22:36 +00:00
This AVR library 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.
2022-06-26 16:45:27 +00:00
2022-06-30 13:22:36 +00:00
Lumeto 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.
2022-06-26 16:45:27 +00:00
2022-06-30 13:22:36 +00:00
You should have received a copy of the GNU General Public License along with
Lumeto. If not, see <https://www.gnu.org/licenses/>.
2022-06-26 16:45:27 +00:00
*/
2022-06-30 13:22:36 +00:00
/* This library covers a three-wire diagnostic display board.
2022-06-26 16:40:04 +00:00
*
* Hardware:
* 74HC595 shift register
* Adafruit HD44780 LCD
*
* Input pins:
* SDI -- Serial data in. This leads to the 74HC595, pin 14 (A).
* CLK -- Clock pulse. One bit will be shifted into the device on each rising
* edge. This leads to the 74HC595, pin 11 (Shift Clock).
* LS -- Latch pulse. All data in the shift register will be sent to the
* output on a rising edge. This leads to the 74HC595, pin 12 (Latch Clock);
*
* 74HC595 -> HD44780
2022-06-30 13:22:36 +00:00
* Qc -> D4
* Qd -> D5
* Qe -> D6
* Qf -> D7
* Qg -> RS
* Qh -> E
*
* I use the 4-wire protocol of the HD44780. This means that two of the shift
* register pins are used for the RS and E control pins of the LCD.
2022-06-26 16:40:04 +00:00
*/
#ifndef __DISPLAY_H__
#define __DISPLAY_H__
#include <shift_register.h>
#include <stddef.h>
2022-06-26 16:40:04 +00:00
typedef struct DISPLAY {
shift_register_t reg;
/*
2022-06-26 16:40:04 +00:00
gpio_t register_select;
gpio_t enable;
*/
2022-06-26 16:40:04 +00:00
} display_t;
void display_init(display_t *);
void display_clear(display_t *);
void display_enable(display_t *);
2022-06-26 17:28:23 +00:00
void display_set_location(display_t *, size_t, size_t);
2022-06-26 16:40:04 +00:00
void display_write_message(display_t *, const char *);
void display_write_bit_pattern(display_t *, const uint8_t);
2022-06-26 16:40:04 +00:00
#endif