可以分别显示具体时间
This commit is contained in:
parent
207c11051f
commit
43e6e6127f
19
README.md
19
README.md
|
@ -61,7 +61,24 @@
|
|||
![alt text](my_picture/温度.png)
|
||||
|
||||
### 显示时间
|
||||
|
||||
[参考(https://blog.csdn.net/toopoo/article/details/113665077)](https://blog.csdn.net/toopoo/article/details/113665077)
|
||||
``` c
|
||||
void greattime()
|
||||
{
|
||||
time_t cur_time;
|
||||
struct tm *info;
|
||||
cur_time = ntp_get_time(RT_NULL);
|
||||
info=localtime(&cur_time);
|
||||
strftime(tmp, 80, "%Y-%m-%d", info);
|
||||
lcd_show_string(40, 240/2-32-24, 32, tmp);
|
||||
strftime(tmp, 80, "%H:%M:%S", info);
|
||||
lcd_show_string(50, 240/2+24, 32, tmp);
|
||||
if (cur_time)
|
||||
{
|
||||
rt_kprintf("NTP Server Time: %s", ctime((const time_t *)&cur_time));
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
# STM32F407 星火一号开发板 BSP 说明
|
||||
|
||||
|
|
|
@ -4,8 +4,11 @@
|
|||
#include <stdlib.h>
|
||||
#include <drv_lcd.h>
|
||||
#include <ntp.h>
|
||||
#include <time.h>
|
||||
|
||||
#define LCD_MAX 240
|
||||
|
||||
extern char tmp[];
|
||||
void lcd_black(int x, int y)
|
||||
{
|
||||
lcd_address_set(x, y, x, y);
|
||||
|
@ -41,6 +44,21 @@ void mytime()
|
|||
}
|
||||
lcd_show_string(20, 2, 16, ctime((const time_t *)&cur_time));
|
||||
}
|
||||
void greattime()
|
||||
{
|
||||
time_t cur_time;
|
||||
struct tm *info;
|
||||
cur_time = ntp_get_time(RT_NULL);
|
||||
info=localtime(&cur_time);
|
||||
strftime(tmp, 80, "%Y-%m-%d", info);
|
||||
lcd_show_string(40, 240/2-32-24, 32, tmp);
|
||||
strftime(tmp, 80, "%H:%M:%S", info);
|
||||
lcd_show_string(50, 240/2+24, 32, tmp);
|
||||
if (cur_time)
|
||||
{
|
||||
rt_kprintf("NTP Server Time: %s", ctime((const time_t *)&cur_time));
|
||||
}
|
||||
}
|
||||
|
||||
void xy_round(int x, int y, int x2, int y2, int r, int ii)
|
||||
{
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
|
||||
// 当前方向
|
||||
void mytime();
|
||||
void greattime();
|
||||
void xy_round(int x, int y, int x2, int y2, int r, int ii);
|
||||
void my_round(int r);
|
||||
void xy_sink();
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
#define DBG_TAG "main"
|
||||
#define DBG_LVL DBG_LOG
|
||||
#include <rtdbg.h>
|
||||
#include <ulog.h>
|
||||
// #include <ulog.h>
|
||||
#include <drv_lcd.h>
|
||||
|
||||
/* 配置 LED 灯引脚 */
|
||||
|
@ -21,7 +21,7 @@ extern rt_atomic_t page_chosen;
|
|||
extern rt_atomic_t page_first;
|
||||
extern rt_atomic_t page_stop;
|
||||
extern int snake_max;
|
||||
extern char tmp[10];
|
||||
extern char tmp[];
|
||||
|
||||
void snake_compare(rt_uint8_t key, rt_uint8_t repeat)
|
||||
{
|
||||
|
|
|
@ -12,6 +12,7 @@
|
|||
#include "mysnake.h"
|
||||
#include "infrared.h"
|
||||
#include <ulog.h>
|
||||
#include "my_func.h"
|
||||
|
||||
char DEMO_PRODUCT_KEY[IOTX_PRODUCT_KEY_LEN + 1] = {0};
|
||||
char DEMO_DEVICE_NAME[IOTX_DEVICE_NAME_LEN + 1] = {0};
|
||||
|
@ -209,8 +210,8 @@ void tmp_payload(void)
|
|||
my_round(20);
|
||||
page_first = 0;
|
||||
}
|
||||
|
||||
show_lcd();
|
||||
greattime();
|
||||
// show_lcd();
|
||||
}
|
||||
if (ps_data > 1022)
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue