Browse Source

freertos: broken test

master
Franz Levin 5 years ago
parent
commit
394eda1300
2 changed files with 53 additions and 3 deletions
  1. +0
    -2
      projects/bikecomputer/Makefile
  2. +53
    -1
      projects/bikecomputer/main.c

+ 0
- 2
projects/bikecomputer/Makefile View File

@ -19,8 +19,6 @@ include $(ROOT)/platform/freertos.mk
C_SOURCE_FILES += $(wildcard *.c)
$(info $(C_SOURCE_FILES))
# Make sure your linker script is corretly configures
LINKER_SCRIPT = gcc_nrf52.ld


+ 53
- 1
projects/bikecomputer/main.c View File

@ -1,13 +1,65 @@
#include <stdbool.h>
#include "FreeRTOS.h"
#include "task.h"
#include "timers.h"
#include "semphr.h"
#include "gps/gps.h"
#include "drivers/uart.h"
#include "drivers/screen.h"
static void test_task(void* arg)
{
(void)arg;
int c = 0;
char buff[16];
screen_draw_text("task", 0);
while ( true ) {
snprintf(buff, sizeof(buff), "%d", c++);
screen_draw_text(buff, 0);
vTaskDelay(1000);
}
}
int main(void)
{
volatile int i = 0;
int c = 0;
TaskHandle_t task;
screen_init();
screen_draw_text("start", 0);
while( i == 0) {
char buff[16];
snprintf(buff, sizeof(buff), "%d", c++);
screen_draw_text(buff, 0);
}
xTaskCreate(test_task, "test", 6000, NULL, 2, &task);
#if 0
uart_init();
gps_init();
#endif
vTaskStartScheduler();
screen_draw_text("running?", 0);
while (true) {
// should not end up here
vTaskDelay(1000);
}
return 0;
}
}
void assert_nrf_callback(uint16_t line_num, const uint8_t *file_name)
{
screen_draw_text("assert", 0);
while (true) {
}
}

Loading…
Cancel
Save