led driver
This commit is contained in:
parent
cdb315da32
commit
f4bc903172
@ -21,10 +21,17 @@ struct thread_context tc_1;
|
||||
|
||||
void task1(void *arg)
|
||||
{
|
||||
char rd = '0';
|
||||
open(&led_4);
|
||||
write(&led_4, 0, 1);
|
||||
write(&led_4, &rd, 1);
|
||||
while(1) {
|
||||
sleep_ms(1000);
|
||||
read(&led_4, &rd, 1);
|
||||
if(rd == '0')
|
||||
rd = '1';
|
||||
else
|
||||
rd = '0';
|
||||
write(&led_4, &rd, 1);
|
||||
write(&uart_1, "Driver test\r\n", 13);
|
||||
}
|
||||
}
|
||||
|
@ -110,7 +110,7 @@ int write(const struct driver *driver, const char *buffer, int len)
|
||||
case DRIVER_TYPE_GPIO:
|
||||
if(len > 0) {
|
||||
char send = 0;
|
||||
if(buffer[0])
|
||||
if((buffer[0] - 0x30) > 0)
|
||||
send = 1;
|
||||
gpio_write((const struct gpio *)(driver->device_driver), send);
|
||||
ret = 1;
|
||||
|
Loading…
Reference in New Issue
Block a user