struct BbdEngine* BbdEngine_Open(struct BbdEngine* p) { if (p && p->constructed && !p->open) { FUNC(); p->open = true; BbdEngine_StartWork(p); BbdBridge_BbdBridge(&p->bridge, &p->callback); BbdEngine_SetUp(p); } return p; }
struct BbdEngine* BbdEngine_Open(struct BbdEngine* p) { //SPI suspending means system going to sleep or shutdown. //We don't want to open BBD in these case. if (spi_suspending()) return NULL; if (p && p->constructed && !cmpxchg(&p->open, false, true)) { FUNC(); BbdEngine_StartWork(p); BbdBridge_BbdBridge(&p->bridge, &p->callback); BbdEngine_SetUp(p); } return p; }