Оптимизированы функции полттера добавлены функции для рисования стрелок
Плоттер - функция для отрисовки интерфейса плоттера - функция для отрисовки самого графика (кривой) - функции для отрисовки float, int, uint8_t, uint16_t - добавлены сдвиги осей Стрелки - функция для рисования ортогональных стрелок (вправо, влево, вверх, вниз) - функция для рисования стрелок в любом направлении
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
#include "math.h"
|
||||
int menu_white_theme = 0;
|
||||
|
||||
//#define ROTATING_ARROW_EXAMPLE
|
||||
#define SINE_EXAMPLE
|
||||
//#define ECG_EXAMPLE
|
||||
//#define PLAYER_EXAMPLE
|
||||
@@ -63,7 +64,7 @@ float ecg_data[ECG_SIZE] = {1.05893, 0.999357, 0.933132, 0.744792, 0.664672, 0.3
|
||||
void GFX_Draw_LoopIcon(uint8_t *Buffer_Frame, uint8_t x, uint8_t y, uint8_t width, uint8_t height, uint8_t pxColor);
|
||||
|
||||
GFXIconsTypeDef icons;
|
||||
GFX_PlotterFloatHandleTypeDef plotter;
|
||||
GFX_PlotterHandleTypeDef plotter;
|
||||
|
||||
void Example_GFX_Init(void)
|
||||
{
|
||||
@@ -84,18 +85,26 @@ void Example_OLED_GFX_Update(PlayerTypeDef *player)
|
||||
oled_refresh();
|
||||
}
|
||||
}
|
||||
float sine2plot;
|
||||
float sine_cnt_step = 0.01;
|
||||
uint8_t sine2plot;
|
||||
float sine_cnt_step = 0.5;
|
||||
float sine_cnt = 1;
|
||||
float sine_scale = 255;
|
||||
float ecg_step = 2.5;
|
||||
float ecg_scale = 1.1;
|
||||
void Example_GFX_CreateFrame(PlayerTypeDef *player)
|
||||
{
|
||||
#if defined(SINE_EXAMPLE)
|
||||
sine2plot = sinf(sine_cnt);
|
||||
GFX_FloatPlotter(oled_buf, &plotter, &sine2plot);
|
||||
#if defined(ROTATING_ARROW_EXAMPLE)
|
||||
GFX_Clean_Buffer_Frame(oled_buf);
|
||||
__GFX_Draw_Arrow(oled_buf, 64, 16, 5, sine_cnt, 1);
|
||||
sine_cnt+=ecg_step;
|
||||
|
||||
#elif defined(SINE_EXAMPLE)
|
||||
sine2plot = (sinf(sine_cnt)+1)*128;
|
||||
GFX_Plotter_uint8_t(oled_buf, &plotter, &sine2plot, 0, 0, sine_scale);
|
||||
sine_cnt += sine_cnt_step;
|
||||
|
||||
#elif defined(ECG_EXAMPLE)
|
||||
GFX_FloatPlotter(oled_buf, &plotter, NULL);
|
||||
GFX_Plotter_float(oled_buf, &plotter, ecg_data, ECG_SIZE, ecg_step, ecg_scale);
|
||||
|
||||
#elif defined(PLAYER_EXAMPLE)
|
||||
GFX_Clean_Buffer_Frame(oled_buf);
|
||||
@@ -197,26 +206,24 @@ void GFX_Draw_LoopIcon(uint8_t *Buffer_Frame, uint8_t x, uint8_t y, uint8_t widt
|
||||
|
||||
|
||||
void Example_GFX_PlotterInit(void)
|
||||
{
|
||||
{
|
||||
#if defined(SINE_EXAMPLE)
|
||||
plotter.xPos = 0;
|
||||
plotter.yPos = 0;
|
||||
plotter.plotWidth = 128;
|
||||
plotter.plotHeight = 30;
|
||||
plotter.plotYShift = 64;
|
||||
plotter.f.plotXAxis = 1;
|
||||
plotter.f.plotYAxis = 1;
|
||||
#elif defined(ECG_EXAMPLE)
|
||||
plotter.xPos = 2;
|
||||
plotter.yPos = 0;
|
||||
plotter.plotWidth = 120;
|
||||
plotter.plotHeight = 32;
|
||||
plotter.plotXAxis = 1;
|
||||
plotter.plotYAxis = 1;
|
||||
|
||||
#if defined(SINE_EXAMPLE)
|
||||
plotter.dataMax = 1.1;
|
||||
plotter.signedData = 1;
|
||||
#elif defined(ECG_EXAMPLE)
|
||||
|
||||
plotter.pDataPtr = ecg_data;
|
||||
plotter.dataMax = 1.1;
|
||||
plotter.dataSize = 550;
|
||||
plotter.plotShift = 0;
|
||||
plotter.plotSpeed = 2.5;
|
||||
plotter.plotWidth = 128-plotter.xPos;
|
||||
plotter.plotHeight = 32;
|
||||
plotter.f.plotXAxis = 1;
|
||||
plotter.f.plotYAxis = 1;
|
||||
plotter.f.plotFrame = 1;
|
||||
#endif
|
||||
|
||||
}
|
||||
void Example_GFX_IconInit(void)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user