Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Fork of BluetoothAsia2018Peripheral by
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 //Animation Control Event 00039 #define ANIMATION_CONTROL_EVENT 9100 00040 #define ANIMATION_CONTROL_STOP 0x00 00041 #define ANIMATION_CONTROL_START 0x01 00042 #define ANIMATION_CONTROL_SLOWER 0x10 00043 #define ANIMATION_CONTROL_FASTER 0x11 00044 00045 //Animation Type Event 00046 #define ANIMATION_TYPE_EVENT 9101 00047 #define ANIMATION_TYPE_FLASH 0x01 00048 #define ANIMATION_TYPE_RIPPLE 0x02 00049 #define ANIMATION_TYPE_SPIRAL 0x03 00050 00051 #define ANIMATION_STATUS_EVENT 9102 00052 #define ANIMATION_STATUS_FREE 0x00 00053 #define ANIMATION_STATUS_BUSY 0x01 00054 00055 class Animator 00056 { 00057 00058 public: 00059 00060 int playing; 00061 int current_animation; 00062 int sleep_time; 00063 00064 Animator(MicroBitDisplay &_display); 00065 00066 void setAnimationType(uint16_t animation); 00067 00068 void start(); 00069 00070 void stop(); 00071 00072 void faster(); 00073 00074 void slower(); 00075 00076 void ripple(); 00077 00078 void spiral(); 00079 00080 void flash(); 00081 00082 void animationLoop(); 00083 00084 private: 00085 00086 MicroBitDisplay &display; 00087 00088 }; 00089 00090 #endif
Generated on Tue Jul 19 2022 21:01:47 by
1.7.2
