Library is installed. I've tested this basic code bellow with the same init, just to see if library is working fine. And it works. But the original code doesn't.
#define ESP8266
#include <arduino.h>
#include <i2sTXcircular.h>
void setup() {
// Initialize I2S clock generator
i2scInit(512, 16000000 / (Div1 * Div2), Div1, 0, 0);
// Buffer size: 512, Clock rate determined by Div1 and Div2, 16 MHz base clock
// Set mark and space durations directly
i2scSetMSArrayItem(0, 1, 1, 0);
// Mark bits: 4, Space bits: 4, Repeat: 0
// Begin I2S clock generation
i2scBegin();
}
void loop() {
}
Unfortunately, I'm getting too many error messages so I will try to generate frequency manually.
#define ESP8266
#include <arduino.h>
#include <i2sTXcircular.h>
void setup() {
// Initialize I2S clock generator
i2scInit(512, 16000000, -1, 0, 0); // 1MHZ
//i2scInit(512, 8000000, -1, 0, 0); // 500khz
// Set mark and space durations directly
i2scSetMSArrayItem(0, 4, 4, 0);
// Mark bits: 4, Space bits: 4, Repeat: 0
// Begin I2S clock generation
i2scBegin();
}
void loop() {
}
I've managed to generate 1mhz and 500khz using this code above. How can I use i2scInit initialiser to build a function that will generate a desired frequency ? I need a range from 10hz to 1mhz.