upated to actual Espruino

changes in make to get compiled with actual esp-idf
switched from esp-idf specific pulse to Espruino driven (util timer)
This commit is contained in:
jumjum123 2017-07-25 16:19:29 +02:00
parent 101dff8c97
commit 1f0f4fd7b4
2 changed files with 30 additions and 3 deletions

View File

@ -38,6 +38,7 @@ LDFLAGS += -L$(ESP_IDF_PATH)/ld \
-L$(ESP_APP_TEMPLATE_PATH)/build/nghttp \
-L$(ESP_APP_TEMPLATE_PATH)/build/nvs_flash \
-L$(ESP_APP_TEMPLATE_PATH)/build/partition_table \
-L$(ESP_APP_TEMPLATE_PATH)/build/soc \
-L$(ESP_APP_TEMPLATE_PATH)/build/spi_flash \
-L$(ESP_APP_TEMPLATE_PATH)/build/tcpip_adapter \
-L$(ESP_APP_TEMPLATE_PATH)/build/vfs \
@ -65,15 +66,18 @@ INCLUDE+=\
-I$(ESP_IDF_PATH)/components/nvs_flash/include \
-I$(ESP_IDF_PATH)/components/tcpip_adapter/include \
-I$(ESP_IDF_PATH)/components/vfs/include \
-I$(ESP_IDF_PATH)/components/soc/esp32/include \
-I$(ESP_IDF_PATH)/components/soc/esp32/include/soc \
-Itargets/esp32/include
LDFLAGS+=-nostdlib -u call_user_start_cpu0 -Wl,--gc-sections -Wl,-static -Wl,-EL
LIBS+=-T esp32_out.ld \
-T$(ESP_IDF_PATH)/components/esp32/ld/esp32.common.ld \
-T$(ESP_IDF_PATH)/components/esp32/ld/esp32.rom.ld \
-T$(ESP_IDF_PATH)/components/esp32/ld/esp32.peripherals.ld \
$(ESP_IDF_PATH)/components/esp32/lib/librtc_clk.a \
$(ESP_IDF_PATH)/components/esp32/lib/librtc.a \
$(ESP_IDF_PATH)/components/newlib/lib/libc.a \
$(ESP_IDF_PATH)/components/newlib/lib/libm.a \
$(ESP_IDF_PATH)/components/esp32/lib/libphy.a \
-lbt \
-lbtdm_app \
-ldriver \
@ -94,6 +98,7 @@ $(ESP_IDF_PATH)/components/esp32/libhal.a \
-lmbedtls \
-lnghttp \
-lnvs_flash \
-lsoc \
-lspi_flash \
-ltcpip_adapter \
-lvfs \

View File

@ -386,8 +386,30 @@ void jshPinPulse(
bool pulsePolarity, //!< The value to be pulsed into the pin.
JsVarFloat pulseTime //!< The duration in milliseconds to hold the pin.
) {
int duration = (int)pulseTime * 1000; //from millisecs to microsecs
sendPulse(pin, pulsePolarity, duration);
// ESP32 specific version, replaced by Espruino Style version from nrf52
//int duration = (int)pulseTime * 1000; //from millisecs to microsecs
//sendPulse(pin, pulsePolarity, duration);
// ---- USE TIMER FOR PULSE
if (!jshIsPinValid(pin)) {
jsExceptionHere(JSET_ERROR, "Invalid pin!");
return;
}
if (pulseTime<=0) {
// just wait for everything to complete
jstUtilTimerWaitEmpty();
return;
} else {
// find out if we already had a timer scheduled
UtilTimerTask task;
if (!jstGetLastPinTimerTask(pin, &task)) {
// no timer - just start the pulse now!
jshPinOutput(pin, pulsePolarity);
task.time = jshGetSystemTime();
}
// Now set the end of the pulse to happen on a timer
jstPinOutputAtTime(task.time + jshGetTimeFromMilliseconds(pulseTime), &pin, 1, !pulsePolarity);
}
}