Yuuichi Akagawa / DisplayAppEsp32
Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers DisplayAppEsp32.h Source File

DisplayAppEsp32.h

Go to the documentation of this file.
00001 /**************************************************************************//**
00002 * @file          DisplayAppEsp32.h
00003 * @brief         DisplayApp API
00004 ******************************************************************************/
00005 
00006 #ifndef DISPLAY_APP_ESP32_H
00007 #define DISPLAY_APP_ESP32_H
00008 
00009 #include "mbed.h"
00010 
00011 /** A class to communicate a DisplayAppEsp32
00012  *
00013  */
00014 class DisplayAppEsp32 {
00015 public:
00016     /** Constructor: Initializes DisplayAppEsp32.
00017      *
00018      * @param   tsk_pri        Priority of the thread function. (default: osPriorityNormal).
00019      * @param   init_pri       Priority of before the USB is connected. (default: osPriorityLow).
00020      * @param   stack_size     stack size (in bytes) requirements for the thread function. (default: DEFAULT_STACK_SIZE).
00021      */
00022     DisplayAppEsp32(osPriority tsk_pri = osPriorityNormal, uint32_t stack_size = DEFAULT_STACK_SIZE);
00023  
00024     /** Send JPEG data
00025      *
00026      * @param buf data buffer address
00027      * @param size data size
00028      * @return send data size
00029      */
00030     int SendJpeg(uint8_t * buf, uint32_t size);
00031 
00032 private:
00033     const static size_t BufferSize = 15360;
00034 
00035     bool bufmgr[2];
00036     uint8_t bufside;
00037     uint8_t sendbuf[2][BufferSize];
00038 
00039     typedef struct {
00040         size_t size;
00041         uint8_t side;
00042     } esp32Msg_t;
00043 
00044     RawSerial esp32;
00045     DigitalOut *esp32_en;
00046     DigitalOut *esp32_io0;
00047     MemoryPool<esp32Msg_t, 2> esp32Pool;
00048     Queue<esp32Msg_t, 2> esp32Q;
00049     Thread esp32Thread;
00050 
00051     void display_app_process();
00052     void SendHeader(uint32_t size);
00053     void SendData(uint8_t * buf, uint32_t size);
00054 };
00055 #endif