I'm trying to replicate a C++ project I found for sampling sound data on the ESP32 using I2S, but using C# and nanoFramework.
In the ADCSampler.cpp file the following headers are loaded
#include <Arduino.h>
#include "driver/i2s.h"
#include "driver/adc.h"
nanoframework has the namespace Windows.Devices.Adc that I understand as more or less the same as driver/adc.h
.
However I cannot find anything that is the same as I2S, there is a library for I2C
The specific code I'm struggling with is:
void ADCSampler::configureI2S()
{
//init ADC pad
i2s_set_adc_mode(m_adcUnit, m_adcChannel);
// enable the adc
i2s_adc_enable(getI2SPort());
}
I have found that you can configure the ADC in nanoFramework as follow:
Configuration.SetPinFunction(35, DeviceFunction.I2S1_MDATA_IN);
and getting the ADC Channel
..
AdcChannel _adcChannel7;
..
..
_adc = AdcController.GetDefault();
_adcChannel7 = _adc.OpenChannel(7);//GPIO pin 35 is adc channel 7
..
..
_mV = _adcChannel7.ReadValue();
..
but that is about as much as I can figure out.
I'm pretty new to microcontrollers and the ESP32 platform, so still learning a lot.
Have I missed something or is this still in the works?
Are there other options that can be used instead of I2S?
You're getting close! A couple of clarifications:
So please follow our Twitter account or join the Discord community so you get notified of all that.