mirror of
https://github.com/espruino/Espruino.git
synced 2025-12-08 19:06:15 +00:00
Set pin to be GPIO (not rmt or something else) before value is set in jshardware.c (jshPinSetValue)
Set pin to be rmt (not GPIO or something else) before rmt pulse is written in jshardarePulse.c (sendPulse)
This commit is contained in:
parent
1538bed9f6
commit
1f197e61b5
@ -48,6 +48,7 @@
|
||||
#include "rom/ets_sys.h"
|
||||
#include "rom/uart.h"
|
||||
#include "driver/gpio.h"
|
||||
#include "soc/gpio_sig_map.h"
|
||||
|
||||
#include "jshardwareI2c.h"
|
||||
#include "jshardwareSpi.h"
|
||||
@ -290,6 +291,7 @@ void jshPinSetValue(
|
||||
bool value //!< The new value of the pin.
|
||||
) {
|
||||
gpio_num_t gpioNum = pinToESP32Pin(pin);
|
||||
gpio_matrix_out(gpioNum,SIG_GPIO_OUT_IDX,0,0); // reset pin to be GPIO in case it was used as rmt or something else
|
||||
gpio_set_level(gpioNum, (uint32_t)value);
|
||||
}
|
||||
|
||||
|
||||
@ -96,6 +96,7 @@ void sendPulse(Pin pin, bool pulsePolarity, int duration){
|
||||
if(i < 0) i = RMTInitChannel(pin,pulsePolarity);
|
||||
if(i >= 0){
|
||||
if(pulsePolarity) setPulseLow(duration);else setPulseHigh(duration);
|
||||
rmt_set_pin(i, RMT_MODE_TX, pin); //set pin to rmt, in case that it was reset to GPIO(see jshPinSetValue)
|
||||
rmt_write_items(i, items,1,1);
|
||||
}
|
||||
else printf("all RMT channels in use\n");
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user