12-Channel LED Driver With Gray scale Adaptive Pulse Density Modulation Control IC Library. maker MY-Semi
MY9221.h
- Committer:
- suupen
- Date:
- 2017-10-22
- Revision:
- 1:60440eb16f81
- Parent:
- 0:3a18655ada14
- Child:
- 2:4d9aee0bd724
File content as of revision 1:60440eb16f81:
#ifndef MBED_MY9221_H #define MBED_MY9221_H #include "mbed.h" #include "MY9221.h" /** * LED driver MY9221 */ /** * @class MY9221 * @brief nothine */ class MY9221 { public: /** Create a MY9221 port, connected to the specified IC pins * @param DI pin * @param DCKI pin * @param IC serial connection number :min = 1(default) * @note nothing */ MY9221(PinName di, PinName dcki, uint8_t number); //========================= // command data description //========================= // 0x0000にクリアした上で、下記の定義をorしていく // CMD[10] 0000 0x00 0000 0000 lout Tr/Tf select #define LOUT_SLOW_MODE (0x0000) #define LOUT_FAST_MODE (0x0400) // CMD[9:8] 0000 00xx 0000 0000 Gryascale resolution select #define GRAYSCALE_8BIT (0x0000) #define GRAYSCALE_12BIT (0x0100) #define GRAYSCALE_14BIT (0x0200) #define GRAYSCALE_16BIT (0x0300) // CMD[7:5] 0000 0000 xxx0 0000 Internal oscillator freq select #define ORIGINAL_FREQ1 (0x0000) #define ORIGINAL_FREQ2 (0x0020) #define ORIGINAL_FREQ4 (0x0040) #define ORIGINAL_FREQ8 (0x0060) #define ORIGINAL_FREQ16 (0x0080) #define ORIGINAL_FREQ64 (0x00a0) #define ORIGINAL_FREQ128 (0x00c0) #define ORIGINAL_FREQ256 (0x00e0) // CMD[4] 0000 0000 000x 0000 Output waveform select #define WAVE_MYPWM (0x0000) // Only Grayscale = 8bit #define WAVE_APDM (0x0010) // CMD[3] 0000 0000 0000 x000 Grayscale clock source select #define GCLOCK_INTERNAL (0x0000) #define GCLOCK_EXTERNAL (0x0008) // CMD[2] 0000 0000 0000 0x00 Output polarity select #define WORK_LED (0x0000) #define WORK_MYPWM (0x0004) // CMD[1] 0000 0000 0000 00x0 Counter reset select #define COUNTER_FREE (0x0000) #define COUNTER_RESET (0x0002) // CMD[0] 0000 0000 0000 000x One-shot select #define SHOT_REPEAT (0x0000) #define SHOT_SHOT (0x0001) // commandData_t D[]の配列番号 // MY9221のOUTxの番号と配列番号をあわせるための定義 #define OUT3 (0) #define OUT2 (1) #define OUT1 (2) #define OUT0 (3) //========================= // MY9221 command data 定義 //========================= typedef struct { uint16_t DA; uint16_t DB; uint16_t DC; } dataSet_t; typedef struct { uint16_t CMD; dataSet_t D[4]; // [0]:OUT3 [1]:OUT2 [2]:OUT1 [3]:OUT0 } commandData_t; void initialTest(void); void test(void); //---------------------------------------------------------- private: /** send one word data * @param uint16_t data : send data * @param return none */ void sendWord(uint16_t data); /** data latch & display * @param none * @param return none */ void latch(void); /** send brock data * @param commandData_t *data : MY9221 Data * @param uint8_t number : connection number (min=1) * @param none */ void sendBrock(commandData_t *data, uint8_t number); DigitalOut _di; DigitalOut _dcki; int8_t _number; commandData_t MY9221_data[10];//_number]; }; #undef _MY9221_C #endif // MBED_PCA9547_H