Skip to content

Commit

Permalink
lights: add support for LED blinking [WIP]
Browse files Browse the repository at this point in the history
  • Loading branch information
Daz Jones committed Dec 11, 2012
1 parent 5c8d702 commit 7d9ba16
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lights/Android.mk
Expand Up @@ -25,7 +25,7 @@ LOCAL_SRC_FILES := lights.c
LOCAL_PRELINK_MODULE := false
LOCAL_MODULE_PATH := $(TARGET_OUT_SHARED_LIBRARIES)/hw

LOCAL_SHARED_LIBRARIES := liblog
LOCAL_SHARED_LIBRARIES := libhwrpc liblog

LOCAL_MODULE := lights.u8815

Expand Down
17 changes: 17 additions & 0 deletions lights/lights.c
Expand Up @@ -33,6 +33,9 @@
#include <hardware/lights.h>

/******************************************************************************/

/* In libhwrpc.so */
extern void huawei_oem_rapi_streaming_function(int n, int p1, int p2, int p3, int *v1, int *v2, int *v3);

static pthread_once_t g_init = PTHREAD_ONCE_INIT;
static pthread_mutex_t g_lock = PTHREAD_MUTEX_INITIALIZER;
Expand Down Expand Up @@ -149,6 +152,8 @@ set_speaker_light_locked(struct light_device_t* dev,
int onMS, offMS;
unsigned int colorRGB;

int v[3];

switch (state->flashMode) {
case LIGHT_FLASH_TIMED:
onMS = state->flashOnMS;
Expand Down Expand Up @@ -192,10 +197,22 @@ set_speaker_light_locked(struct light_device_t* dev,
pwm = 16;

blink = 1;
if(read_int(SLEEP_FILE) == 0) {
v[0] = colorRGB;
v[1] = onMS/2;
v[2] = offMS;
huawei_oem_rapi_streaming_function(0x26, 0, 0, 0xc, v, 0, 0);
}
} else {
blink = 0;
freq = 0;
pwm = 0;
if(read_int(SLEEP_FILE) == 0) {
v[0] = colorRGB;
v[1] = 0;
v[2] = 0;
huawei_oem_rapi_streaming_function(0x26, 0, 0, 0xc, v, 0, 0);
}
}

if (blink) {
Expand Down

0 comments on commit 7d9ba16

Please sign in to comment.