31 lines
632 B
C
31 lines
632 B
C
#include "lcd.h"
|
|
|
|
#include <unistd.h>
|
|
#include <err.h>
|
|
|
|
#define RS 2
|
|
#define RW 3
|
|
#define EN 4
|
|
#define D0 17
|
|
#define D1 27
|
|
#define D2 22
|
|
#define D3 10
|
|
#define D4 9
|
|
#define D5 14
|
|
#define D6 15
|
|
#define D7 18
|
|
|
|
int main(int argc, const char **argv) {
|
|
gpio_handle_t handle = gpio_open(0);
|
|
if (handle == GPIO_INVALID_HANDLE) {
|
|
errx(1, "count not open GPIO handle!");
|
|
}
|
|
LCD *lcd = lcd_open(handle, RS, RW, EN, D0, D1, D2, D3, D4, D5, D6, D7);
|
|
lcd_write_string(lcd, "This is a test");
|
|
lcd_move_to(lcd, 1, 0);
|
|
lcd_write_string(lcd, "FreeBSD!");
|
|
lcd_close(lcd);
|
|
gpio_close(handle);
|
|
return 0;
|
|
}
|