A basic graphics package for the LPC4088 Display Module.

Dependents:   lpc4088_displaymodule_demo_sphere sampleGUI sampleEmptyGUI lpc4088_displaymodule_fs_aid ... more

Fork of DMBasicGUI by EmbeddedArtists AB

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers AppTouchCalibration.h Source File

AppTouchCalibration.h

00001 /*
00002  *  Copyright 2014 Embedded Artists AB
00003  *
00004  *  Licensed under the Apache License, Version 2.0 (the "License");
00005  *  you may not use this file except in compliance with the License.
00006  *  You may obtain a copy of the License at
00007  *
00008  *    http://www.apache.org/licenses/LICENSE-2.0
00009  *
00010  *  Unless required by applicable law or agreed to in writing, software
00011  *  distributed under the License is distributed on an "AS IS" BASIS,
00012  *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
00013  *  See the License for the specific language governing permissions and
00014  *  limitations under the License.
00015  */
00016  
00017 #ifndef APP_TOUCHCALIBRATION_H
00018 #define APP_TOUCHCALIBRATION_H
00019 
00020 #include "App.h"
00021 #include "DMBoard.h"
00022 #include "lpc_swim.h"
00023 #include "ImageButton.h"
00024 #include "Resource.h"
00025 
00026 /**
00027  * An App example guiding the user through the steps needed to (re)calibrate the
00028  * touch controller. After the user presses each of the four corner for calibration
00029  * the program turns into a very simple drawing application until the Done button
00030  * is pressed.
00031  *
00032  * The purpose of this example is to show how to (re)calibrate the touch controller
00033  * if that is ever needed.
00034  */
00035 class AppTouchCalibration : public App {
00036 public:
00037 
00038     AppTouchCalibration();
00039     virtual ~AppTouchCalibration();
00040 
00041     virtual bool setup();
00042     virtual void runToCompletion();
00043     virtual bool teardown();
00044 
00045     enum Resources {
00046         Resource_Ok_button,
00047     };
00048 
00049     /** Specifies the resource to use
00050      *
00051      *  Adds a resource for a specific id. This allows the
00052      *  user program to select e.g. which image to use and
00053      *  if it should be loaded from a file or an array.
00054      *
00055      *  @param id  the identifier
00056      *  @param res the resource
00057      */
00058     void addResource(Resources id, Resource* res);
00059 
00060 private:
00061     Display* _disp;
00062     TouchPanel* _touch;
00063     SWIM_WINDOW_T* _win;
00064     SWIM_WINDOW_T* _msg;
00065     void* _fb;
00066     ImageButton* _btn;
00067     Resource* _resOk;
00068 
00069     void draw();
00070     void drawMarker(uint16_t x, uint16_t y, bool erase);
00071     bool calibrate();
00072     void showStatus(const char* message, int line=0);
00073 };
00074 
00075 #endif