Starter project for Bluetooth SIG hands-on training course
Embed:
(wiki syntax)
Show/hide line numbers
Animator.h
00001 /* 00002 The MIT License (MIT) 00003 00004 Copyright (c) 2016 British Broadcasting Corporation. 00005 This software is provided by Lancaster University by arrangement with the BBC. 00006 00007 Permission is hereby granted, free of charge, to any person obtaining a 00008 copy of this software and associated documentation files (the "Software"), 00009 to deal in the Software without restriction, including without limitation 00010 the rights to use, copy, modify, merge, publish, distribute, sublicense, 00011 and/or sell copies of the Software, and to permit persons to whom the 00012 Software is furnished to do so, subject to the following conditions: 00013 00014 The above copyright notice and this permission notice shall be included in 00015 all copies or substantial portions of the Software. 00016 00017 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 00018 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 00019 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO Animation SHALL 00020 THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 00021 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 00022 FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 00023 DEALINGS IN THE SOFTWARE. 00024 */ 00025 00026 #ifndef ANIMATOR_H 00027 #define ANIMATOR_H 00028 00029 /* 00030 * Class definition for an Animator 00031 */ 00032 00033 #include "MicroBitDisplay.h" 00034 00035 #define NUMBER_OF_ANIMATIONS 0x03 00036 #define ANIMATION_SPEED_DELTA 50 00037 00038 #define ANIMATION_CONTROL_EVENT 9100 00039 #define ANIMATION_CONTROL_START 0x01 00040 #define ANIMATION_CONTROL_STOP 0x02 00041 #define ANIMATION_CONTROL_FASTER 0x03 00042 #define ANIMATION_CONTROL_SLOWER 0x04 00043 00044 #define ANIMATION_TYPE_EVENT 9101 00045 #define ANIMATION_TYPE_FLASH 0x01 00046 #define ANIMATION_TYPE_RIPPLE 0x02 00047 #define ANIMATION_TYPE_SPIRAL 0x03 00048 00049 #define ANIMATION_STATUS_EVENT 9102 00050 #define ANIMATION_STATUS_FREE 0x00 00051 #define ANIMATION_STATUS_BUSY 0x01 00052 00053 class Animator 00054 { 00055 00056 public: 00057 00058 int playing; 00059 int current_animation; 00060 int sleep_time; 00061 00062 Animator(MicroBitDisplay &_display); 00063 00064 void setAnimationType(uint16_t animation); 00065 00066 void start(); 00067 00068 void stop(); 00069 00070 void faster(); 00071 00072 void slower(); 00073 00074 void ripple(); 00075 00076 void spiral(); 00077 00078 void flash(); 00079 00080 void animationLoop(); 00081 00082 private: 00083 00084 MicroBitDisplay &display; 00085 00086 }; 00087 00088 #endif
Generated on Sun Jul 24 2022 05:43:06 by
![doxygen](doxygen.png)