#include <cdefBF592-A.h>
+#include <stdlib.h>
#include "lcd.h"
#include "bfin_util.h"
}
}
+#define swap(A,B) \
+ do { \
+ int C = A; \
+ A = B; \
+ B = C; \
+ } while (0)
+
+void lcd_font_draw_line(
+ FontSet *fs, UserFont index,
+ int x1, int y1,
+ int x2, int y2,
+ int on)
+{
+ int x;
+ /*
+ * Bresenham's line algorithm
+ */
+ bool steep = abs(y2 - y1) > abs(x2 - x1);
+ if (steep) {
+ swap(x1, y1);
+ swap(x2, y2);
+ }
+ if (x1 > x2) {
+ swap(x1, x2);
+ swap(y1, y2);
+ }
+ int deltax = x2 - x1;
+ int deltay = abs(y2 - y1);
+ int error = deltax / 2;
+ int ystep;
+ int y = y1;
+ if (y1 < y2) {
+ ystep = 1;
+ } else {
+ ystep = -1;
+ }
+ for (x = x1; x <= x2; x++) {
+ if (steep) {
+ lcd_font_set_pixel(fs, index, y, x, on);
+ } else {
+ lcd_font_set_pixel(fs, index, x, y, on);
+ }
+ error = error - deltay;
+ if (error < 0) {
+ y = y + ystep;
+ error = error + deltax;
+ }
+ }
+}
+
void lcd_font_setup_single(FontSet *fs, UserFont index)
{
uint8_t addr = 0;
void lcd_font_set_pixel(
FontSet *fs, UserFont index,
const int x, const int y, const int on);
+void lcd_font_draw_line(
+ FontSet *fs, UserFont index,
+ int x1, int y1,
+ int x2, int y2,
+ int on);
void lcd_font_setup_single(FontSet *fs, UserFont index);
void lcd_font_setup_all(FontSet *fs);
void uzume_execute(UZUME *p)
{
+ int i, j;
+ char lcdbuf[16];
int32_t bufidx_dma_done;
+ FontSet fontset;
+
+ /*
+ * Initialize fontset
+ */
+ lcd_font_init(&fontset);
+ for (i = 0; i < (int)LCD_FONT_CHARS; i++) {
+ for (j = 0; j < i + 1; j++) {
+ lcd_font_draw_line(&fontset, (UserFont)i, 0, (7 - j), 4, (7 - j), 1);
+ }
+ }
+ lcd_font_setup_all(&fontset);
+
+ /*
+ * Draw the text string.
+ */
+ for (i = 0; i < 8; i++) {
+ lcdbuf[i] = 0x08 + i;
+ }
+ lcdbuf[8] = 0x00;
+ lcd_goto(0, 0);
+ lcd_puts(lcdbuf);
+
while (1) {
asm("idle;");
if (0 != data_ready) {