diff --git a/source/application/test/main.c b/source/application/test/main.c index f98855d..1079e84 100644 --- a/source/application/test/main.c +++ b/source/application/test/main.c @@ -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); } } diff --git a/source/firmware/kernel/driver/driver.c b/source/firmware/kernel/driver/driver.c index 2203945..06b4747 100644 --- a/source/firmware/kernel/driver/driver.c +++ b/source/firmware/kernel/driver/driver.c @@ -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;