diff --git a/epicardium/epicardium.h b/epicardium/epicardium.h index 2a57adbf60baee02d0ce57ad749052260eee6638..5c066adae00f620deb189199baf615a8ac68f000 100644 --- a/epicardium/epicardium.h +++ b/epicardium/epicardium.h @@ -586,12 +586,14 @@ API(API_LEDS_SET, void epic_leds_set(int led, uint8_t r, uint8_t g, uint8_t b)); /** * Get one of card10's RGB LEDs in format of RGB. * + * :c:func:`epic_leds_get_rgb` will get the value of a RGB LED described by ``led``. + * * :param int led: Which LED to set. 0-10 are the LEDs on the top and 11-14 * are the 4 "ambient" LEDs. * :param uint8_t * rgb: need tree byte array to get the value of red, green and blue. - * :return bool: if true the reading of value was not blocked by personal state + * :returns: ``0`` on success or ``-EPERM`` if the LED is blocked by personal-state. */ -API(API_LEDS_GET, bool epic_leds_get_rgb(int led, uint8_t * rgb)); +API(API_LEDS_GET, int epic_leds_get_rgb(int led, uint8_t * rgb)); /** * Set one of card10's RGB LEDs to a certain color in HSV format. diff --git a/epicardium/modules/leds.c b/epicardium/modules/leds.c index 27702835ab7f72090c3067fa31d5bee61a4401c5..3a394559365e5aa2b2154c839bf777855ff62719 100644 --- a/epicardium/modules/leds.c +++ b/epicardium/modules/leds.c @@ -49,13 +49,13 @@ void epic_leds_prep(int led, uint8_t r, uint8_t g, uint8_t b) leds_prep(led, r, g, b); } -bool epic_leds_get_rgb(int led, uint8_t *rgb) +int epic_leds_get_rgb(int led, uint8_t *rgb) { if (led == PERSONAL_STATE_LED && personal_state_enabled()) - return false; + return -EPERM; leds_get_rgb(led, rgb); - return true; + return 0; } void epic_leds_prep_hsv(int led, float h, float s, float v) diff --git a/pycardium/modules/sys_leds.c b/pycardium/modules/sys_leds.c index 86012f25bc3b68d180dd56625e53d54dd264a2db..1df647ca888b5667fa9dd603f7c82a42ad067a6c 100644 --- a/pycardium/modules/sys_leds.c +++ b/pycardium/modules/sys_leds.c @@ -78,7 +78,7 @@ static mp_obj_t mp_leds_prep(mp_obj_t led_in, mp_obj_t color_in) } static MP_DEFINE_CONST_FUN_OBJ_2(leds_prep_obj, mp_leds_prep); -static mp_obj_t mp_leds_get_rgb(mp_obj_t led_in, mp_obj_t color_out) +static mp_obj_t mp_leds_get_rgb(mp_obj_t led_in) { int led = mp_obj_get_int(led_in); uint8_t rgb[] = { 0, 0, 0 };