ok. switched displays, am now using a SDD1309-based one.
had to do a small rewrite of the SDD1306 code, but not too much difference between the two apart from the charge pump that is not available in the 1309. so it's still mostly https://github.com/giuliomoro/OSC2OLED4Bela.
i have Pd on the host sending OSC to Bela, displaying all kinds of lines and circles and text on the OLED over I2C, so all that seems to be going well.
now, the display i bought (which uses a SDD1309) has breakout pins for the usual - GND, 3v3, Clock and Data.
but it also has the reset pin broken out, which needs to be set correctly at startup or the whole thing refuses to work.
datasheet recommended startup procedure:
after 3v3 stabilizes, pull reset pin high.
after reset is pulled high, apply external 12v to power display (no charge pump included..)
right now i'm doing this manually - plug Bela in USB, touch display reset wire to ground and then connect to 3v3. then plug in 12v supply. wait for Bela to say 'connected to SDD1309 over I2C', and for initial message to appear on display.
obviously, this should be automated.
i'm thinking i can use a digital pin to toggle the reset before (or at the beginning of) display_Init_seq(); , or even before connecting the I2C. and i could use a digital pin to control the 12v line with a mosfet or something.
only thing is, i can't seem get the code right. because i don't quite know what i'm doing.
i tried copying stuff out of the digital output example.
i tried adding
int gResetPin = 5;
bool setup(BelaContext **context, void *userData)
{
pinMode(context, 0, gResetPin, OUTPUT);
return true;
}
at the top of render.cpp
and
digitalWrite(context, 0, gResetPin, 0);
usleep(1000);
digitalWrite(context, 0, gResetPin, 1);
in the render.cpp before the initialization of the display.
i get a 'use of undeclared identifier "context" ' error.
i was hoping bela would know what the context was
i tried adding everything in a separate BelaPinSetup.c file, but that didn't work either.
any help would be wildly appreciated.