universal driver access module
This commit is contained in:
@@ -13,18 +13,19 @@
|
||||
#include "isr.h"
|
||||
#include "sys_tick.h"
|
||||
|
||||
#include "driver.h"
|
||||
|
||||
#define STACK_SIZE 256
|
||||
stack_t tc_1_stack[STACK_SIZE];
|
||||
struct thread_context tc_1;
|
||||
|
||||
void task1(void *arg)
|
||||
{
|
||||
gpio_open(&led_1);
|
||||
gpio_write(&led_1, 0);
|
||||
open(&led_4);
|
||||
write(&led_4, 0, 1);
|
||||
while(1) {
|
||||
sleep_ms(1000);
|
||||
gpio_toggle(&led_1);
|
||||
uart_write(&uart_1, "Hello world\r\n", 13);
|
||||
write(&uart_1, "Driver test\r\n", 13);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -32,9 +33,9 @@ char rx_buf[80];
|
||||
void task2(void *arg)
|
||||
{
|
||||
while(1) {
|
||||
int i = uart_read(&uart_1, rx_buf, 80);
|
||||
int i = read(&uart_1, rx_buf, 80);
|
||||
if(i > 0) {
|
||||
uart_write(&uart_1, rx_buf, i);
|
||||
write(&uart_1, rx_buf, i);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -45,7 +46,7 @@ int main(void)
|
||||
{
|
||||
board_init();
|
||||
sys_tick_init(&timer_1);
|
||||
uart_open(&uart_1);
|
||||
open(&uart_1);
|
||||
thread_create(&tc_1, tc_1_stack, STACK_SIZE, task1, NULL, THREAD_PRIO_LOW);
|
||||
thread_create(&tc_2, tc_2_stack, STACK_SIZE, task2, NULL, THREAD_PRIO_LOW);
|
||||
|
||||
|
Reference in New Issue
Block a user