test

Dependencies:   mbed AsyncBuzzerLib X_NUCLEO_53L1A1_mbed WS2812

Committer:
elab
Date:
Tue Sep 29 09:08:55 2020 +0000
Revision:
0:89b87662e64b
first version

Who changed what in which revision?

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