![](/media/cache/profiles/90a82bf94b4c5981e7e68ff425e519f3.50x50_q85.jpg)
12-Channel LED Driver With Gray scale Adaptive Pulse Density Modulation Control IC maker MY-Semi
main.cpp@3:7df2f4cd2f04, 2017-10-22 (annotated)
- Committer:
- suupen
- Date:
- Sun Oct 22 23:20:45 2017 +0000
- Revision:
- 3:7df2f4cd2f04
- Parent:
- 2:b59a2fe78451
complete;
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
suupen | 0:104d4c4514b8 | 1 | /** |
suupen | 0:104d4c4514b8 | 2 | * @section DESCRIPTION |
suupen | 0:104d4c4514b8 | 3 | * maker http://www.my-semi.com/content/products/product_mean.aspx?id=9 |
suupen | 0:104d4c4514b8 | 4 | * shop http://akizukidenshi.com/catalog/g/gI-09678/ |
suupen | 2:b59a2fe78451 | 5 | * |
suupen | 2:b59a2fe78451 | 6 | * sample program schematic |
suupen | 2:b59a2fe78451 | 7 | * |
suupen | 2:b59a2fe78451 | 8 | * VOUT(3.3V) VOUT VOUT |
suupen | 2:b59a2fe78451 | 9 | * | |VDD |VDD |
suupen | 2:b59a2fe78451 | 10 | * -------------- ------------- --------------- |
suupen | 2:b59a2fe78451 | 11 | * mbed(LPC1768)| |MY9221(2) | |MY9221(1) | |
suupen | 2:b59a2fe78451 | 12 | * p5 |------------|DI DO | ---------- |DI | |
suupen | 2:b59a2fe78451 | 13 | * p10|------------|DCKI DCKO| ---------- |DCKI | |
suupen | 2:b59a2fe78451 | 14 | * | | | | | |
suupen | 2:b59a2fe78451 | 15 | * | 22kOhme --|REXT-C | 22kOhme --|REXT-C | |
suupen | 2:b59a2fe78451 | 16 | * | 22kOhme --|REXT-B | 22kOhme --|REXT-B | |
suupen | 2:b59a2fe78451 | 17 | * | 22kOhme --|REXT-A | 22kOhme --|REXT-A | |
suupen | 2:b59a2fe78451 | 18 | * ------------- ------------- -------------- |
suupen | 2:b59a2fe78451 | 19 | * |.........| |...........| |
suupen | 2:b59a2fe78451 | 20 | * LED1 LED12 LED1 LED12 |
suupen | 0:104d4c4514b8 | 21 | */ |
suupen | 0:104d4c4514b8 | 22 | |
suupen | 0:104d4c4514b8 | 23 | /* |
suupen | 0:104d4c4514b8 | 24 | MY9366 |
suupen | 0:104d4c4514b8 | 25 | http://www.my-semi.com/content/products/product_mean.aspx?id=28 |
suupen | 0:104d4c4514b8 | 26 | */ |
suupen | 0:104d4c4514b8 | 27 | |
suupen | 0:104d4c4514b8 | 28 | #include "mbed.h" |
suupen | 0:104d4c4514b8 | 29 | #include "MY9221.h" |
suupen | 1:caa6335a5b06 | 30 | MY9221 MY9221(p5, p10, 2); // di, clk, number |
suupen | 0:104d4c4514b8 | 31 | |
suupen | 1:caa6335a5b06 | 32 | uint16_t D_gray[12] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; |
suupen | 2:b59a2fe78451 | 33 | 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}; |
suupen | 0:104d4c4514b8 | 34 | |
suupen | 0:104d4c4514b8 | 35 | int main() |
suupen | 0:104d4c4514b8 | 36 | { |
suupen | 0:104d4c4514b8 | 37 | |
suupen | 1:caa6335a5b06 | 38 | MY9221.commandSet(MY9221::fast, MY9221::bit16, MY9221::freq1, MY9221::waveApdm, MY9221::internal, MY9221::workLed, MY9221::free, MY9221::repeat); |
suupen | 0:104d4c4514b8 | 39 | |
suupen | 0:104d4c4514b8 | 40 | |
suupen | 0:104d4c4514b8 | 41 | while(1) { |
suupen | 0:104d4c4514b8 | 42 | |
suupen | 1:caa6335a5b06 | 43 | for(int i=0; i < 12; i++) { |
suupen | 2:b59a2fe78451 | 44 | D_gray[i] += 0x100; |
suupen | 2:b59a2fe78451 | 45 | D_gray2[i] += 0.01; |
suupen | 1:caa6335a5b06 | 46 | if(D_gray2[i] > 1)D_gray2[i] = 0; |
suupen | 1:caa6335a5b06 | 47 | } |
suupen | 1:caa6335a5b06 | 48 | MY9221.dataRawSet(D_gray, 1); |
suupen | 1:caa6335a5b06 | 49 | MY9221.dataSet(D_gray2, 2); |
suupen | 2:b59a2fe78451 | 50 | wait_ms(20); // Image refresh Rate [s] < led gray data update cycle [s] |
suupen | 1:caa6335a5b06 | 51 | MY9221.refresh(); |
suupen | 0:104d4c4514b8 | 52 | |
suupen | 0:104d4c4514b8 | 53 | } |
suupen | 0:104d4c4514b8 | 54 | } |