Chris Womack / DMBasicGUI

Fork of DMBasicGUI by Embedded Artists

Application/AppImageViewer.h

Committer:
embeddedartists
Date:
2014-12-11
Revision:
0:4977187e90c7
Child:
1:46c8df4608c8

File content as of revision 0:4977187e90c7:


#ifndef APP_IMAGEVIEWER_H
#define APP_IMAGEVIEWER_H

#include "App.h"
#include "DMBoard.h"
#include "lpc_swim.h"
#include "Button.h"
#include "Image.h"

/**
 * LcdController example
 *
 * @code
 * #include "mbed.h"
 * #include "LcdController.h"
 *
 * LcdController::Config innolux(
 *        45,
 *        17,
 *        2,
 *        800,
 *        22,
 *        22,
 *        2,
 *        480,
 *        false,
 *        false,
 *        true,
 *        true,
 *        true,
 *        LcdController::Bpp_16_565,
 *        36000000,
 *        LcdController::Tft,
 *        false);
 *
 * int main(void) {
 *    LcdController lcd;
 *
 *    lcd.open(&innolux);
 *    lcd.setFrameBuffer(frameBuffer);
 *    lcd.setPower(true);
 *
 *    // draw on the frame buffer
 *    ...
 * }
 * @endcode
 */
class AppImageViewer : public App {
public:

	AppImageViewer();
	~AppImageViewer();

    virtual bool setup();
    virtual void runToCompletion();
    virtual bool teardown();

    void load(const char* file);

private:
    Display* _disp;
    SWIM_WINDOW_T* _win;
    void* _fb1;
    void* _fb2;
    Button* _btn;
    Mail<Image::ImageData_t, 2> _mailbox;
    int _active;
    int _next;
    Mutex _allowedToRender;
    Mutex _imageLoaded;

    void draw();
};

#endif