Enlightenment CVS committal
Author : raster
Project : e17
Module : libs/ecore
Dir : e17/libs/ecore/src/lib/ecore_fb
Modified Files:
Tag: SPLIT
Ecore_Fb.h ecore_fb.c
Log Message:
light sensor reading, contrast control, led control backlight control... all in
===================================================================
RCS file: /cvsroot/enlightenment/e17/libs/ecore/src/lib/ecore_fb/Attic/Ecore_Fb.h,v
retrieving revision 1.1.2.5
retrieving revision 1.1.2.6
diff -u -3 -r1.1.2.5 -r1.1.2.6
--- Ecore_Fb.h 17 Feb 2003 12:00:59 -0000 1.1.2.5
+++ Ecore_Fb.h 17 Feb 2003 12:40:31 -0000 1.1.2.6
@@ -2,10 +2,6 @@
#define _ECORE_FB_H
/* FIXME:
- * add
- * - code to control led's (only for ipaq for now)
- * - code to read from /proc/hal/light_sensor or use FLITE_ON ioctl
- * - code to control screen contrast
* maybe a new module?
* - code to get battery info
* - code to get thermal info
@@ -72,6 +68,14 @@
void ecore_fb_backlight_brightness_set(double br);
double ecore_fb_backlight_brightness_get(void);
+
+void ecore_fb_led_set(int on);
+void ecore_fb_led_blink_set(double speed);
+
+void ecore_fb_contrast_set(double cr);
+double ecore_fb_contrast_get(void);
+
+double ecore_fb_light_sensor_get(void);
#ifdef __cplusplus
}
===================================================================
RCS file: /cvsroot/enlightenment/e17/libs/ecore/src/lib/ecore_fb/Attic/ecore_fb.c,v
retrieving revision 1.1.2.6
retrieving revision 1.1.2.7
diff -u -3 -r1.1.2.6 -r1.1.2.7
--- ecore_fb.c 17 Feb 2003 12:01:00 -0000 1.1.2.6
+++ ecore_fb.c 17 Feb 2003 12:40:31 -0000 1.1.2.7
@@ -15,7 +15,6 @@
#include <linux/fb.h>
#include <sys/ioctl.h>
-/* #include <linux/h3600_ts.h> */
/* hacks to stop people NEEDING #include <linux/h3600_ts.h> */
#ifndef TS_SET_CAL
#define TS_SET_CAL 0x4014660b
@@ -29,11 +28,25 @@
#ifndef TS_GET_BACKLIGHT
#define TS_GET_BACKLIGHT 0x80086614
#endif
+#ifndef LED_ON
+#define LED_ON 0x40046605
+#endif
+#ifndef TS_SET_CONTRAST
+#define TS_SET_CONTRAST 0x40046615
+#endif
+#ifndef TS_GET_CONTRAST
+#define TS_GET_CONTRAST 0x80046615
+#endif
+#ifndef FLITE_ON
+#define FLITE_ON 0x40046607
+#endif
typedef struct _Ecore_Fb_Ts_Event Ecore_Fb_Ts_Event;
typedef struct _Ecore_Fb_Ts_Calibrate Ecore_Fb_Ts_Calibrate;
typedef struct _Ecore_Fb_Ts_Backlight Ecore_Fb_Ts_Backlight;
+typedef struct _Ecore_Fb_Ts_Contrast Ecore_Fb_Ts_Contrast;
typedef struct _Ecore_Fb_Ts_Led Ecore_Fb_Ts_Led;
+typedef struct _Ecore_Fb_Ts_Flite Ecore_Fb_Ts_Flite;
typedef struct _Ecore_Fb_Ps2_Event Ecore_Fb_Ps2_Event;
struct _Ecore_Fb_Ts_Event
@@ -59,14 +72,26 @@
unsigned char brightness;
};
+struct _Ecore_Fb_Ts_Contrast
+{
+ unsigned char contrast;
+};
+
struct _Ecore_Fb_Ts_Led
{
- unsigned char onoff;
+ unsigned char on;
unsigned char blink_time;
unsigned char on_time;
unsigned char off_time;
};
+struct _Ecore_Fb_Ts_Flite
+{
+ unsigned char mode;
+ unsigned char pwr;
+ unsigned char brightness;
+};
+
struct _Ecore_Fb_Ps2_Event
{
unsigned char button;
@@ -361,9 +386,9 @@
{
int prev_flags;
+ printf("%x\n", FLITE_ON);
_ecore_fb_init_count++;
if (_ecore_fb_init_count > 1) return _ecore_fb_init_count;
-
_ecore_fb_ts_fd = open("/dev/touchscreen/0", O_RDONLY);
if (_ecore_fb_ts_fd >= 0)
{
@@ -646,6 +671,65 @@
if (_ecore_fb_ts_fd < 0) return 1.0;
ioctl(_ecore_fb_ts_fd, TS_GET_BACKLIGHT, &bl);
return (double)bl.brightness / 255.0;
+}
+
+void
+ecore_fb_led_set(int on)
+{
+ Ecore_Fb_Ts_Led led;
+
+ if (_ecore_fb_ts_fd < 0) return;
+ if (on) led.on = 1;
+ else led.on = 0;
+ ioctl(_ecore_fb_ts_fd, LED_ON, &led);
+}
+
+void
+ecore_fb_led_blink_set(double speed)
+{
+ Ecore_Fb_Ts_Led led;
+
+ if (_ecore_fb_ts_fd < 0) return;
+ led.on = 1;
+ led.on_time = (unsigned char)(speed * 10);
+ led.off_time = (unsigned char)(speed * 10);
+ led.blink_time = 255;
+ ioctl(_ecore_fb_ts_fd, LED_ON, &led);
+}
+
+void
+ecore_fb_contrast_set(double cr)
+{
+ Ecore_Fb_Ts_Contrast ct;
+ int val;
+
+ if (cr < 0) cr = 0;
+ if (cr > 1) cr = 1;
+ val = (int)(255.0 * cr);
+ ct.contrast = val;
+ ioctl(_ecore_fb_ts_fd, TS_SET_CONTRAST, &ct);
+}
+
+double
+ecore_fb_contrast_get(void)
+{
+ Ecore_Fb_Ts_Contrast ct;
+
+ if (_ecore_fb_ts_fd < 0) return 1.0;
+ ioctl(_ecore_fb_ts_fd, TS_GET_CONTRAST, &ct);
+ return (double)ct.contrast / 255.0;
+}
+
+double
+ecore_fb_light_sensor_get(void)
+{
+ Ecore_Fb_Ts_Flite fl;
+
+ if (_ecore_fb_ts_fd < 0) return 0.0;
+ fl.mode = 3;
+ fl.brightness = 0;
+ ioctl(_ecore_fb_ts_fd, FLITE_ON, &fl);
+ return (double)fl.brightness / 255.0;
}
static void
-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
_______________________________________________
enlightenment-cvs mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs