MiaoUI/example/STM32F103C8T6/MultMenu/menu/wave.c

27 lines
718 B
C
Raw Normal View History

2024-07-10 12:15:39 +00:00
#include "wave.h"
#include "stdio.h"
2024-07-10 12:15:39 +00:00
#include "dispDirver.h"
uint8_t buffer[HOR_RES];
2024-07-10 12:15:39 +00:00
void Wave_Widget(xpMenu Menu)
{
uint8_t time;
2024-08-17 06:42:00 +00:00
char str[30];
for (time = HOR_RES - 1; time > 0; time--)
2024-07-10 12:15:39 +00:00
{
buffer[time] = buffer[time - 1];
}
buffer[0] = *(int *)(Menu->now_item->element->data->ptr) % (VER_RES - 20);
2024-07-10 12:15:39 +00:00
OLED_ClearBuffer();
2024-08-17 06:42:00 +00:00
uint8_t color = 1;
OLED_SetDrawColor(&color);
for (time = 0; time < HOR_RES - 1; time++)
2024-07-10 12:15:39 +00:00
{
OLED_DrawLine(time, buffer[time], time + 1, buffer[time + 1]);
2024-07-10 12:15:39 +00:00
}
sprintf(str, "%s:%d ", Menu->now_item->element->data->name, *(int *)(Menu->now_item->element->data->ptr));
OLED_DrawStr(0, VER_RES - 5, str);
2024-07-10 12:15:39 +00:00
OLED_SendBuffer();
}