void oledInit (oledConfig *oledConfig,  struct SerialDriver *oled, const uint32_t baud,
	       GPIO_TypeDef *rstGpio, uint32_t rstPin, enum OledConfig_Device dev)
{
  oledConfig->rstGpio = rstGpio;
  oledConfig->rstPin = rstPin;
  oledConfig->deviceType = dev;

  oledHardReset (oledConfig);


  oledPreInit (oledConfig, 9600);
  oledConfig->serial = (BaseSequentialStream *) oled;
  chMtxInit(&(oledConfig->omutex));
  sdStart(oled, &(oledConfig->serialConfig));
  chThdSleepMilliseconds(10);

  // opaque background
  if (oledConfig->deviceType != TERM_VT100) {
    OLED_KOF (KOF_INT16, "%c%c%c%c", 0xff, 0xdf, 0x00, 0x01); 
  }

  oledClearScreen (oledConfig);
  
  // use greater speed
  if (baud != 9600) 
    oledSetBaud (oledConfig, baud);
}
Esempio n. 2
0
void startGame(void) {
    oledClearScreen(1);
    if (game_running == 0) {
        gameInitBuffer();
        snake_init();
    }
}
static void oledReInit (oledConfig *oledConfig)
{
  RET_UNLESS_PICASO(oledConfig);
  oledHardReset (oledConfig);
  const uint32_t baud = oledConfig->serialConfig.speed;

  oledSetBaud (oledConfig, 9600);

  // opaque background
  OLED_KOF (KOF_INT16, "%c%c%c%c", 0xff, 0xdf, 0x00, 0x01); 
  oledClearScreen (oledConfig);

  
  // use greater speed
  if (baud != 9600) 
    oledSetBaud (oledConfig, baud);
}