Skip to content

Instantly share code, notes, and snippets.

@igrr
igrr / ulp_isr_example_main.c
Last active January 26, 2024 09:47
ESP32 ULP ISR example
#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"
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
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
#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);
#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);
@igrr
igrr / esp32s2beta_dedicated_gpio_example_main.c
Created January 13, 2020 05:06
ESP32-S2 (beta) dedicated GPIO example
/* 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. */
#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 / idos.py
Last active July 13, 2021 19:25 — forked from grafuls/idos.py
python script for getting time left for next bus with idos(Brno)
from bs4 import BeautifulSoup as bs
from dateutil import parser
from datetime import datetime
import requests
import re
# search for all buses leaving from one station in any direction
URL = 'http://jizdnirady.idnes.cz/brno/odjezdy/?f=cervinkova&fc=302003&lng=E&submit=true'
@igrr
igrr / esp.ksy
Created November 25, 2021 20:19
Kaitai Struct description of ESP binary image format (starting from ESP32)
# Try it out by opening https://ide.kaitai.io/ and copying this file there
# Based on an article by @angelcarve about ESP8266 binary image parsing with Kaitai Struct:
# https://carvesystems.com/news/parsing-binaries-with-kaitai-struct/
meta:
id: esp
file-extension: bin
endian: le
seq:
@igrr
igrr / tlc5947.py
Created December 2, 2021 21:03
MicroPython module for the TLC5947 (untested)
# SPDX-FileCopyrightText: 2017 Tony DiCola for Adafruit Industries
#
# SPDX-License-Identifier: MIT
#
# MicroPython module for the TLC5947 12-bit 24 channel LED PWM driver.
# Based on CircuitPython version of the same by Tony DiCola, Walter Haschka.
#
from machine import Pin, SPI