Skip to content

Instantly share code, notes, and snippets.

#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);
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
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 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"
@igrr
igrr / sleep_from_wake_stub_example.c
Last active November 25, 2023 21:27
ESP32 ESP-IDF example illustrating how to go back to sleep from deep sleep wake stub
/*
* 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 January 25, 2017 03:47
DCMI signal generator for Lattice ICEStick
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 November 3, 2016 15:32
(temporary) ESP-IDF style guide
#!/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 \
@igrr
igrr / newlib-esp32-configure.sh
Last active July 3, 2023 17:19
These are the steps to build newlib used in ESP32 ROM and ESP-IDF
git clone https://github.com/espressif/newlib-esp32.git &&
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
igrr / SMTP_ESP8266.ino
Created June 23, 2016 03:27
ESP8266 Arduino SMTPClient test
// Download SMTPClient library from https://github.com/gregington/SMTPClient
#include <ESP8266WiFi.h>
#include <Client.h>
#include <Mail.h>
#include <SMTPClient.h>
WiFiClient wifiClient;
SmtpClient client(&wifiClient, "smtp.163.com");
#include <ESP8266WiFi.h>
#include <FS.h>
#include <ESP8266WebServer.h>
void startSoftAP() {
Serial.println("startSoftAP");
WiFi.mode(WIFI_AP);
WiFi.softAP("ESPAP");
ESP8266WebServer server;