forked from adafruit/Adafruit_IS31FL3731
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Adafruit_IS31FL3731.h
50 lines (35 loc) · 1.18 KB
/
Adafruit_IS31FL3731.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
#ifndef _ADAFRUIT_IS31FL3731_H_
#define _ADAFRUIT_IS31Fl3731_H_
#include <Wire.h>
#include <Arduino.h>
#include <Adafruit_GFX.h>
#define ISSI_ADDR_DEFAULT 0x74
#define ISSI_REG_CONFIG 0x00
#define ISSI_REG_CONFIG_PICTUREMODE 0x00
#define ISSI_REG_CONFIG_AUTOPLAYMODE 0x08
#define ISSI_REG_CONFIG_AUDIOPLAYMODE 0x18
#define ISSI_CONF_PICTUREMODE 0x00
#define ISSI_CONF_AUTOFRAMEMODE 0x04
#define ISSI_CONF_AUDIOMODE 0x08
#define ISSI_REG_PICTUREFRAME 0x01
#define ISSI_REG_SHUTDOWN 0x0A
#define ISSI_REG_AUDIOSYNC 0x06
#define ISSI_COMMANDREGISTER 0xFD
#define ISSI_BANK_FUNCTIONREG 0x0B // helpfully called 'page nine'
class Adafruit_IS31FL3731 : public Adafruit_GFX {
public:
Adafruit_IS31FL3731(void);
boolean begin(uint8_t addr = ISSI_ADDR_DEFAULT);
void drawPixel(int16_t x, int16_t y, uint16_t color);
void clear(void);
void setLEDPWM(uint8_t lednum, uint8_t pwm, uint8_t bank = 0);
void audioSync(boolean sync);
void setFrame(uint8_t b);
void displayFrame(uint8_t frame);
private:
void selectBank(uint8_t bank);
void writeRegister8(uint8_t bank, uint8_t reg, uint8_t data);
uint8_t readRegister8(uint8_t bank, uint8_t reg);
uint8_t _i2caddr, _frame;
};
#endif