Landzo_K60Z_LwIP/src/main.c

56 lines
1.1 KiB
C
Raw Normal View History

#include <time.h>
/* HW Related */
2022-05-20 14:12:08 +00:00
#include "board.h"
#include "clock_config.h"
#include "peripherals.h"
#include "pin_mux.h"
2022-05-21 11:35:12 +00:00
/* Console */
#include "fsl_debug_console.h"
/* MISC */
#include "ip_stack_helpers.h"
2022-05-20 14:12:08 +00:00
#include "system_utilities.h"
2022-05-21 11:35:12 +00:00
/*FreeRTOS*/
#include "FreeRTOS.h"
2022-05-20 15:24:48 +00:00
#include "task.h"
2022-05-20 14:12:08 +00:00
2022-05-20 15:24:48 +00:00
static void vTaskHello(void *pvParameters);
2022-05-20 14:12:08 +00:00
int main(void) {
BOARD_InitBootPins();
BOARD_BootClockRUN();
BOARD_InitBootPeripherals();
BOARD_InitDebugConsole();
BOARD_EnableRTC();
2022-05-20 14:12:08 +00:00
print_hardware();
sram_test();
2022-05-20 15:24:48 +00:00
xTaskCreate(vTaskHello, "HELLO", 256, NULL, 4, NULL);
vTaskStartScheduler();
2022-05-20 14:12:08 +00:00
for (;;) {
__WFI();
}
}
2022-05-20 15:24:48 +00:00
static void vTaskHello(void *pvParameters) {
ip_stack_setup();
time_t t;
struct tm *cur_tm;
2022-05-21 11:35:12 +00:00
for (;;) {
2022-05-20 15:24:48 +00:00
vTaskDelay(pdMS_TO_TICKS(1000));
t = time(NULL);
cur_tm = localtime(&t);
PRINTF("Current time: %04d-%02d-%02d %02d:%02d:%02d\r\n", cur_tm->tm_year + 1900, cur_tm->tm_mon + 1,
cur_tm->tm_mday, cur_tm->tm_hour, cur_tm->tm_min, cur_tm->tm_sec);
2022-05-20 15:24:48 +00:00
}
}