- ONLY Tx supported yet
- Autoselect RTM challen (0..7) for each new C# object, throws an exception, if all channels are used
- Connect to designed GPIO pin
- RTM module clock source select (wraped but not supported in IDF yet)
- Clock devider select
- Carier mode control
- Transmitter idle output level control
- Async Transmission a raw byte array containing a set of instructions for the RTM module (see rmt_item32_t)
using nanoFramework.Hardware.Esp32.RMT.Tx;
...
// Register new RTM transmitter on GPIO15
var rmt_transmitter = Transmitter.Register(GPIO: 15);
// transmitter configuration
rmt_transmitter.CarierEnabled = false;
rmt_transmitter.isSource80MHz = true;
rmt_transmitter.ClockDivider = 4; // base period 80 MHz / 4 => 20 MHz -> 0.05 us
rmt_transmitter.IsTransmitIdleEnabled = true;
rmt_transmitter.TransmitIdleLevel = false;
// create new pulse command for to transmitt
// IDLE 0.5us 1us 1.5 us 2 us 2.5 us IDLE..
// |----| |------------| |--------------------|
// -----| |--------| |----------------| |------
var commandlist = new PulseCommandList();
commandlist
.AddLevel(true, 10)
.AddLevel(false, 20)
.AddLevel(true, 30)
.AddLevel(false, 40)
.AddLevel(true, 50);
rmt_transmitter.Send(commandlist);
// destroy transmitter instance and free associated RMT channel
rmt_transmitter.Dispose();
Result on GPIO15
- Clone repository into any dirrectory
git clone https://github.com/ololoshka2871/nanoFramework.Hardware.Esp32.RMT.git
-
Setup nf-interpreter build environment. Manual.
-
Copy file Native/FindINTEROP-nanoFramework.Hardware.Esp32.RMT.cmake.template to nf-interpreter\CMake\Modules\FindINTEROP-nanoFramework.Hardware.Esp32.RMT.cmake
-
Edit file nf-interpreter/CMake/Modules/FindINTEROP-nanoFramework.Hardware.Esp32.RMT.cmake Replace
${PROJECT_SOURCE_DIR}/<PATH_TO_YOUR nanoFramework.Hardware.Esp32.RMT/Native folder>
to path of cloned repository. -
Add string
"NF_INTEROP_ASSEMBLIES" : [ "nanoFramework.Hardware.Esp32.RMT" ]
to in file cmake-variants.json in nf-interpreter folder -
Build and flash nf-interpreter into ESP32
-
Add reference to nanoFramework.Hardware.Esp32.RMT library into your C# project.
-
Build and deploy application into ESP32
-
Enjoy!
- Control WS2812 Led strips Library