/* * "THE BEER-WARE LICENSE" (Revision 42): * Martin Wenger and Stefan Rupp * wrote this file. As long as you retain this notice you can do whatever you want * with this stuff. If we meet some day, and you think this stuff is worth it, * you can buy me/us a beer in return. * (c) 2005-2010 Martin Wenger, Stefan Rupp * (c) 2014 Stefan Rupp */ #include #include #include #include // ==> _NOP() #include "timer.h" #include "lcd.h" #define WAIT_250_ns() _NOP() #define LCD_DATA_MODE() (PORTC |= (1<> 4); _NOP(); send_nibble(0x0f & byte); } int lcd_get(void) { lcd_wait_while_busy(); return lcd_read_byte(1); } int lcd_put(char c) { lcd_send_byte(c, 1); return 0; } void lcd_puts(char *s) { while (*s) { //lcd_put(*s++); lcd_send_byte(*s++, 1); } } void lcd_cursor(uint8_t blink) { if (blink) { // enable display with cursor + blinking lcd_send_byte(0x0f, 0); } else { // enable display, no cursor, no blinking lcd_send_byte(0x0c, 0); return; } } void lcd_init(void) { /* Initialize both ATmega and Dsiplay * After return from this function, * display we be set to 4-bit data mode */ // wait until LCD gets ready to accept instructions. timer_wait(50); // set CONTROL Pins as outputs: DDRC = 0x3f; DDRB |= (1<