Changeset 2034:47fdcec46b5c in roaraudio for roard
- Timestamp:
- 06/21/09 15:07:14 (15 years ago)
- Branch:
- default
- Phase:
- public
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
roard/driver_pwmled.c
r1990 r2034 94 94 ssize_t driver_pwmled_write (struct roar_vio_calls * vio, void *buf, size_t count) { 95 95 struct driver_pwmled * self = vio->inst; 96 int value; 96 97 97 98 if ( vio == NULL || buf == NULL ) … … 101 102 return -1; 102 103 103 if ( roar_light_pwm_set(&(self->state), ((unsigned char*)buf)[self->channel] / 16) == -1 ) 104 value = ((unsigned char*)buf)[self->channel] / 15; 105 106 if ( roar_light_pwm_set(&(self->state), value) == -1 ) 104 107 return -1; 105 108 106 // bit per word, bit per byte 107 return roar_light_pwm_send(&(self->state), &(self->vio), self->rate/11/8/100) == 0 ? count : -1; 109 if ( value ) { 110 // bit per word, bit per byte 111 return roar_light_pwm_send(&(self->state), &(self->vio), self->rate/11/8/100) == 0 ? count : -1; 112 } 113 114 return count; 108 115 } 109 116
Note: See TracChangeset
for help on using the changeset viewer.