avr/lcd/main.c

37 lines
1.0 KiB
C

#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); }
}