New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Virtual device #41

merged 122 commits into from Oct 2, 2017
Jump to file or symbol
Failed to load files and symbols.
+9 −2
Diff settings


Just for now

Viewing a subset of changes. View all

device_test: only update modified lights

This minimizes function calls to update LEDs states, and
makes it easier to debug which light calls are made.

Signed-off-by: Harry van Haaren <>
  • Loading branch information...
harryhaaren committed Oct 1, 2017
commit b1bd5965acbdd3f9b9ee3b3397cddcd01b246bc1
@@ -11,6 +11,7 @@ static uint32_t led_count;
#define NUM_LEDS 256
static uint32_t leds[NUM_LEDS];
static uint32_t leds_update[NUM_LEDS];
static struct ctlra_dev_t *avtka_ui;
@@ -41,8 +42,12 @@ void simple_feedback_func(struct ctlra_dev_t *dev, void *d)
ctlra_dev_get_info(dev, &info);
/* raw LED API *MUST* be used first */
for(int i = 0; i < NUM_LEDS; i++)
ctlra_dev_light_set(dev, i, leds[i]);
for(int i = 0; i < NUM_LEDS; i++) {
if(leds_update[i]) {
ctlra_dev_light_set(dev, i, leds[i]);
leds_update[i] = 0;
/* raw LED API for Grid */
if(info.control_count[CTLRA_EVENT_GRID]) {
@@ -88,6 +93,8 @@ void simple_event_func(struct ctlra_dev_t* dev, uint32_t num_events,
uint32_t col = item->flags & CTLRA_ITEM_LED_COLOR ?
0xff0000ff : 0xff000000;
leds[item->fb_id] = e->button.pressed * col;
leds_update[item->fb_id] = 1;
printf("btn id = %d, fb id = %d\n", id, item->fb_id);
ProTip! Use n and p to navigate between commits in a pull request.