![](/media/cache/group/default_image.jpg.50x50_q85.jpg)
Final Project로 실제 점검에 사용된 코드
Dependencies: mbed Adafruit_GFX
PixelArray/PixelArray.h@0:22391cd705e2, 2019-06-15 (annotated)
- Committer:
- 21400688
- Date:
- Sat Jun 15 20:52:15 2019 +0000
- Revision:
- 0:22391cd705e2
vb
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
21400688 | 0:22391cd705e2 | 1 | /* Copyright (c) 2012 cstyles, MIT License |
21400688 | 0:22391cd705e2 | 2 | * |
21400688 | 0:22391cd705e2 | 3 | * Permission is hereby granted, free of charge, to any person obtaining a copy of this software |
21400688 | 0:22391cd705e2 | 4 | * and associated documentation files (the "Software"), to deal in the Software without restriction, |
21400688 | 0:22391cd705e2 | 5 | * including without limitation the rights to use, copy, modify, merge, publish, distribute, |
21400688 | 0:22391cd705e2 | 6 | * sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is |
21400688 | 0:22391cd705e2 | 7 | * furnished to do so, subject to the following conditions: |
21400688 | 0:22391cd705e2 | 8 | * |
21400688 | 0:22391cd705e2 | 9 | * The above copyright notice and this permission notice shall be included in all copies or |
21400688 | 0:22391cd705e2 | 10 | * substantial portions of the Software. |
21400688 | 0:22391cd705e2 | 11 | * |
21400688 | 0:22391cd705e2 | 12 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING |
21400688 | 0:22391cd705e2 | 13 | * BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND |
21400688 | 0:22391cd705e2 | 14 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, |
21400688 | 0:22391cd705e2 | 15 | * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
21400688 | 0:22391cd705e2 | 16 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
21400688 | 0:22391cd705e2 | 17 | */ |
21400688 | 0:22391cd705e2 | 18 | |
21400688 | 0:22391cd705e2 | 19 | #ifndef PixelArray_H |
21400688 | 0:22391cd705e2 | 20 | #define PixelArray_H |
21400688 | 0:22391cd705e2 | 21 | |
21400688 | 0:22391cd705e2 | 22 | #include "mbed.h" |
21400688 | 0:22391cd705e2 | 23 | |
21400688 | 0:22391cd705e2 | 24 | //!Library for the WS2812 RGB LED with integrated controller |
21400688 | 0:22391cd705e2 | 25 | /*! |
21400688 | 0:22391cd705e2 | 26 | PixelArray |
21400688 | 0:22391cd705e2 | 27 | */ |
21400688 | 0:22391cd705e2 | 28 | class PixelArray |
21400688 | 0:22391cd705e2 | 29 | { |
21400688 | 0:22391cd705e2 | 30 | public: |
21400688 | 0:22391cd705e2 | 31 | //!Creates an instance of the class. |
21400688 | 0:22391cd705e2 | 32 | /*! |
21400688 | 0:22391cd705e2 | 33 | Pixel Array |
21400688 | 0:22391cd705e2 | 34 | */ |
21400688 | 0:22391cd705e2 | 35 | PixelArray(int); |
21400688 | 0:22391cd705e2 | 36 | |
21400688 | 0:22391cd705e2 | 37 | /*! |
21400688 | 0:22391cd705e2 | 38 | Destroys instance. |
21400688 | 0:22391cd705e2 | 39 | */ |
21400688 | 0:22391cd705e2 | 40 | ~PixelArray(); |
21400688 | 0:22391cd705e2 | 41 | |
21400688 | 0:22391cd705e2 | 42 | int* getBuf(); |
21400688 | 0:22391cd705e2 | 43 | |
21400688 | 0:22391cd705e2 | 44 | void SetAll(unsigned int); |
21400688 | 0:22391cd705e2 | 45 | void SetAllI(unsigned char); |
21400688 | 0:22391cd705e2 | 46 | void SetAllR(unsigned char); |
21400688 | 0:22391cd705e2 | 47 | void SetAllG(unsigned char); |
21400688 | 0:22391cd705e2 | 48 | void SetAllB(unsigned char); |
21400688 | 0:22391cd705e2 | 49 | |
21400688 | 0:22391cd705e2 | 50 | // location, value |
21400688 | 0:22391cd705e2 | 51 | void Set(int, unsigned int); |
21400688 | 0:22391cd705e2 | 52 | void SetI(int, unsigned char); |
21400688 | 0:22391cd705e2 | 53 | void SetR(int, unsigned char); |
21400688 | 0:22391cd705e2 | 54 | void SetG(int, unsigned char); |
21400688 | 0:22391cd705e2 | 55 | void SetB(int, unsigned char); |
21400688 | 0:22391cd705e2 | 56 | |
21400688 | 0:22391cd705e2 | 57 | private: |
21400688 | 0:22391cd705e2 | 58 | |
21400688 | 0:22391cd705e2 | 59 | int *pbuf; |
21400688 | 0:22391cd705e2 | 60 | int pbufsize; |
21400688 | 0:22391cd705e2 | 61 | |
21400688 | 0:22391cd705e2 | 62 | void __set_pixel_component(int index, int channel, int value); |
21400688 | 0:22391cd705e2 | 63 | void __set_pixel(int index, int value); |
21400688 | 0:22391cd705e2 | 64 | |
21400688 | 0:22391cd705e2 | 65 | }; |
21400688 | 0:22391cd705e2 | 66 | |
21400688 | 0:22391cd705e2 | 67 | #endif |
21400688 | 0:22391cd705e2 | 68 |