raspberry pi port
[gpsp.git] / raspberrypi / test / test.c
CommitLineData
ffa573f8
D
1#include <stdlib.h>
2#include <stdio.h>
3#include <stdint.h>
4
5#define RGB15(r, g, b) (((r) << (5+6)) | ((g) << 6) | (b))
6
7void video_init(uint32_t width,uint32_t height, uint32_t f);
8void video_close();
9void video_draw(uint16_t *pixels);
10
11
12
13void showbitmap( uint32_t wd, uint32_t ht, uint32_t f) {
14int index;
15uint16_t j,k;
16uint8_t r,g,b;
17uint16_t * bitmap;
18
19 bitmap=malloc(wd*ht*sizeof(uint16_t));
20
21 b=16;
22 index=0;
23 for (j=0;j<ht;j++) {
24 r=(j*31)/(ht-1);
25 for (k=0; k<wd ; k++) {
26 g=(k*31)/(wd-1);
27 bitmap[index++]=RGB15(r,g,b);
28 }
29 }
30bitmap[0]=0;
31
32video_init(wd,ht,f);
33video_draw(bitmap);
34sleep(5);
35video_close();
36free(bitmap);
37}
38
39int main(void) {
40
41showbitmap( 320, 240,0);
42showbitmap( 320, 240,1);
43showbitmap( 320, 240,2);
44showbitmap( 240, 160,0);
45showbitmap( 400, 272,0);
46
47return 0;
48}