... | @@ -78,7 +78,7 @@ have no such device, the engine will fails to initialize. |
... | @@ -78,7 +78,7 @@ have no such device, the engine will fails to initialize. |
|
CommLCD engine implementation. In the `comm-engines` sample, it does nothing
|
|
CommLCD engine implementation. In the `comm-engines` sample, it does nothing
|
|
and just returns zero:
|
|
and just returns zero:
|
|
|
|
|
|
```C
|
|
```cpp
|
|
int __commlcd_drv_init (void)
|
|
int __commlcd_drv_init (void)
|
|
{
|
|
{
|
|
return 0;
|
|
return 0;
|
... | @@ -96,7 +96,7 @@ mode according to your settings in the MiniGUI runtime configuration, e.g., |
... | @@ -96,7 +96,7 @@ mode according to your settings in the MiniGUI runtime configuration, e.g., |
|
In our sample, it creates an anonymous memory map by calling `mmap` system
|
|
In our sample, it creates an anonymous memory map by calling `mmap` system
|
|
call and returns the video information via `struct commlcd_info* li`:
|
|
call and returns the video information via `struct commlcd_info* li`:
|
|
|
|
|
|
```C
|
|
```cpp
|
|
int __commlcd_drv_getinfo (struct commlcd_info *li, int width, int height, int depth)
|
|
int __commlcd_drv_getinfo (struct commlcd_info *li, int width, int height, int depth)
|
|
{
|
|
{
|
|
sg_fb = (BYTE*) mmap (0, FB_SIZE, PROT_READ | PROT_WRITE, MAP_SHARED | MAP_ANONYMOUS, -1, 0);
|
|
sg_fb = (BYTE*) mmap (0, FB_SIZE, PROT_READ | PROT_WRITE, MAP_SHARED | MAP_ANONYMOUS, -1, 0);
|
... | @@ -147,7 +147,7 @@ If the color depth of the video mode is 8 (`COMMLCD_PSEUDO_RGB332`), |
... | @@ -147,7 +147,7 @@ If the color depth of the video mode is 8 (`COMMLCD_PSEUDO_RGB332`), |
|
|
|
|
|
In our sample, this method does nothing and returns zero:
|
|
In our sample, this method does nothing and returns zero:
|
|
|
|
|
|
```C
|
|
```cpp
|
|
int __commlcd_drv_setclut (int firstcolor, int ncolors, GAL_Color *colors)
|
|
int __commlcd_drv_setclut (int firstcolor, int ncolors, GAL_Color *colors)
|
|
{
|
|
{
|
|
return 0;
|
|
return 0;
|
... | @@ -166,7 +166,7 @@ The arguments of this function have the following meanings: |
... | @@ -166,7 +166,7 @@ The arguments of this function have the following meanings: |
|
|
|
|
|
`GAL_Color` is a structure defined in MiniGUI header:
|
|
`GAL_Color` is a structure defined in MiniGUI header:
|
|
|
|
|
|
```C
|
|
```cpp
|
|
typedef struct _GAL_Color
|
|
typedef struct _GAL_Color
|
|
{
|
|
{
|
|
/**
|
|
/**
|
... | @@ -197,7 +197,7 @@ be called frequently or periodically. |
... | @@ -197,7 +197,7 @@ be called frequently or periodically. |
|
In our sample, this method saves the whole frame buffer content to Windows
|
|
In our sample, this method saves the whole frame buffer content to Windows
|
|
bitmap files by calling MiniGUI function:
|
|
bitmap files by calling MiniGUI function:
|
|
|
|
|
|
```C
|
|
```cpp
|
|
int __commlcd_drv_update (const RECT* rc_dirty)
|
|
int __commlcd_drv_update (const RECT* rc_dirty)
|
|
{
|
|
{
|
|
char filename [PATH_MAX + 1];
|
|
char filename [PATH_MAX + 1];
|
... | @@ -254,7 +254,7 @@ If you can access the LCD frame buffer directly, and your LCD screen |
... | @@ -254,7 +254,7 @@ If you can access the LCD frame buffer directly, and your LCD screen |
|
do not need a refresh/update operation, you do not need to implement
|
|
do not need a refresh/update operation, you do not need to implement
|
|
the update method, and the function can just return zero:
|
|
the update method, and the function can just return zero:
|
|
|
|
|
|
```C
|
|
```cpp
|
|
int __commlcd_drv_update (const RECT* rc_dirty)
|
|
int __commlcd_drv_update (const RECT* rc_dirty)
|
|
{
|
|
{
|
|
return 0;
|
|
return 0;
|
... | @@ -271,7 +271,7 @@ the resource allocated or created by the engine. |
... | @@ -271,7 +271,7 @@ the resource allocated or created by the engine. |
|
|
|
|
|
In our sample, it destroys the anonymous memory map and returns zero:
|
|
In our sample, it destroys the anonymous memory map and returns zero:
|
|
|
|
|
|
```C
|
|
```cpp
|
|
int __commlcd_drv_release (void)
|
|
int __commlcd_drv_release (void)
|
|
{
|
|
{
|
|
munmap (sg_fb, FB_SIZE);
|
|
munmap (sg_fb, FB_SIZE);
|
... | @@ -288,7 +288,7 @@ MiniGUI will call `__comminput_init` function to initialize the engine. |
... | @@ -288,7 +288,7 @@ MiniGUI will call `__comminput_init` function to initialize the engine. |
|
|
|
|
|
You can open your input devices in the function:
|
|
You can open your input devices in the function:
|
|
|
|
|
|
```C
|
|
```cpp
|
|
#define POWER_EVENT_DEV "/dev/input/event0"
|
|
#define POWER_EVENT_DEV "/dev/input/event0"
|
|
#define KB_EVENT_DEV "/dev/input/event1"
|
|
#define KB_EVENT_DEV "/dev/input/event1"
|
|
#define TP_EVENT_DEV "/dev/input/event5"
|
|
#define TP_EVENT_DEV "/dev/input/event5"
|
... | @@ -361,7 +361,7 @@ and/or a keyboard event. The sample implementation of `__comminput_wait_for_inpu |
... | @@ -361,7 +361,7 @@ and/or a keyboard event. The sample implementation of `__comminput_wait_for_inpu |
|
uses the system call `select` to check the file descriptors opened by
|
|
uses the system call `select` to check the file descriptors opened by
|
|
`__comminput_init`, and return a suitable value to MiniGUI:
|
|
`__comminput_init`, and return a suitable value to MiniGUI:
|
|
|
|
|
|
```C
|
|
```cpp
|
|
int __comminput_wait_for_input (struct timeval *timeout)
|
|
int __comminput_wait_for_input (struct timeval *timeout)
|
|
{
|
|
{
|
|
fd_set rfds;
|
|
fd_set rfds;
|
... | @@ -404,7 +404,7 @@ If there is a keyboard event (the return value of `__comminput_wait_for_input` |
... | @@ -404,7 +404,7 @@ If there is a keyboard event (the return value of `__comminput_wait_for_input` |
|
has the bit `COMM_KBINPUT` set), MiniGUI will call `__comminput_kb_getdata`
|
|
has the bit `COMM_KBINPUT` set), MiniGUI will call `__comminput_kb_getdata`
|
|
immediately to get the real keyboard event data:
|
|
immediately to get the real keyboard event data:
|
|
|
|
|
|
```C
|
|
```cpp
|
|
int __comminput_kb_getdata (short *key, short *status)
|
|
int __comminput_kb_getdata (short *key, short *status)
|
|
{
|
|
{
|
|
...
|
|
...
|
... | @@ -425,7 +425,7 @@ If there is a mouse event (the return value of `__comminput_wait_for_input` |
... | @@ -425,7 +425,7 @@ If there is a mouse event (the return value of `__comminput_wait_for_input` |
|
has the bit `COMM_MOUSEINPUT` set), MiniGUI will call `__comminput_ts_getdata`
|
|
has the bit `COMM_MOUSEINPUT` set), MiniGUI will call `__comminput_ts_getdata`
|
|
immediately to get the real keyboard event data:
|
|
immediately to get the real keyboard event data:
|
|
|
|
|
|
```C
|
|
```cpp
|
|
int __comminput_ts_getdata (short *x, short *y, short *button)
|
|
int __comminput_ts_getdata (short *x, short *y, short *button)
|
|
{
|
|
{
|
|
...
|
|
...
|
... | @@ -447,7 +447,7 @@ the resource allocated or created by the Comm IAL engine. |
... | @@ -447,7 +447,7 @@ the resource allocated or created by the Comm IAL engine. |
|
|
|
|
|
In our sample, it just closes the file descriptors:
|
|
In our sample, it just closes the file descriptors:
|
|
|
|
|
|
```C
|
|
```cpp
|
|
void __comminput_deinit (void)
|
|
void __comminput_deinit (void)
|
|
{
|
|
{
|
|
close (sg_tp_event_fd);
|
|
close (sg_tp_event_fd);
|
... | | ... | |