/*
 * Copyright (c) 2020-2021, Bluetrum Development Team
 *
 * SPDX-License-Identifier: Apache-2.0
 *
 * Change Logs:
 * Date           Author       Notes
 * 2020/12/10     greedyhao    The first version
 */

/**
 * Notice!
 * All functions or data that are called during an interrupt need to be in RAM.
 * You can do it the way exception_isr() does.
 */

#include <rtthread.h>
#include "board.h"
#include "rgb.h"
#include "oled.h"
#include "nmea_decode_test.h"

rt_uint32_t lat=0;
rt_uint32_t lon=0;
rt_uint32_t alt=0;
/* cat_dhtxx sensor data by dynamic */


int main(void)
{
    RGB_Init();
    rt_kprintf("Hello, world\n");
    OLED_Init();
    OLED_ColorTurn(0);//0正常显示，1 反色显示
    OLED_DisplayTurn(0);//0正常显示 1 屏幕翻转显示
    OLED_Refresh();
    OLED_ShowString(0,0,(u8 *)"lat:",16);
    OLED_ShowString(0,16,(u8 *)"lon:",16);
    OLED_ShowString(0,32,(u8 *)"alt:",16);

    while (1)
    {
      nmea_decode_test();
      rt_thread_mdelay(500);
      OLED_ShowNum(64,0,lat,2,16);
      OLED_ShowNum(64,24,lon,2,16);
      OLED_ShowNum(64,24,alt,2,16);
      OLED_Refresh();
      RGB_Blue(1);
      rt_thread_mdelay(10);
      RGB_Blue(0);
      rt_thread_mdelay(50);
//      RGB_Green(1);
//      rt_thread_mdelay(500);
//      RGB_Red(1);
//      rt_thread_mdelay(500);
    }
}
