12-Channel LED Driver With Gray scale Adaptive Pulse Density Modulation Control IC maker MY-Semi

Dependencies:   MY9221 mbed

main.cpp

Committer:
suupen
Date:
2017-10-22
Revision:
1:caa6335a5b06
Parent:
0:104d4c4514b8
Child:
2:b59a2fe78451

File content as of revision 1:caa6335a5b06:

/**
 * @section DESCRIPTION
 * maker http://www.my-semi.com/content/products/product_mean.aspx?id=9
 * shop  http://akizukidenshi.com/catalog/g/gI-09678/
 */

/*
MY9366
http://www.my-semi.com/content/products/product_mean.aspx?id=28
*/
#define LIBMY9221

#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};

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] += 0x1;
            D_gray2[i] += 0.001;
            if(D_gray2[i] > 1)D_gray2[i] = 0;
        }
        MY9221.dataRawSet(D_gray, 1);
        MY9221.dataSet(D_gray2, 2);
        wait_ms(20);
        MY9221.refresh();

    }
}