8
#include "video/screen.h"
9
#include "video/backfb.h"
10
#include "video/tga_image.h"
11
#include "video/pixel.h"
12
#include "image_formats/tga.h"
13
#include "sensors/battery.h"
15
#include "ui/psf_font.h"
17
#include <linux/input.h>
18
#include <linux/soundcard.h>
27
union snd_pcm_sync_id {
29
unsigned short id16[8];
35
unsigned int subdevice;
39
unsigned char name[80];
40
unsigned char subname[32];
43
unsigned int subdevices_count;
44
unsigned int subdevices_avail;
45
union snd_pcm_sync_id sync;
46
unsigned char reserved[64];
49
#define SNDRV_PCM_IOCTL_WRITEI_FRAMES _IOW('A', 0x50, struct snd_xferi);
50
#define SNDRV_PCM_IOCTL_PREPARE _IO('A', 0x40)
51
#define SNDRV_PCM_IOCTL_INFO _IOR('A', 0x01, struct snd_pcm_info)
56
koraidon_screen_t screen = init_screen("/dev/graphics/fb0");
57
koraidon_backfb_t framebuffer = backfb_from_screen(screen);
63
int fd = open("/dev/snd/pcmC1D1p", O_RDWR | O_NONBLOCK);
66
printf("Sound FD Ok\n");
68
struct snd_pcm_info info;
70
int result = ioctl(fd, SNDRV_PCM_IOCTL_INFO, &info);
72
printf("%d\n", result);
76
printf("Card ID: %s\n", info.id);
77
printf("Card Name: %s\n", info.name);
78
printf("Card Subname: %s\n", info.subname);
79
printf("Card Stream: %d\n", info.stream);
80
printf("Card Class/Subclass: %d/%d\n", info.dev_class, info.dev_subclass);
88
koraidon_battery_info_t battery;
90
battery = battery_get_info("/sys/class/power_supply/battery/");
92
printf("Level: %d\nTemperature: %f *C\nVolatge: %f V\n", battery.level, battery.temp, battery.voltage);
93
printf("Is charging: %s\n", battery.status == BATTERY_CHARGING ? "yes" : "no");
116
char timebuf[32] = {0};
119
time_t curtime_val = time(NULL);
120
struct tm* curtime = localtime(&curtime_val);
125
screen.real_info.width, screen.real_info.height,
129
draw_fill_rect(set_pixel_alpha, framebuffer, 0, 0, screen.real_info.width, 36, 0xACFFFFFF);
131
strftime(timebuf, 32, "[%H:%M:%S]", curtime);
132
draw_string(set_pixel_alpha, framebuffer, timebuf, 10, 10, 0xFF000000);
134
backfb_flush(framebuffer);
137
backfb_deinit(framebuffer);
138
deinit_screen(screen);