avr/lcd/main.c

49 lines
1.7 KiB
C

/*
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/>.
*/
#include <avr/io.h>
#include <util/delay.h>
#include <base.h>
#include <spi.h>
#include <shift_register.h>
#include <display.h>
int main(void) {
display_t display = {
.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);
display_init(&display);
display_clear(&display);
_delay_ms(500);
const char msg[] = "Hello, my bat";
display_write_message(&display, msg);
display_enable(&display);
set_line(&light);
while(1) { _delay_ms(1); }
}