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
Diff: Application/App.h
- Revision:
- 1:46c8df4608c8
- Parent:
- 0:4977187e90c7
- Child:
- 10:651861441108
--- a/Application/App.h Thu Dec 11 11:03:57 2014 +0000 +++ b/Application/App.h Thu Dec 11 18:15:52 2014 +0000 @@ -1,56 +1,70 @@ +/* + * Copyright 2014 Embedded Artists AB + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ #ifndef APP_H #define APP_H /** - * LcdController example + * Base class for all Apps. The idea is that you can have multiple + * Apps in your program. Each App has three funtions: * - * @code - * #include "mbed.h" - * #include "LcdController.h" + * setup() is called to let the App load all needed resources * - * LcdController::Config innolux( - * 45, - * 17, - * 2, - * 800, - * 22, - * 22, - * 2, - * 480, - * false, - * false, - * true, - * true, - * true, - * LcdController::Bpp_16_565, - * 36000000, - * LcdController::Tft, - * false); + * runToCompletion() is called and will not return until the App exits * - * int main(void) { - * LcdController lcd; + * teardown() is called to let the App free allocated resources * - * lcd.open(&innolux); - * lcd.setFrameBuffer(frameBuffer); - * lcd.setPower(true); - * - * // draw on the frame buffer - * ... - * } - * @endcode + * For an example of Apps in use, see the AppLauncher class */ class App { public: + /** Prepare the App before it is started. + * + * This function can be implemented to allocate memory, load startup + * images or other time consuming preparations. + * + * The return value is to let the caller now if the application can + * be started or not. + * + * @param x the touched x coordinate + * @param y the touched y coordinate + * @param pressed true if the user pressed the display + * + * @returns + * true if the app can be started + * false if the setup failed + */ virtual bool setup() { return true; } + + /** Runs the App to completion + * + * This function should not return until the App has finished. + */ virtual void runToCompletion() = 0; + + /** Cleanup + * + * Implement to free up the memory allocated in setup(). + * + * @returns + * true if the teardown finished successfully + * false if the teardown failed + */ virtual bool teardown() { return true; } }; #endif - - - - -