Skip to content

Instantly share code, notes, and snippets.

Avatar

Ivan Grokhotkov igrr

View GitHub Profile
View test_io.c
#include <stdio.h>
#include <unistd.h>
#include "driver/adc.h"
#include "driver/gpio.h"
#include "driver/rtc_io.h"
#include "soc/cpu.h"
const char* names[] = {"D2", "D3", "CLK", "CMD", "D0", "D1"};
const int pins[] = {12, 13, 14, 15, 2, 4};
const int adc_channels[] = {5, 4, 6, 3, 2, 0};
@igrr
igrr / esp32s2beta_dedicated_gpio_example_main.c
Created Jan 13, 2020
ESP32-S2 (beta) dedicated GPIO example
View esp32s2beta_dedicated_gpio_example_main.c
/* ESP32-S2 (beta) "dedicated GPIO" peripheral example */
#include <stdio.h>
#include "sdkconfig.h"
#include "soc/system_reg.h"
#include "esp32s2beta/rom/gpio.h"
#include "soc/gpio_sig_map.h"
#include "driver/gpio.h"
/* The header file is not yet in IDF; however this is the only register we need. */
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()
{
periph_module_enable(PERIPH_LEDC_MODULE);
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
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
igrr / sleep_from_wake_stub_example.c
Last active Aug 28, 2020
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
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
igrr / format.sh
Created Nov 3, 2016
(temporary) ESP-IDF style guide
View format.sh
#!/bin/bash
# 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 \
You can’t perform that action at this time.