uart tx running

This commit is contained in:
tkl
2016-08-17 10:06:18 +02:00
parent a8a4cb263d
commit 4a9da1a9fd
14 changed files with 324 additions and 168 deletions

View File

@@ -1,9 +1,15 @@
ifeq ($(TEST_APP), shell)
include source/test/shell/shell.mk
endif
ifeq ($(TEST_APP), pwm)
include source/test/pwm/pwm.mk
endif
ifeq ($(TEST_APP), blinky)
include source/test/blinky/blinky.mk
endif
ifeq ($(TEST_APP), pwm)
include source/test/pwm/pwm.mk
endif
ifeq ($(TEST_APP), shell)
include source/test/shell/shell.mk
endif
ifeq ($(TEST_APP), uart)
include source/test/uart/uart.mk
endif

53
source/test/uart/main.c Normal file
View File

@@ -0,0 +1,53 @@
//
// This file is part of the GNU ARM Eclipse distribution.
// Copyright (c) 2014 Liviu Ionescu.
//
#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
#include "stack.h"
#include "queue.h"
#include "kernel.h"
#include "board.h"
#include "driver.h"
// Sample pragmas to cope with warnings. Please note the related line at
// the end of this function, used to pop the compiler diagnostics status.
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wunused-parameter"
#pragma GCC diagnostic ignored "-Wmissing-declarations"
#pragma GCC diagnostic ignored "-Wreturn-type"
#define TH_STACK_SIZE 256
stack_t th_stack[TH_STACK_SIZE];
struct thread_context th_ctx;
static void th_func(void *arg)
{
drv_open(&uart_1);
drv_open(&gpio_d12);
drv_write(&gpio_d12, "0", 1);
while(1) {
sleep_ms(1000);
drv_write(&uart_1, "set_led\r\n", 9);
drv_write(&gpio_d12, "1", 1);
sleep_ms(1000);
drv_write(&uart_1, "unset_led\r\n", 11);
drv_write(&gpio_d12, "0", 1);
}
}
int main(int argc, char* argv[])
{
board_init();
timer_open(&timer_1);
thread_create(&th_ctx, th_stack, TH_STACK_SIZE, th_func, NULL, THREAD_PRIO_LOW);
schedule_start();
return 0;
}
#pragma GCC diagnostic pop

1
source/test/uart/uart.mk Normal file
View File

@@ -0,0 +1 @@
SRC_DIR += source/test/uart