Move wait_begin into PicoDVI class so subclasses in other source files can access
This commit is contained in:
parent
278ff38b3c
commit
fe9e8298b5
2 changed files with 5 additions and 6 deletions
|
|
@ -24,18 +24,17 @@ static struct {
|
|||
};
|
||||
|
||||
static PicoDVI *dviptr = NULL; // For C access to active C++ object
|
||||
// Semaphore might be preferable, but this seems to work for now...
|
||||
static volatile bool wait_begin = true;
|
||||
|
||||
// Runs on core 1 on startup
|
||||
void setup1(void) {
|
||||
while (wait_begin)
|
||||
; // Wait for DVIGFX*::begin() to do its thing on core 0
|
||||
delay(1); // Required, perhaps core related
|
||||
while (dviptr == NULL); // Wait for DVIGFX*::begin() to start on core 0
|
||||
dviptr->_setup();
|
||||
}
|
||||
|
||||
// Runs on core 1 after wait_begin released
|
||||
// Runs on core 1 after dviptr set
|
||||
void PicoDVI::_setup(void) {
|
||||
while (wait_begin); // Wait for DVIGFX*::begin() to set this
|
||||
dvi_register_irqs_this_core(&dvi0, DMA_IRQ_0);
|
||||
dvi_start(&dvi0);
|
||||
(*mainloop)(&dvi0);
|
||||
|
|
@ -50,7 +49,6 @@ PicoDVI::PicoDVI(const struct dvi_timing &t, const struct dvi_serialiser_cfg &c,
|
|||
|
||||
PicoDVI::~PicoDVI(void) {
|
||||
dviptr = NULL;
|
||||
wait_begin = true;
|
||||
}
|
||||
|
||||
void PicoDVI::begin(void) {
|
||||
|
|
|
|||
|
|
@ -34,6 +34,7 @@ protected:
|
|||
vreg_voltage voltage;
|
||||
struct dvi_inst dvi0;
|
||||
void (*mainloop)(dvi_inst *) = NULL;
|
||||
volatile bool wait_begin = true;
|
||||
};
|
||||
|
||||
class DVIGFX16 : public PicoDVI, public GFXcanvas16 {
|
||||
|
|
|
|||
Loading…
Reference in a new issue