#ifndef __FLASH_API_H__
#define __FLASH_API_H__
#include "ets_sys.h"
typedef struct __attribute__((packed))
{
    uint8_t unknown0;
    uint8_t unknown1;
    enum
    {
        MODE_QIO = 0,
        MODE_QOUT = 1,
        MODE_DIO = 2,
        MODE_DOUT = 15,
    } mode : 8;
    enum
    {
        SPEED_40MHZ = 0,
        SPEED_26MHZ = 1,
        SPEED_20MHZ = 2,
        SPEED_80MHZ = 15,
    } speed : 4;
    enum
    {
        SIZE_4MBIT = 0,
        SIZE_2MBIT = 1,
        SIZE_8MBIT = 2,
        SIZE_16MBIT = 3,
        SIZE_32MBIT = 4,
    } size : 4;
} SPIFlashInfo;

SPIFlashInfo *flash_get_info(void);
uint8_t flash_get_size(void);
uint32_t flash_get_size_byte(void);
bool flash_set_size(uint8_t);
bool flash_set_size_byte(uint32_t);
uint16_t flash_get_sec_num(void);
uint8_t flash_get_mode(void);
uint32_t flash_get_speed(void);
bool flash_init_data_default(void);
bool flash_init_data_blank(void);
bool flash_self_destruct(void);

#endif // __FLASH_API_H__
