mmenu -- minor buglet when trying to create custom subcats for FD cats
[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 #define PND_DEVICE_CHARGE_CURRENT "/sys/class/power_supply/bq27500-0/current_now"
26
27 #define PND_DEVICE_LED_CHARGER "/sys/class/leds/pandora::charger"
28 #define PND_DEVICE_LED_POWER   "/sys/class/leds/pandora::power"
29 #define PND_DEVICE_LED_SD1     "/sys/class/leds/pandora::sd1"
30 #define PND_DEVICE_LED_SD2     "/sys/class/leds/pandora::sd2"
31 #define PND_DEVICE_LED_WIFI    "/sys/class/leds/pandora::wifi"
32 #define PND_DEVICE_LED_BT      "/sys/class/leds/pandora::bluetooth"
33 #define PND_DEVICE_LED_SUFFIX_BRIGHTNESS "/brightness"
34
35 // device names
36 #define PND_EVDEV_NUB1    "nub0" /*"vsense66"*/
37 #define PND_EVDEV_NUB2    "nub1" /*"vsense67"*/
38 #define PND_EVDEV_KEYPAD  "keypad" /*"omap_twl4030keypad"*/
39 #define PND_EVDEV_GPIO    "gpio-keys"
40 #define PND_EVDEV_TS      "touchscreen" /*"ADS784x Touchscreen"*/
41 #define PND_EVDEV_POWER   "power-button" /*"triton2-pwrbutton"*/
42
43 /* utility
44  */
45 unsigned char pnd_device_open_write_close ( char *name, char *v );
46 unsigned char pnd_device_open_read_close ( char *name, char *r_buffer, unsigned int buffer_len );
47
48 /* overall clock speed
49  * WARN: No boundaries are checked, so try to avoid setting clock to 2GHz :)
50  * NOTE: get-clock() is not implemented yet.
51  */
52 unsigned char pnd_device_set_clock ( unsigned int c ); // returns >0 on success
53 unsigned int pnd_device_get_clock ( void );
54
55 /* return the battery current %age level; 0-100%
56  * On error, returns -1
57  */
58 int pnd_device_get_battery_gauge_perc ( void );
59 unsigned char pnd_device_get_charge_current ( int *result ); // returns + - current; if charging, current is +ve.
60
61 // LCD to set on/off
62
63 // Backlight control
64 unsigned char pnd_device_set_backlight ( unsigned int v ); // value to set; 0 is off
65 unsigned int pnd_device_get_backlight ( void );
66
67 // set one or more LEDs on
68 unsigned char pnd_device_set_led_power_brightness ( unsigned char v ); // 0-255
69 unsigned char pnd_device_set_led_charger_brightness ( unsigned char v ); // 0-255
70
71 // suspend/hibernate/etc
72
73 #ifdef __cplusplus
74 } /* "C" */
75 #endif
76
77 #endif