Changeset 5983:377909b17ccb in roaraudio
- Timestamp:
- 02/23/14 22:16:20 (10 years ago)
- Branch:
- default
- Phase:
- public
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
include/libroarlight/slfi.h
r5982 r5983 95 95 int roar_slfi_ctl(struct roar_slfi_inst * inst, enum roar_slfi_command command, void * argp); 96 96 97 int roar_slfi_event_add(struct roar_slfi_inst * inst, uint8_t event); // does not perform any context switching. 98 int roar_slfi_cb_set_event_add(struct roar_slfi_inst * inst, int (*cb)(struct roar_slfi_inst * inst, void * userdata, uint8_t event), void * userdata); 99 97 100 #endif 98 101 -
libroarlight/slfi.c
r5982 r5983 240 240 } 241 241 242 int roar_slfi_event_add(struct roar_slfi_inst * inst, uint8_t event) { 243 if ( inst == NULL ) { 244 roar_err_set(ROAR_ERROR_FAULT); 245 return -1; 246 } 247 248 if ( inst->cb_event_add == NULL ) { 249 roar_err_set(ROAR_ERROR_NOSYS); 250 return -1; 251 } 252 253 return inst->cb_event_add(inst, inst->cb_event_add_userdata, event); 254 } 255 256 int roar_slfi_cb_set_event_add(struct roar_slfi_inst * inst, int (*cb)(struct roar_slfi_inst * inst, void * userdata, uint8_t event), void * userdata) { 257 if ( inst == NULL ) { 258 roar_err_set(ROAR_ERROR_FAULT); 259 return -1; 260 } 261 262 inst->cb_event_add = cb; 263 inst->cb_event_add_userdata = userdata; 264 return 0; 265 } 266 242 267 //ll -
roard/light.c
r5982 r5983 28 28 #ifndef ROAR_WITHOUT_DCOMP_LIGHT 29 29 30 static uint8_t nextcycle_events[MAX_EVENTS_PER_CYCLE]; 31 static size_t nextcycle_eventsqueuelen; 32 static int __cb_event_add(struct roar_slfi_inst * inst, void * userdata, uint8_t event); 33 30 34 // declared 'extern' 31 35 struct light_state g_light_state; … … 148 152 149 153 g_light_state.eventsqueuelen = 0; 154 155 if ( nextcycle_eventsqueuelen ) { 156 light_dmxevent_add(nextcycle_events, nextcycle_eventsqueuelen); 157 nextcycle_eventsqueuelen = 0; 158 } 150 159 151 160 return 0; … … 298 307 299 308 if ( primary ) { 309 roar_slfi_cb_set_event_add(filter, __cb_event_add, NULL); 300 310 g_light_state.filter = filter; 301 311 return 0; … … 395 405 } 396 406 407 static int __cb_event_add(struct roar_slfi_inst * inst, void * userdata, uint8_t event) { 408 size_t i; 409 410 if ( nextcycle_eventsqueuelen == MAX_EVENTS_PER_CYCLE ) { 411 roar_err_set(ROAR_ERROR_NOSPC); 412 return -1; 413 } 414 415 nextcycle_events[nextcycle_eventsqueuelen++] = event; 416 417 return 0; 418 } 419 397 420 #endif 398 421
Note: See TracChangeset
for help on using the changeset viewer.