コード例 #1
0
boolean Adafruit_IS31FL3731::begin(uint8_t addr) {
  Wire.begin();

  _i2caddr = addr;
  _frame = 0;

  // shutdown
  writeRegister8(ISSI_BANK_FUNCTIONREG, ISSI_REG_SHUTDOWN, 0x00);

  delay(10);

  // out of shutdown
  writeRegister8(ISSI_BANK_FUNCTIONREG, ISSI_REG_SHUTDOWN, 0x01);

  // picture mode
  writeRegister8(ISSI_BANK_FUNCTIONREG, ISSI_REG_CONFIG, ISSI_REG_CONFIG_PICTUREMODE);

  displayFrame(_frame);

  // all LEDs on & 0 PWM
  clear(); // set each led to 0 PWM

  for (uint8_t f=0; f<8; f++) {  
    for (uint8_t i=0; i<=0x11; i++)
      writeRegister8(f, i, 0xff);     // each 8 LEDs on
  }

  audioSync(false);

  return true;
}
コード例 #2
0
ファイル: truetalk.c プロジェクト: wdebeaum/cabot
void
truetalkSend(char *buf, KQMLPerformative *perf)
{
    unsigned long marker;

    DEBUG1("sending \"%s\"", buf);
    /* Save this performative for use by callbacks */
    currentPerf = perf;
    /* We haven't said anything yet... */
    startedSpeaking = 0;
    /* Temporary for transcripting (send now so it appears with speech) */
    sendSpokenMsg(buf);
    /* Send the line to TrueTalk (will callback ttCB() with output) */
    marker = TT_SendText(myclient, buf, strlen(buf));
    if (!marker) {
	ERROR1("TT_SendText failed: %s\n", TT_DecodeLastError());
    }
    /* Let server finish with this text before sending new stuff */
    DEBUG0("waiting for TrueTalk to finish");
    if (!TT_Sync(myclient, marker)) {
	ERROR1("TT_Sync failed: %s\n", TT_DecodeLastError());
    }
    /* Sync with server */
    DEBUG0("syncing server");
    audioSync();
    /* We're done speaking */
    sendStoppedSpeakingMsg();
    /* Send done reply */
    if (perf != NULL) {
	DEBUG0("replying");
	sendDoneReply(perf);
    }
    /* Done */
    DEBUG0("done");
}