Changeset 1978:8501a4e5fb9a in roaraudio
- Timestamp:
- 06/12/09 03:44:55 (15 years ago)
- Branch:
- default
- Phase:
- public
- Location:
- roard
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
roard/driver_pwmled.c
r1974 r1978 26 26 27 27 int driver_pwmled_open_vio (struct roar_vio_calls * inst, char * device, struct roar_audio_info * info, int fh) { 28 struct roar_vio_defaults def; 29 struct roar_vio_calls * calls = malloc(sizeof(struct roar_vio_calls)); 30 31 if ( calls == NULL ) 32 return -1; 28 33 29 34 if ( fh == -1 ) { … … 31 36 device = "/dev/ttyS0"; 32 37 33 if ( roar_vio_ open_file(inst, device, O_WRONLY, 0644) == -1 )38 if ( roar_vio_dstr_init_defaults(&def, ROAR_VIO_DEF_TYPE_NONE, O_WRONLY, 0644) == -1 ) 34 39 return -1; 40 41 if ( roar_vio_open_dstr(calls, device, &def, 1) == -1 ) { 42 free(calls); 43 return -1; 44 } 45 46 inst->inst = calls; 35 47 } else { 48 /* 36 49 if ( roar_vio_open_fh(inst, fh) == -1 ) 37 50 return -1; 51 */ 52 return -1; 38 53 } 39 54 40 inst->write = driver_pwmled_write; 41 inst->ctl = driver_pwmled_ctl; 55 inst->read = NULL; 56 inst->write = driver_pwmled_write; 57 inst->lseek = NULL; 42 58 inst->nonblock = NULL; 59 inst->sync = NULL; 60 inst->ctl = driver_pwmled_ctl; 61 inst->close = driver_pwmled_close; 43 62 44 63 info->codec = ROAR_CODEC_DMX512; 45 64 46 65 return 0; 66 } 67 68 int driver_pwmled_close (struct roar_vio_calls * vio) { 69 int ret = roar_vio_close(vio->inst); 70 71 if ( vio->inst != NULL ) 72 free(vio->inst); 73 74 return ret; 47 75 } 48 76 … … 63 91 return -1; 64 92 65 return roar_light_pwm_send(&state, vio , 8) == 0 ? count : -1;93 return roar_light_pwm_send(&state, vio->inst, 1) == 0 ? count : -1; 66 94 } 67 95 -
roard/include/driver_pwmled.h
r1974 r1978 29 29 ssize_t driver_pwmled_write (struct roar_vio_calls * vio, void *buf, size_t count); 30 30 int driver_pwmled_ctl (struct roar_vio_calls * vio, int cmd, void * data); 31 int driver_pwmled_close (struct roar_vio_calls * vio); 31 32 32 33 #endif
Note: See TracChangeset
for help on using the changeset viewer.