Skip to content

Instantly share code, notes, and snippets.

Ivan Grokhotkov igrr

View GitHub Profile
View time_until_timestamp.c
#include <stdio.h>
#include <time.h>
#include <sys/time.h>
#include <assert.h>
static time_t get_tz_offset(time_t now) {
struct tm local, utc;
localtime_r(&now, &local);
View low_speed_ledc.c
#include <stdio.h>
#include "esp_err.h"
#include "driver/ledc.h"
#include "driver/periph_ctrl.h"
void app_main()
View rtc_data_in_fast_mem.patch
diff --git a/components/esp32/ld/esp32.common.ld b/components/esp32/ld/esp32.common.ld
index 32fc089..884717c 100644
--- a/components/esp32/ld/esp32.common.ld
+++ b/components/esp32/ld/esp32.common.ld
@@ -11,12 +11,15 @@ SECTIONS
. = ALIGN(4);
*(.rtc.literal .rtc.text)
*rtc_wake_stub*.o(.literal .text .literal.* .text.*)
+ _rtc_text_end = ABSOLUTE(.);
} >rtc_iram_seg
View example_log_sdcard.txt
I (437) example: Opening file
I (457) example: File written
I (467) example: Renaming file
I (467) example: Reading file
I (467) example: Read from file: 'Hello SU04G!'
This line will be written into the log file, not to UART
igrr / ulp_isr_example_main.c
Last active Feb 19, 2019
ESP32 ULP ISR example
View ulp_isr_example_main.c
#include <stdio.h>
#include <unistd.h>
#include "soc/rtc_cntl_reg.h"
#include "esp32/ulp.h"
#include "driver/rtc_cntl.h"
#include "esp_log.h"
#include "ulp_main.h"
#include "freertos/FreeRTOS.h"
#include "freertos/semphr.h"
igrr / sleep_from_wake_stub_example.c
Created Mar 3, 2017
ESP32 ESP-IDF example illustrating how to go back to sleep from deep sleep wake stub
View sleep_from_wake_stub_example.c
* This sample illustrates how to go back to deep sleep from the
* deep sleep wake stub.
* Consider the use case of counting pulses from an external sensor,
* where the pulses arrive at a relatively slow rate.
* ESP32 is configured to go into deep sleep mode, and wake up from
* a GPIO pin connected to the external pulse source.
* Once the pulse arrives, ESP32 wakes up from deep sleep and runs
igrr / Makefile
Created Jan 25, 2017
DCMI signal generator for Lattice ICEStick
View Makefile
SRC := dcmi_source.v
CONSTRAINTS := dcmi_source.pcf
NAME := dcmi_source
TOP := DCMISource
all: $(NAME).bin
$(NAME).blif: $(SRC)
yosys -p 'synth_ice40 -top $(TOP) -blif $@' $<
igrr /
Created Nov 3, 2016
(temporary) ESP-IDF style guide
# Runs astyle with the full set of formatting options
astyle \
--style=otbs \
--indent=spaces=4 \
--convert-tabs \
--align-pointer=name \
--align-reference=name \
--keep-one-line-statements \
--pad-header \
igrr /
Last active Jan 31, 2017
These are the steps to build newlib used in ESP32 ROM and ESP-IDF
git clone &&
cd newlib-esp32 && \
./configure \
--with-newlib \
--enable-multilib \
--disable-newlib-io-c99-formats \
--disable-newlib-supplied-syscalls \
--enable-newlib-nano-formatted-io \
--enable-newlib-reent-small \
--enable-target-optspace \
igrr / SMTP_ESP8266.ino
Created Jun 23, 2016
ESP8266 Arduino SMTPClient test
View SMTP_ESP8266.ino
// Download SMTPClient library from
#include <ESP8266WiFi.h>
#include <Client.h>
#include <Mail.h>
#include <SMTPClient.h>
WiFiClient wifiClient;
SmtpClient client(&wifiClient, "");
You can’t perform that action at this time.