2021-04-22 17:07:38 +01:00
|
|
|
#include "breakout_rgbmatrix5x5.hpp"
|
|
|
|
|
|
|
|
namespace pimoroni {
|
|
|
|
|
2021-05-14 17:14:07 +01:00
|
|
|
bool BreakoutRGBMatrix5x5::init() {
|
|
|
|
bool success = IS31FL3731::init();
|
|
|
|
if(success) {
|
|
|
|
enable({
|
|
|
|
0b00000000, 0b10111111,
|
|
|
|
0b00111110, 0b00111110,
|
|
|
|
0b00111111, 0b10111110,
|
|
|
|
0b00000111, 0b10000110,
|
|
|
|
0b00110000, 0b00110000,
|
|
|
|
0b00111111, 0b10111110,
|
|
|
|
0b00111111, 0b10111110,
|
|
|
|
0b01111111, 0b11111110,
|
|
|
|
0b01111111, 0b00000000
|
|
|
|
}, 0);
|
|
|
|
}
|
|
|
|
return success;
|
2021-04-22 17:07:38 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
RGBLookup BreakoutRGBMatrix5x5::lookup_pixel(uint8_t index) {
|
|
|
|
return lookup_table[index];
|
|
|
|
}
|
|
|
|
|
|
|
|
void BreakoutRGBMatrix5x5::set_pixel(uint8_t x, uint8_t y, uint8_t r, uint8_t g, uint8_t b) {
|
|
|
|
if (x == 1 || x == 3) {
|
|
|
|
y = 4 - y;
|
|
|
|
}
|
|
|
|
uint8_t index = y + (x * 5);
|
|
|
|
RGBLookup rgb = lookup_pixel(index);
|
|
|
|
set(rgb.r, r);
|
|
|
|
set(rgb.g, g);
|
|
|
|
set(rgb.b, b);
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|