void Adafruit_VS1053::dumpRegs(void) { Serial.print("Mode = 0x"); Serial.println(sciRead(VS1053_REG_MODE), HEX); Serial.print("Stat = 0x"); Serial.println(sciRead(VS1053_REG_STATUS), HEX); Serial.print("ClkF = 0x"); Serial.println(sciRead(VS1053_REG_CLOCKF), HEX); Serial.print("Vol. = 0x"); Serial.println(sciRead(VS1053_REG_VOLUME), HEX); }
boolean Adafruit_VS1053::GPIO_digitalRead(uint8_t i) { if (i > 7) return 0; sciWrite(VS1053_REG_WRAMADDR, VS1053_GPIO_IDATA); uint16_t val = sciRead(VS1053_REG_WRAM); if (val & _BV(i)) return true; return false; }
void Adafruit_VS1053::GPIO_digitalWrite(uint8_t i, uint8_t val) { if (i > 7) return; sciWrite(VS1053_REG_WRAMADDR, VS1053_GPIO_ODATA); uint16_t pins = sciRead(VS1053_REG_WRAM); if (val == LOW) pins &= ~_BV(i); if (val == HIGH) pins |= _BV(i); sciWrite(VS1053_REG_WRAMADDR, VS1053_GPIO_ODATA); sciWrite(VS1053_REG_WRAM, pins); }
void Adafruit_VS1053::GPIO_pinMode(uint8_t i, uint8_t dir) { if (i > 7) return; sciWrite(VS1053_REG_WRAMADDR, VS1053_GPIO_DDR); uint16_t ddr = sciRead(VS1053_REG_WRAM); if (dir == INPUT) ddr &= ~_BV(i); if (dir == OUTPUT) ddr |= _BV(i); sciWrite(VS1053_REG_WRAMADDR, VS1053_GPIO_DDR); sciWrite(VS1053_REG_WRAM, ddr); }
void Adafruit_VS1053::sineTest(uint8_t n, uint16_t ms) { reset(); uint16_t mode = sciRead(VS1053_REG_MODE); mode |= 0x0020; sciWrite(VS1053_REG_MODE, mode); while (!digitalRead(_dreq)); // delay(10); #ifdef SPI_HAS_TRANSACTION if (useHardwareSPI) SPI.beginTransaction(VS1053_DATA_SPI_SETTING); #endif digitalWrite(_dcs, LOW); spiWrite(0x53); spiWrite(0xEF); spiWrite(0x6E); spiWrite(n); spiWrite(0x00); spiWrite(0x00); spiWrite(0x00); spiWrite(0x00); digitalWrite(_dcs, HIGH); #ifdef SPI_HAS_TRANSACTION if (useHardwareSPI) SPI.endTransaction(); #endif delay(ms); #ifdef SPI_HAS_TRANSACTION if (useHardwareSPI) SPI.beginTransaction(VS1053_DATA_SPI_SETTING); #endif digitalWrite(_dcs, LOW); spiWrite(0x45); spiWrite(0x78); spiWrite(0x69); spiWrite(0x74); spiWrite(0x00); spiWrite(0x00); spiWrite(0x00); spiWrite(0x00); digitalWrite(_dcs, HIGH); #ifdef SPI_HAS_TRANSACTION if (useHardwareSPI) SPI.endTransaction(); #endif }
uint16_t Adafruit_VS1053::GPIO_digitalRead(void) { sciWrite(VS1053_REG_WRAMADDR, VS1053_GPIO_IDATA); return sciRead(VS1053_REG_WRAM) & 0xFF; }
uint16_t Adafruit_VS1053::recordedReadWord(void) { return sciRead(VS1053_REG_HDAT0); }
uint16_t Adafruit_VS1053::recordedWordsWaiting(void) { return sciRead(VS1053_REG_HDAT1); }
uint16_t Adafruit_VS1053::decodeTime() { noInterrupts(); //cli(); uint16_t t = sciRead(VS1053_REG_DECODETIME); interrupts(); //sei(); return t; }