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