#ifndef OLED_MENU_DRIVER_H_
#define OLED_MENU_DRIVER_H_

#include "../../include/user/Print.h"
#include <cmath>
#include <u8g2.h>
#include "ti_msp_dl_config.h"


class MenuDriver {
    public:
        static u8g2_t u8g2;  // 静态成员变量

        inline static void init() {
            oled_init();
        }

        static void screenOn();
        static void screenOff();

        static void* getCanvasBuffer();

        static uint8_t getBufferTileHeight();
        static uint8_t getBufferTileWidth();
        static void canvasUpdate();
        static void canvasClear();
        static void setFont(const uint8_t *_font);
        static void setFont(const uint8_t *_font, uint8_t font_mode, uint8_t font_direction);
        static uint8_t getFontWidth(const char *_text);
        static uint8_t getFontHeight();
        static void setDrawType(uint8_t type);
        static void drawPixel(float x, float y);
        static void draw(float _x, float _y, const char *_text, const uint8_t *_font, uint8_t _font_mode, uint8_t _font_direction);
        static void draw(float _x, float _y, const char *_text, uint8_t _font_mode, uint8_t _font_direction);
        static void draw(float _x, float _y, const char *_text);
        static void drawEnglish(float _x, float _y, const char *_text);
        static void drawChinese(float _x, float _y, const char *_text);
        static void drawVDottedLine(float x, float y, float h);
        static void drawHDottedLine(float x, float y, float l);
        static void drawVLine(float x, float y, float h);
        static void drawHLine(float x, float y, float l);
        static void drawBMP(float x, float y, float w, float h, const uint8_t* bitMap);
        static void drawBox(float x, float y, float w, float h);
        static void drawRBox(float x, float y, float w, float h, float r);
        static void drawFrame(float x, float y, float w, float h);
        static void drawRFrame(float x, float y, float w, float h, float r);

        // static void delay(unsigned long mill);
        // unsigned long millis();
        // unsigned long getTick();
        // unsigned long getRandomSeed();

        static void drawCheckMark(float x, float y, float w, float h);

    private:
        static void oled_init();
        static void ssd1306_transmit_cmd(uint8_t cmd);
        static void ssd1306_transmit_data(uint8_t data, uint8_t mode);
        static void ssd1306_set_cursor(unsigned char x, unsigned char y);
        static void ssd1306_fill(unsigned char data);
};

#endif