Changeset 1978:8501a4e5fb9a in roaraudio


Ignore:
Timestamp:
06/12/09 03:44:55 (15 years ago)
Author:
phi
Branch:
default
Phase:
public
Message:

got driver basicly working

Location:
roard
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • roard/driver_pwmled.c

    r1974 r1978  
    2626 
    2727int 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; 
    2833 
    2934 if ( fh == -1 ) { 
     
    3136   device = "/dev/ttyS0"; 
    3237 
    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 ) 
    3439   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; 
    3547 } else { 
     48/* 
    3649  if ( roar_vio_open_fh(inst, fh) == -1 ) 
    3750   return -1; 
     51*/ 
     52  return -1; 
    3853 } 
    3954 
    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; 
    4258 inst->nonblock = NULL; 
     59 inst->sync     = NULL; 
     60 inst->ctl      = driver_pwmled_ctl; 
     61 inst->close    = driver_pwmled_close; 
    4362 
    4463 info->codec = ROAR_CODEC_DMX512; 
    4564 
    4665 return 0; 
     66} 
     67 
     68int     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; 
    4775} 
    4876 
     
    6391  return -1; 
    6492 
    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; 
    6694} 
    6795 
  • roard/include/driver_pwmled.h

    r1974 r1978  
    2929ssize_t driver_pwmled_write (struct roar_vio_calls * vio,  void *buf, size_t count); 
    3030int     driver_pwmled_ctl   (struct roar_vio_calls * vio,  int cmd, void * data); 
     31int     driver_pwmled_close (struct roar_vio_calls * vio); 
    3132 
    3233#endif 
Note: See TracChangeset for help on using the changeset viewer.