12-Channel LED Driver With Gray scale Adaptive Pulse Density Modulation Control IC Library. maker MY-Semi
Revision 3:2131a24e5489, committed 2017-10-22
- Comitter:
- suupen
- Date:
- Sun Oct 22 22:59:19 2017 +0000
- Parent:
- 2:4d9aee0bd724
- Commit message:
- Completion;
Changed in this revision
MY9221.cpp | Show annotated file Show diff for this revision Revisions of this file |
MY9221.h | Show annotated file Show diff for this revision Revisions of this file |
--- a/MY9221.cpp Sun Oct 22 12:08:22 2017 +0000 +++ b/MY9221.cpp Sun Oct 22 22:59:19 2017 +0000 @@ -1,8 +1,3 @@ -/** - * MY9221 Library - */ -#define _MY9221_C - #include "mbed.h" #include "MY9221.h" @@ -13,7 +8,7 @@ ) : _di(di), _dcki(dcki), _number(number) { - // 変数初期化 ,マイコン機能の設定 + // initialize of variable and sfr _di = 0; _dcki = 0;
--- a/MY9221.h Sun Oct 22 12:08:22 2017 +0000 +++ b/MY9221.h Sun Oct 22 22:59:19 2017 +0000 @@ -1,14 +1,51 @@ #ifndef MBED_MY9221_H #define MBED_MY9221_H +/** + * MY9221 Library + * IC name : MY9221 + * maker : http://www.my-semi.com/content/products/product_mean.aspx?id=4 + * 12-Channel LED Driver With Grayscale Adaptive Pulse Density Modulation Control + * data sheet : http://akizukidenshi.com/download/ds/mysemi/MY9221_DS1_0.pdf + */ + +/** Example + * @code +* #include "mbed.h" +*#include "MY9221.h" +*MY9221 MY9221(p5, p10, 2); // di, clk, number +* +*uint16_t D_gray[12] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; +*float D_gray2[12] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}; +* +*int main() +*{ +* +* MY9221.commandSet(MY9221::fast, MY9221::bit16, MY9221::freq1, MY9221::waveApdm, MY9221::internal, MY9221::workLed, MY9221::free, MY9221::repeat); +* +* +* while(1) { +* +* for(int i=0; i < 12; i++) { +* D_gray[i] += 0x100; +* D_gray2[i] += 0.01; +* if(D_gray2[i] > 1)D_gray2[i] = 0; +* } +* MY9221.dataRawSet(D_gray, 1); +* MY9221.dataSet(D_gray2, 2); +* wait_ms(20); // Image refresh Rate [s] < led gray data update cycle [s] +* MY9221.refresh(); +* +* } +*} + * @endcode +*/ + + #include "mbed.h" #include "MY9221.h" -/** - * LED driver MY9221 - */ - /** * @class MY9221 @@ -150,7 +187,7 @@ * @param uint16_t hardware manual 16-bit COmmand Data Description CMD[15:0] = D[207:192] */ void commandRawSet(uint16_t command); - + /** command nomalization set * @param hspd_t hspd fast, slow * @param bs_t bs bit8, bit12, bit14, bit16 @@ -168,11 +205,16 @@ * @param uint8_t number MY9221 number (1 to 10) */ void dataRawSet(uint16_t *data, uint8_t number); + + /** gray data set + * @param float *data (0.0 to 1.0) [0]=OUTA[0], [1]=OUTB[0], [2]=OUTC[0], ... [9]=OUTA[3], [10]=OUTB[3], [11]=OUTC[3] + * @param uint8_t number MY9221 number (1 to 10) + */ void dataSet(float *data, uint8_t number); /** MY9221 send data and latch * - */ + */ void refresh(void); //---------------------------------------------------------- @@ -214,5 +256,4 @@ }; -//#undef _MY9221_C -#endif // MBED_PCA9547_H \ No newline at end of file +#endif // MBED_MY9221_H \ No newline at end of file