Added basic LED stuff to libpnd pnd_device
[pandora-libraries.git] / include / pnd_device.h
1
2 #ifndef h_pnd_device_h
3 #define h_pnd_device_h
4
5 #ifdef __cplusplus
6 extern "C" {
7 #endif
8
9 // do we have a 'minimal' lib yet anywhere formalized? if not, we could
10 // attempt to include it here.
11
12 // for reference material, see the Pandora wiki. Specifically, some good
13 // places to look:
14 // http://pandorawiki.org/Kernel_interface
15
16 /* for reference, here are some devices of use; most of these should already have
17  * functions below, to avoid you having to code your own.
18  */
19 #define PND_DEVICE_PROC_CLOCK "/proc/pandora/cpu_mhz_max"
20 #define PND_DEVICE_SYS_BACKLIGHT_BRIGHTNESS "/sys/class/backlight/gpio-backlight/brightness"
21 #define PND_DEVICE_FRAMEBUFFER "/dev/fb0"
22 #define PND_DEVICE_NUB1 "/dev/input/js1"
23 #define PND_DEVICE_NUB2 "/dev/input/js2"
24 #define PND_DEVICE_BATTERY_GAUGE_PERC "/sys/class/power_supply/bq27500-0/capacity"
25
26 #define PND_DEVICE_LED_CHARGER "/sys/class/leds/pandora::charger"
27 #define PND_DEVICE_LED_POWER   "/sys/class/leds/pandora::power"
28 #define PND_DEVICE_LED_SD1     "/sys/class/leds/pandora::sd1"
29 #define PND_DEVICE_LED_SD2     "/sys/class/leds/pandora::sd2"
30 #define PND_DEVICE_LED_WIFI    "/sys/class/leds/pandora::wifi"
31 #define PND_DEVICE_LED_BT      "/sys/class/leds/pandora::bluetooth"
32 #define PND_DEVICE_LED_SUFFIX_BRIGHTNESS "/brightness"
33
34 /* utility
35  */
36 unsigned char pnd_device_open_write_close ( char *name, char *v );
37 unsigned char pnd_device_open_read_close ( char *name, char *r_buffer, unsigned int buffer_len );
38
39 /* overall clock speed
40  * WARN: No boundaries are checked, so try to avoid setting clock to 2GHz :)
41  * NOTE: get-clock() is not implemented yet.
42  */
43 unsigned char pnd_device_set_clock ( unsigned int c ); // returns >0 on success
44 unsigned int pnd_device_get_clock ( void );
45
46 /* return the battery current %age level; 0-100%
47  * On error, returns -1
48  */
49 int pnd_device_get_battery_gauge_perc ( void );
50
51 // LCD to set on/off
52
53 // Backlight control
54 unsigned char pnd_device_set_backlight ( unsigned int v ); // value to set; 0 is off
55 unsigned int pnd_device_get_backlight ( void );
56
57 // set one or more LEDs on
58 unsigned char pnd_device_set_led_power_brightness ( unsigned char v ); // 0-255
59
60 // suspend/hibernate/etc
61
62 #ifdef __cplusplus
63 } /* "C" */
64 #endif
65
66 #endif