First Simon Says version

Dependencies:   mbed DebounceIn WS2812

Committer:
elab
Date:
Thu Feb 13 09:07:14 2020 +0000
Revision:
0:47b1ab4dd893
first version

Who changed what in which revision?

UserRevisionLine numberNew contents of line
elab 0:47b1ab4dd893 1 /* Copyright (c) 2012 cstyles, MIT License
elab 0:47b1ab4dd893 2 *
elab 0:47b1ab4dd893 3 * Permission is hereby granted, free of charge, to any person obtaining a copy of this software
elab 0:47b1ab4dd893 4 * and associated documentation files (the "Software"), to deal in the Software without restriction,
elab 0:47b1ab4dd893 5 * including without limitation the rights to use, copy, modify, merge, publish, distribute,
elab 0:47b1ab4dd893 6 * sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is
elab 0:47b1ab4dd893 7 * furnished to do so, subject to the following conditions:
elab 0:47b1ab4dd893 8 *
elab 0:47b1ab4dd893 9 * The above copyright notice and this permission notice shall be included in all copies or
elab 0:47b1ab4dd893 10 * substantial portions of the Software.
elab 0:47b1ab4dd893 11 *
elab 0:47b1ab4dd893 12 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING
elab 0:47b1ab4dd893 13 * BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
elab 0:47b1ab4dd893 14 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
elab 0:47b1ab4dd893 15 * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
elab 0:47b1ab4dd893 16 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
elab 0:47b1ab4dd893 17 */
elab 0:47b1ab4dd893 18
elab 0:47b1ab4dd893 19 #ifndef PixelArray_H
elab 0:47b1ab4dd893 20 #define PixelArray_H
elab 0:47b1ab4dd893 21
elab 0:47b1ab4dd893 22 #include "mbed.h"
elab 0:47b1ab4dd893 23
elab 0:47b1ab4dd893 24 //!Library for the WS2812 RGB LED with integrated controller
elab 0:47b1ab4dd893 25 /*!
elab 0:47b1ab4dd893 26 PixelArray
elab 0:47b1ab4dd893 27 */
elab 0:47b1ab4dd893 28 class PixelArray
elab 0:47b1ab4dd893 29 {
elab 0:47b1ab4dd893 30 public:
elab 0:47b1ab4dd893 31 //!Creates an instance of the class.
elab 0:47b1ab4dd893 32 /*!
elab 0:47b1ab4dd893 33 Pixel Array
elab 0:47b1ab4dd893 34 */
elab 0:47b1ab4dd893 35 PixelArray(int);
elab 0:47b1ab4dd893 36
elab 0:47b1ab4dd893 37 /*!
elab 0:47b1ab4dd893 38 Destroys instance.
elab 0:47b1ab4dd893 39 */
elab 0:47b1ab4dd893 40 ~PixelArray();
elab 0:47b1ab4dd893 41
elab 0:47b1ab4dd893 42 int* getBuf();
elab 0:47b1ab4dd893 43
elab 0:47b1ab4dd893 44 void SetAll(unsigned int);
elab 0:47b1ab4dd893 45 void SetAllI(unsigned char);
elab 0:47b1ab4dd893 46 void SetAllR(unsigned char);
elab 0:47b1ab4dd893 47 void SetAllG(unsigned char);
elab 0:47b1ab4dd893 48 void SetAllB(unsigned char);
elab 0:47b1ab4dd893 49
elab 0:47b1ab4dd893 50 // location, value
elab 0:47b1ab4dd893 51 void Set(int, unsigned int);
elab 0:47b1ab4dd893 52 void SetI(int, unsigned char);
elab 0:47b1ab4dd893 53 void SetR(int, unsigned char);
elab 0:47b1ab4dd893 54 void SetG(int, unsigned char);
elab 0:47b1ab4dd893 55 void SetB(int, unsigned char);
elab 0:47b1ab4dd893 56
elab 0:47b1ab4dd893 57 unsigned int Get(int);
elab 0:47b1ab4dd893 58 unsigned int GetI(int);
elab 0:47b1ab4dd893 59 unsigned int GetR(int);
elab 0:47b1ab4dd893 60 unsigned int GetG(int);
elab 0:47b1ab4dd893 61 unsigned int GetB(int);
elab 0:47b1ab4dd893 62
elab 0:47b1ab4dd893 63 private:
elab 0:47b1ab4dd893 64
elab 0:47b1ab4dd893 65 int *pbuf;
elab 0:47b1ab4dd893 66 int pbufsize;
elab 0:47b1ab4dd893 67
elab 0:47b1ab4dd893 68 void __set_pixel_component(int index, int channel, int value);
elab 0:47b1ab4dd893 69 void __set_pixel(int index, int value);
elab 0:47b1ab4dd893 70
elab 0:47b1ab4dd893 71 int __get_pixel_component(int index, int channel);
elab 0:47b1ab4dd893 72 int __get_pixel(int index);
elab 0:47b1ab4dd893 73
elab 0:47b1ab4dd893 74 };
elab 0:47b1ab4dd893 75
elab 0:47b1ab4dd893 76 #endif
elab 0:47b1ab4dd893 77