kopia lustrzana https://github.com/pimoroni/pimoroni-pico
SSD1680: Add support for variable update speed.
rodzic
dfe9c4dce8
commit
ae4bc4a1e1
|
@ -49,37 +49,48 @@ namespace pimoroni {
|
|||
busy_wait();
|
||||
}
|
||||
|
||||
void SSD1680::default_luts() {
|
||||
bool SSD1680::set_update_speed(int update_speed) {
|
||||
// 0 == slow (lut_repeat_count of 3), 3 == fast (lut_repeat_count of 0)
|
||||
this->lut_repeat_count = (uint8_t)3 - (uint8_t)(update_speed & 3);
|
||||
write_luts();
|
||||
return true;
|
||||
}
|
||||
|
||||
void SSD1680::write_luts() {
|
||||
|
||||
command(WLR, {
|
||||
// Group:
|
||||
// 0 1 2 3 4 5 6 7 8 9 10 11
|
||||
0x40, 0x68, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // VS L0
|
||||
0xA0, 0x65, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // VS L1
|
||||
0xA8, 0x65, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // VS L2
|
||||
0xAA, 0x65, 0x50, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // VS L3
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // VS L4
|
||||
0x40, 0x68, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // VS L0
|
||||
0xA0, 0x65, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // VS L1
|
||||
0xA8, 0x65, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // VS L2
|
||||
0xAA, 0x65, 0x50, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // VS L3
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // VS L4
|
||||
});
|
||||
// Phase:
|
||||
// L0 L1 L2 L3 L4 SR? RP
|
||||
0x02, 0x00, 0x00, 0x05, 0x0A, 0x00, 0x01, // Group0
|
||||
0x19, 0x19, 0x00, 0x02, 0x00, 0x00, 0x01, // Group1
|
||||
0x05, 0x0A, 0x00, 0x00, 0x00, 0x00, 0x01, // Group2
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Group3
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Group4
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Group5
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Group6
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Group7
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Group8
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Group9
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Group10
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Group11
|
||||
// L0 L1 L2 L3 L4 SR? Repeat
|
||||
data({0x02, 0x00, 0x00, 0x05, 0x0A, 0x00}); data(1, &this->lut_repeat_count); // Group0
|
||||
data({0x19, 0x19, 0x00, 0x02, 0x00, 0x00}); data(1, &this->lut_repeat_count); // Group1
|
||||
data({0x05, 0x0A, 0x00, 0x00, 0x00, 0x00}); data(1, &this->lut_repeat_count); // Group2
|
||||
|
||||
// Remaining unused LUTs and config values
|
||||
data({
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Group3
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Group4
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Group5
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Group6
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Group7
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Group8
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Group9
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Group10
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Group11
|
||||
// Config:
|
||||
0x44, 0x42, 0x22, 0x22, 0x23, 0x32, 0x00, 0x00, 0x00 // FR, XON
|
||||
0x44, 0x42, 0x22, 0x22, 0x23, 0x32, 0x00, 0x00, 0x00 // FR, XON
|
||||
});
|
||||
|
||||
command(EOPT, {0x22});
|
||||
command(GDVC, {0x17});
|
||||
command(SDVC, {0x41, 0xAE, 0x32});
|
||||
command(SDVC, {0x41, 0xAE, 0x32});
|
||||
command(WVCOM, {0x28});
|
||||
|
||||
busy_wait();
|
||||
|
@ -113,7 +124,7 @@ namespace pimoroni {
|
|||
|
||||
setup();
|
||||
|
||||
default_luts();
|
||||
write_luts();
|
||||
|
||||
};
|
||||
|
||||
|
@ -208,6 +219,10 @@ namespace pimoroni {
|
|||
gpio_put(CS, 1);
|
||||
}
|
||||
|
||||
void SSD1680::data(std::initializer_list<uint8_t> values) {
|
||||
data(values.size(), (uint8_t *)values.begin());
|
||||
}
|
||||
|
||||
void SSD1680::command(uint8_t reg, std::initializer_list<uint8_t> values) {
|
||||
command(reg, values.size(), (uint8_t *)values.begin());
|
||||
}
|
||||
|
|
|
@ -36,6 +36,7 @@ namespace pimoroni {
|
|||
uint BUSY = 9;
|
||||
uint RESET = 21;
|
||||
|
||||
uint8_t lut_repeat_count = 1; // Default to 1 for a ghost-free but slightly slower refresh
|
||||
bool inverted = true; // Makes 0 black and 1 white, as is foretold.
|
||||
bool blocking = true;
|
||||
|
||||
|
@ -61,9 +62,10 @@ namespace pimoroni {
|
|||
void power_off() override;
|
||||
void update(PicoGraphics *graphics) override;
|
||||
void partial_update(PicoGraphics *graphics, Rect region) override;
|
||||
bool set_update_speed(int update_speed) override;
|
||||
|
||||
// SSD1680 Specific
|
||||
void default_luts();
|
||||
void write_luts();
|
||||
|
||||
private:
|
||||
void init();
|
||||
|
@ -74,6 +76,7 @@ namespace pimoroni {
|
|||
void command(uint8_t reg, std::initializer_list<uint8_t> values);
|
||||
void command(uint8_t reg) {command(reg, 0, nullptr);};
|
||||
void data(size_t len, const uint8_t *data);
|
||||
void data(std::initializer_list<uint8_t> values);
|
||||
|
||||
void update(bool blocking = true);
|
||||
void partial_update(int x, int y, int w, int h, bool blocking = true);
|
||||
|
|
Ładowanie…
Reference in New Issue