mirror of
https://github.com/ttrftech/NanoVNA.git
synced 2025-12-06 03:31:59 +01:00
Add definition of spi_buffer size
Add check cell and spi_buffer size
This commit is contained in:
parent
c92987c52e
commit
5ee23be06f
|
|
@ -21,7 +21,7 @@
|
|||
#include "hal.h"
|
||||
#include "nanovna.h"
|
||||
|
||||
uint16_t spi_buffer[2048];
|
||||
uint16_t spi_buffer[SPI_BUFFER_SIZE];
|
||||
// Default foreground & background colors
|
||||
uint16_t foreground_color=DEFAULT_FG_COLOR;
|
||||
uint16_t background_color=DEFAULT_BG_COLOR;
|
||||
|
|
|
|||
|
|
@ -300,6 +300,9 @@ extern int16_t vbat;
|
|||
#define RGB565(r,g,b) ( (((g)&0x1c)<<11) | (((b)&0xf8)<<5) | ((r)&0xf8) | (((g)&0xe0)>>5) )
|
||||
#define RGBHEX(hex) ( (((hex)&0x001c00)<<3) | (((hex)&0x0000f8)<<5) | (((hex)&0xf80000)>>16) | (((hex)&0x00e000)>>13) )
|
||||
|
||||
// Define size of screen buffer in pixels (one pixel 16bit size)
|
||||
#define SPI_BUFFER_SIZE 2048
|
||||
|
||||
#define DEFAULT_FG_COLOR RGB565(255,255,255)
|
||||
#define DEFAULT_BG_COLOR RGB565( 0, 0, 0)
|
||||
#define DEFAULT_GRID_COLOR RGB565(128,128,128)
|
||||
|
|
@ -317,7 +320,7 @@ extern int16_t vbat;
|
|||
extern uint16_t foreground_color;
|
||||
extern uint16_t background_color;
|
||||
|
||||
extern uint16_t spi_buffer[2048];
|
||||
extern uint16_t spi_buffer[SPI_BUFFER_SIZE];
|
||||
|
||||
void ili9341_init(void);
|
||||
//void ili9341_setRotation(uint8_t r);
|
||||
|
|
|
|||
4
plot.c
4
plot.c
|
|
@ -16,6 +16,10 @@ int16_t area_height = AREA_HEIGHT_NORMAL;
|
|||
// Depends from spi_buffer size, CELLWIDTH*CELLHEIGHT <= sizeof(spi_buffer)
|
||||
#define CELLWIDTH (64)
|
||||
#define CELLHEIGHT (32)
|
||||
// Check buffer size
|
||||
#if CELLWIDTH*CELLHEIGHT > SPI_BUFFER_SIZE
|
||||
#error "Too small spi_buffer size SPI_BUFFER_SIZE < CELLWIDTH*CELLHEIGH"
|
||||
#endif
|
||||
|
||||
// indicate dirty cells (not redraw if cell data not changed)
|
||||
#define MAX_MARKMAP_X ((320+CELLWIDTH-1)/CELLWIDTH)
|
||||
|
|
|
|||
Loading…
Reference in a new issue