--- /dev/null
+#ifndef DISPLAY_DRAW_H_
+#define DISPLAY_DRAW_H_
+
+void dsp_rect(int x, int y, int w, int h, uint16_t color);
+
+void dsp_cpos(int x, int y);
+void dsp_puts(const char *s);
+
+#endif // DISPLAY_DRAW_H_
dsp_write_cmd(0xC5); // frame rate/inversion ctl
dsp_write_data(0x03);
- // backlight
- dsp_write_cmd(0x55);
- dsp_write_data(0x01);
- dsp_write_cmd(0x53);
- dsp_write_data(0x2C);
- dsp_write_cmd(0x51);
- dsp_write_data(0x01);
-
dsp_write_cmd(0x36); // rot. and stuff
- dsp_write_data(0x41);
+ dsp_write_data(0xA3);
dsp_write_cmd(0x3A); // set pixel format
- dsp_write_data(0x65);
+ dsp_write_data(0x55);
dsp_write_cmd(0x11);
delay(150);
dsp_write_cmd(0x29); // set display on
dsp_write_cmd(0x37);
dsp_write_data(0x00);
dsp_write_data(0x00);*/
-
- dsp_set_addr(0, 0, LCD_WIDTH, LCD_HEIGHT);
}
dsp_write_data(inconsolata24[start + (i * 192 * 2) + j]);
}
- if (++curx == 26)
- curx = 0, cury++;
+ if (++curx == 40) {
+ curx = 0;
+ if (++cury == 10)
+ cury = 0;
+ }
}
void dsp_puts(const char *s)
while (s[i])
dsp_putchar(s[i++]);
}
+
+void dsp_cpos(int x, int y)
+{
+ curx = x;
+ cury = y;
+}
+
+void dsp_rect(int x, int y, int w, int h, uint16_t color)
+{
+ dsp_set_addr(x, y, x + w - 1, y + h - 1);
+ int countdown = w * h;
+ do {
+ dsp_write_data(color >> 8);
+ dsp_write_data(color & 0xFF);
+ } while (countdown--);
+}
#include <gpio.h>\r
#include <lcd.h>\r
#include <display.h>\r
+#include <display_draw.h>\r
#include <initrd.h>\r
#include <serial.h>\r
#include <parser.h>\r
int script_puts(interpreter *it)\r
{\r
char *s = igetarg_string(it, 0);\r
- //lcd_puts(s);\r
- asm("mov r0, %0; svc 2" :: "r" (s));\r
+ dsp_puts(s);\r
+ //asm("mov r0, %0; svc 2" :: "r" (s));\r
return 0;\r
}\r
\r
asm("cpsie i");\r
\r
dsp_init();\r
- //uint16_t c = 0x38;\r
- uint16_t c = 0;\r
- for (int i = 0; i < LCD_HEIGHT; i++) {\r
- dsp_set_addr(0, i, LCD_WIDTH - 1, i);\r
- int w = LCD_WIDTH - 1;\r
- do {\r
- dsp_write_data(c);//c >> 8);\r
- dsp_write_data(c);//c & 0xFF);\r
- } while (w--);\r
- }\r
\r
- extern void dsp_puts(const char *);\r
- dsp_puts("Hello, world! My name is Clyne.");\r
+ dsp_rect(0, 0, LCD_WIDTH, 105, dsp_color(0xFF, 0, 0));\r
+ dsp_rect(0, 105, LCD_WIDTH, 105, dsp_color(0, 0xFF, 0));\r
+ dsp_rect(0, 210, LCD_WIDTH, 110, dsp_color(0, 0, 0xFF));\r
+\r
+ //dsp_puts("Hello, world! My name is Clyne. I enjoy car rides and long \r
+//walks on the beach");\r
\r
//task_start(lcd_handler, 128);\r
//delay(200);\r
- //task_start(task_interpreter, 4096);\r
+ task_start(task_interpreter, 4096);\r
\r
//char *s = initrd_getfile("test.txt");\r
\r