WIP
This commit is contained in:
parent
90d89c7fbe
commit
49383b1b32
68 changed files with 3385 additions and 610 deletions
|
@ -1,27 +1,33 @@
|
|||
#ifndef __ili9341_H
|
||||
#define __ili9341_H
|
||||
|
||||
#include "singleton.h"
|
||||
#include <f4ll_cpp/singleton.h>
|
||||
#include <f4ll_cpp/dmahelper.h>
|
||||
#include <inttypes.h>
|
||||
#include <initializer_list>
|
||||
#include "main.h"
|
||||
|
||||
class Ili9341Fsmc : public Singleton<Ili9341Fsmc>
|
||||
class Ili9341Fsmc : public Singleton<Ili9341Fsmc>, private DmaHelper
|
||||
{
|
||||
public:
|
||||
Ili9341Fsmc(volatile uint16_t *reg, volatile uint16_t *ram,
|
||||
DMA_TypeDef *dma, uint32_t dmaStream,
|
||||
bool horizontal = true);
|
||||
|
||||
void FillRect(uint16_t color);
|
||||
void FillRect(uint16_t x, uint16_t y, uint16_t width, uint16_t height, uint16_t color);
|
||||
void FillRect(uint16_t color, bool async = true);
|
||||
void FillRect(uint16_t x, uint16_t y, uint16_t width, uint16_t height, uint16_t color, bool async = true);
|
||||
uint16_t Width() { return m_width; }
|
||||
uint16_t Height() { return m_height; }
|
||||
void SetCursor(uint16_t x, uint16_t y, uint16_t fgColor, uint16_t bgColor);
|
||||
void PrintChar(char c, uint16_t x, uint16_t y, uint16_t fgColor, uint16_t bgColor);
|
||||
void PrintChar(char c);
|
||||
void Print(char const *str, uint8_t len = 0);
|
||||
|
||||
inline void WaitDmaIddle() { while(m_dmaEngineBusy); }
|
||||
inline void WaitDmaIdle() { while(m_dmaEngineBusy); }
|
||||
|
||||
void Test();
|
||||
|
||||
static void HandleDmaIrq(Ili9341Fsmc *obj) { obj->HandleDmaIrq(); }
|
||||
|
||||
private:
|
||||
inline void WriteCmd(uint16_t cmd) { *m_reg = cmd; }
|
||||
|
@ -33,12 +39,9 @@ private:
|
|||
volatile uint16_t * const m_reg;
|
||||
volatile uint16_t * const m_ram;
|
||||
|
||||
DMA_TypeDef *m_dma;
|
||||
uint32_t m_dmaStream;
|
||||
friend void HandleLcdDmaIrq();
|
||||
void HandleDmaIrq();
|
||||
void SetupDmaSize(uint32_t size);
|
||||
void DmaTransferComplete();
|
||||
bool m_dmaEngineBusy = false;
|
||||
volatile bool m_dmaEngineBusy = false;
|
||||
uint32_t m_dmaRemainingPixels = 0;
|
||||
uint16_t m_dmaColor = 0;
|
||||
|
||||
|
@ -50,6 +53,11 @@ private:
|
|||
uint16_t m_rectWidth;
|
||||
uint16_t m_rectHeight;
|
||||
|
||||
uint16_t m_xPos = 0;
|
||||
uint16_t m_yPos = 0;
|
||||
uint16_t m_fgColor = ILI9341_WHITE;
|
||||
uint16_t m_bgColor = ILI9341_BLACK;
|
||||
|
||||
enum Commands {
|
||||
ILI9341_NOP = 0x00,
|
||||
ILI9341_RESET = 0x01,
|
||||
|
@ -130,6 +138,11 @@ private:
|
|||
ILI9341_PRC = 0xF7,
|
||||
};
|
||||
|
||||
static const uint8_t CHRHEIGHT = 8;
|
||||
static const uint8_t CHRWIDTH = 6;
|
||||
static const uint8_t CHRCOUNT = 96;
|
||||
static const uint8_t m_font[CHRCOUNT][CHRWIDTH];
|
||||
|
||||
public:
|
||||
enum Colors {
|
||||
ILI9341_BLACK = 0x0000, /* 0, 0, 0 */
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue