OSDN Git Service

Changed the implementation with lib.
[kozos-expbrd/kozos_expbrd.git] / firm / sample / simple_mp3_player / os / ipc_display.c
1
2 #include "kozos.h"
3 #include "ipc_display.h"
4 #include "lib.h"
5
6 void ipc_display_led_write(int target, int state)
7 {
8   char *p;
9   p = kz_kmalloc(2);
10   p[0] = state ? DISPLAY_CMD_LED_ON : DISPLAY_CMD_LED_OFF;
11   p[1] = '0' + target;
12   kz_send(MSGBOX_ID_DISPLAY, 2, p);
13 }
14
15 void ipc_display_led_toggle(int target)
16 {
17   char *p;
18   p = kz_kmalloc(2);
19   p[0] = DISPLAY_CMD_LED_TOGGLE;
20   p[1] = '0' + target;
21   kz_send(MSGBOX_ID_DISPLAY, 2, p);
22 }
23
24 void ipc_display_clear(void)
25 {
26   char *p;
27   p = kz_kmalloc(1);
28   p[0] = DISPLAY_CMD_LCD_CLEAR;
29   kz_send(MSGBOX_ID_DISPLAY, 1, p);
30 }
31
32 void ipc_display_draw_box(int x1, int y1, int x2, int y2, int on)
33 {
34   char *p;
35   p = kz_kmalloc(6);
36   p[0] = DISPLAY_CMD_LCD_DRAW_BOX;
37   p[1] = x1;
38   p[2] = y1;
39   p[3] = x2;
40   p[4] = y2;
41   p[5] = !on;
42   kz_send(MSGBOX_ID_DISPLAY, 6, p);
43 }
44
45 void ipc_display_draw_logo(int x, int y, int size)
46 {
47   char *p;
48   p = kz_kmalloc(4);
49   p[0] = DISPLAY_CMD_LCD_DRAW_LOGO;
50   p[1] = x;
51   p[2] = y;
52   p[3] = size;
53   kz_send(MSGBOX_ID_DISPLAY, 4, p);
54 }
55
56 void ipc_display_draw_text(int x, int y, char *str)
57 {
58   char *p;
59   int len;
60   len = strlen(str);
61   p = kz_kmalloc(3 + len + 1);
62   p[0] = DISPLAY_CMD_LCD_DRAW_TEXT;
63   p[1] = x;
64   p[2] = y;
65   memcpy(&p[3], str, len);
66   p[3 + len] = '\0';
67   kz_send(MSGBOX_ID_DISPLAY, 3 + len + 1, p);
68 }
69
70 void ipc_display_draw_progressbar(
71         int x1, int y1, int x2, int y2,
72         int min, int max, int value)
73 {
74   char *p;
75   p = kz_kmalloc(8);
76   p[0] = DISPLAY_CMD_LCD_DRAW_PBAR;
77   p[1] = x1;
78   p[2] = y1;
79   p[3] = x2;
80   p[4] = y2;
81   p[5] = min;
82   p[6] = max;
83   p[7] = value;
84   kz_send(MSGBOX_ID_DISPLAY, 8, p);
85 }
86