liberscribble/include/driver.h File Reference

#include <sys/time.h>
#include "scbconfig.h"
#include "scbpoint.h"
#include <liberdm/erdm.h>
#include <glib.h>

This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  _DrvPointInfo
struct  _DrvPointsBuf
struct  _FastDrawContext

Typedefs

typedef struct _DrvPointInfo DrvPointInfo
typedef struct _DrvPointsBuf DrvPointsBuf
typedef DrvPointsBufDrvPointsBufPtr
typedef struct _FastDrawContext FastDrawContext

Functions

void scb_driver_init ()
void scb_driver_close ()
void scb_driver_draw (DrvPointsBufPtr ptr)
void scb_fast_draw_reset_context ()
gboolean scb_fast_draw_now ()
void scb_fast_draw_record (const ScbDevPointPtr ptr, const unsigned char size, const unsigned char color, const unsigned char pen_down)
void scb_fast_draw ()
void scb_fast_draw_points (DrvPointsBufPtr ptr)


Typedef Documentation

typedef struct _DrvPointInfo DrvPointInfo

Copyright (C) 2005-2008 iRex Technologies B.V. All rights reserved.

typedef struct _DrvPointsBuf DrvPointsBuf

Definition at line 53 of file driver.h.


Function Documentation

void scb_driver_close (  ) 

Definition at line 52 of file driver.c.

00053 {
00054     // always close
00055     close(fbdev);
00056 }

void scb_driver_draw ( DrvPointsBufPtr  ptr  ) 

Definition at line 58 of file driver.c.

00059 {
00060     if (ptr)
00061     {   
00062         if (0 != ioctl (fbdev, FBIO_DRAWPIXELS, ptr))
00063         {
00064             SCB_ERROR("ioctl request error!");
00065         }
00066     }
00067 }

void scb_driver_init (  ) 

Definition at line 36 of file driver.c.

00037 {
00038     if (fbdev)
00039     {
00040         SCB_ERROR("/dev/fb0 already open!");
00041         return;
00042     }
00043 
00044     fbdev = open("/dev/fb0", O_RDWR);
00045     if (-1 == fbdev)
00046     {
00047         SCB_ERROR("Could not open /dev/fb0!");
00048         return;
00049     }
00050 }

void scb_fast_draw (  ) 

Definition at line 125 of file driver.c.

00126 {
00127     scb_driver_draw(&s_fast_draw_ctx.points);
00128 }

Here is the call graph for this function:

gboolean scb_fast_draw_now (  ) 

SCB_TRACE("Should draw now time!");

Definition at line 81 of file driver.c.

00082 {
00083     // check points 
00084     if (s_fast_draw_ctx.points.count > SCB_DEF_FAST_DRAW_COUNT)
00085     {
00086         //SCB_TRACE("Should draw now points!");
00087         return TRUE;
00088     }
00089 
00090     // check time
00091     static const long usec = 1000 * 1000;
00092     long elapsed = ( s_fast_draw_ctx.t2.tv_sec - s_fast_draw_ctx.t1.tv_sec ) * usec;
00093     elapsed += s_fast_draw_ctx.t2.tv_usec - s_fast_draw_ctx.t1.tv_usec;
00094 
00095     if (elapsed >= SCB_DEF_FAST_DRAW_TIME)
00096     {
00098         return TRUE;
00099     }
00100     //SCB_TRACE("No, not yet. Waiting for...");
00101     return FALSE;
00102 }

void scb_fast_draw_points ( DrvPointsBufPtr  ptr  ) 

Definition at line 131 of file driver.c.

00132 {
00133     scb_driver_draw(ptr);
00134 }

Here is the call graph for this function:

void scb_fast_draw_record ( const ScbDevPointPtr  ptr,
const unsigned char  size,
const unsigned char  color,
const unsigned char  pen_down 
)

Definition at line 106 of file driver.c.

void scb_fast_draw_reset_context (  ) 

Definition at line 72 of file driver.c.

00073 {
00074     s_fast_draw_ctx.points.count = 0;
00075     gettimeofday(&s_fast_draw_ctx.t1, NULL);
00076     s_fast_draw_ctx.t2.tv_sec   = s_fast_draw_ctx.t1.tv_sec;
00077     s_fast_draw_ctx.t2.tv_usec  = s_fast_draw_ctx.t1.tv_usec;
00078 }


Generated on Sun Dec 14 17:14:58 2008 by  doxygen 1.5.6