11namespace arduino_vs1053 {
22 virtual void beginTransaction() = 0;
23 virtual void endTransaction() = 0;
24 virtual void set_speed(uint32_t speed)= 0;
26 virtual void write(uint8_t data) = 0;
27 virtual void write16(uint16_t data)= 0;
28 virtual void write_bytes(uint8_t * data, uint32_t size) = 0;
29 virtual uint8_t transfer(uint8_t data) = 0;
30 virtual uint16_t read16(uint16_t port) = 0;
34#if defined(ARDUINO_ARCH_ESP32) || defined(ARDUINO_ARCH_ESP8266)
42 uint32_t speed = 200000;
48 void beginTransaction()
override {
49 SPISettings settings(speed, MSBFIRST, SPI_MODE0);
50 p_spi->beginTransaction(settings);
52 void endTransaction()
override{p_spi->endTransaction();}
53 void set_speed(uint32_t value){ this->speed = value;}
55 void write(uint8_t data)
override{
59 uint8_t transfer(uint8_t data)
override{
60 return p_spi->transfer(data);
63 void write16(uint16_t data)
override{
67 void write_bytes(uint8_t * data, uint32_t size)
override{
68 p_spi->writeBytes(data, size);
71 uint16_t read16(uint16_t port)
override {
72 return p_spi->transfer16(port);
89 uint32_t speed = 200000;
102 void beginTransaction()
override{
103 SPISettings settings(speed, MSBFIRST, SPI_MODE0);
104 p_spi->beginTransaction(settings);
106 void endTransaction()
override {p_spi->endTransaction();}
107 void set_speed(uint32_t value){ this->speed = value;}
109 void write(uint8_t data)
override {
110 (void)p_spi->transfer(data);
113 uint8_t transfer(uint8_t data)
override{
114 return p_spi->transfer(data);
117 void write16(uint16_t data)
override{
118 (void)p_spi->transfer16(data);
121 uint16_t read16(uint16_t port)
override {
122 return p_spi->transfer16(port);
125 void write_bytes(uint8_t * data, uint32_t size)
override {
126#if defined(ARDUINO_ARCH_ESP32) || defined(ARDUINO_ARCH_ESP8266)
127 p_spi->writeBytes(data, size);
129 p_spi->transfer(data, size);
Generic SPI Driver for Arduino.
Definition: VS1053SPI.h:87
VS1053_SPIArduino(SPIClass &spi)
Using the indicated SPI object.
Definition: VS1053SPI.h:98
VS1053_SPIArduino()
Using SPI by default.
Definition: VS1053SPI.h:93
Arduino Driver for ESP32 and ESP8266.
Definition: VS1053SPI.h:40
Abstract SPI Driver for VS1053. We support different alternative implementations. Outside of Arduino ...
Definition: VS1053SPI.h:20