avr/lcd/main.c

50 lines
1.8 KiB
C
Raw 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.
Lumeto 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.
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.
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 15:38:20 +00:00
#include <avr/io.h>
#include <util/delay.h>
#include <base.h>
#include <spi.h>
2022-06-26 16:40:04 +00:00
#include <shift_register.h>
#include <display.h>
2022-06-26 15:38:20 +00:00
int main(void) {
2022-06-26 16:40:04 +00:00
display_t display = {
2022-06-26 15:38:20 +00:00
.reg = {
.output = { .ddr = &DDRB, .port = &PORTB, .pin = &PINB, .addr = 5 },
.latch_clock = { .ddr = &DDRB, .port = &PORTB, .pin = &PINB, .addr = 6 },
.shift_clock = { .ddr = &DDRB, .port = &PORTB, .pin = &PINB, .addr = 7 },
},
.register_select = { .ddr = &DDRF, .port = &PORTF, .pin = &PINF, .addr = 1 },
.enable = { .ddr = &DDRF, .port = &PORTF, .pin = &PINF, .addr = 0 },
};
gpio_t light = { .ddr = &DDRC, .port = &PORTC, .pin = &PINC, .addr = 7 };
set_line_direction(&light, LINE_OUT);
clear_line(&light);
2022-06-26 16:40:04 +00:00
display_init(&display);
2022-06-26 15:38:20 +00:00
2022-06-26 16:40:04 +00:00
display_clear(&display);
2022-06-26 15:38:20 +00:00
_delay_ms(500);
2022-06-26 17:28:23 +00:00
display_write_message(&display, "Hello, my bat");
display_set_location(&display, 0, 1);
display_write_message(&display, " -- Savanni");
2022-06-26 16:40:04 +00:00
display_enable(&display);
2022-06-26 15:38:20 +00:00
set_line(&light);
while(1) { _delay_ms(1); }
}