Here is an example of manually choosing what to render for each plane (adapted from your earlier comment):
#define ABG_IMPLEMENTATION
#include "ArduboyG.h"
ArduboyG_Config<ABG_Mode::L4_Triplane> a;
const uint8_t PROGMEM IMG1[] = {
0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80,
};
const uint8_t PROGMEM IMG2[] = {
0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80,
};
const uint8_t PROGMEM IMG3[] = {
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f,
};
void setup() {
a.begin();
a.startGray();
}
void loop() {
if (!a.nextFrame()) return;
uint8_t plane = a.currentPlane();
if(plane == 0) a.drawBitmap(22, 2, IMG1, 16, 12, WHITE);
if(plane == 1) a.drawBitmap(22, 2, IMG2, 16, 12, WHITE);
if(plane == 2) a.drawBitmap(22, 2, IMG3, 16, 12, WHITE);
}
There is also the short example on Github that demonstrates using the overridden Arduboy2Base
drawing methods.
These methods call the base class methods internally, but adjust the color (to WHITE
or BLACK
) according to the current plane, the requested gray shade, and the configured mode. For example, in mode L3
, if you were to call
a.fillRect(x, y, w, h, GRAY);
this method internally calls
Arduboy2Base::fillRect(x, y, w, h, WHITE);
if the current plane is 0, or
Arduboy2Base::fillRect(x, y, w, h, BLACK);
if the current plane is 1. The plane-color mapping is
Plane 0 1 2
===========================================
ABG_Mode::L4_Contrast BLACK . .
ABG_Mode::L4_Contrast DARK_GRAY X .
ABG_Mode::L4_Contrast LIGHT_GRAY . X
ABG_Mode::L4_Contrast WHITE X X
ABG_Mode::L4_Triplane BLACK . . .
ABG_Mode::L4_Triplane DARK_GRAY X . .
ABG_Mode::L4_Triplane LIGHT_GRAY X X .
ABG_Mode::L4_Triplane WHITE X X X
ABG_Mode::L3 BLACK . .
ABG_Mode::L3 GRAY X .
ABG_Mode::L3 WHITE X X
where ‘X’ means white and ‘.’ means black.
EDIT:
I think ArduboyG could be made configurable to use timer 4. ATMlib uses timer 4 so it’d be good to have the library support either.
EDIT 2: Updated. The library now supports using either timer 3 or timer 4. Define one of:
-
ABG_TIMER3
(default if none defined)
ABG_TIMER4
before including ArduboyG.h
. There is also an additional sync option: AGB_SYNC_SLOW_DRIVE
which is the method of slowing down the row drive time and disabling the charge pump for the park row by @dxb. It enables full speed refresh while retaining use of all 64 rows, at the expense of the occasional slight glitch at the park row.