Skip to content

Instantly share code, notes, and snippets.

@igrr
igrr / arduino-filter.sh
Created October 28, 2015 10:50
Updates to the esp8266/arduino repository
#!/bin/bash
set -e
# get a fresh copy
git clone arduino arduino-new
cd arduino-new
git remote remove origin
# untie our commmits from master IDE branch
echo "a12c6fcea253a987e2b83aca2d9f717d0d201472" > .git/info/grafts
#include <functional>
void setup() {
Serial.begin(115200);
delay(1000);
Serial.println("");
Serial.println("start");
}
uint32_t measure_time(std::function<void(void)> fn)
#include <Arduino.h>
#include <ESP8266WiFi.h>
#include <ESP8266HTTPClient.h>
uint8_t buff[128] = { 0 };
void setup() {
WiFi.mode(WIFI_STA);
WiFi.begin("#!/bin/test", "test_bin");
Serial.begin(115200);
@igrr
igrr / mem_usage.sh
Last active June 3, 2016 16:39
Get memory usage from elf file (esp8266 toolchain, using linker script from SDK)
#!/bin/bash
# Print data, rodata, bss sizes in bytes
#
# Usage:
# OBJDUMP=../xtensa-lx106-elf/bin/xtensa-lx106-elf-objdump ./mem_usage.sh app.out [total_mem_size]
#
# If you specify total_mem_size, free heap size will also be printed
# For esp8266, total_mem_size is 81920
#
@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 / 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 $@' $<
#include <ESP8266WiFi.h>
#include <FS.h>
#include <ESP8266WebServer.h>
void startSoftAP() {
Serial.println("startSoftAP");
WiFi.mode(WIFI_AP);
WiFi.softAP("ESPAP");
ESP8266WebServer server;
@igrr
igrr / K30SensorSerial.ino
Created October 7, 2015 13:08
Sketch for K30 Sensor connected to ESP8266 over serial
#include <ESP8266WiFi.h>
const char* ssid = ".........";
const char* password = ".........";
const char* host = "api.thingspeak.com";
void setup() {
delay(1000);
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 <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);