Skip to content

Instantly share code, notes, and snippets.

Avatar

Tom Vijlbrief tomtor

View GitHub Profile
@tomtor
tomtor / ESP32-ULP-Blink-DHT22.ino
Last active Aug 19, 2020
ESP32: ULP LED Hart beat and read DHT22 sensor
View ESP32-ULP-Blink-DHT22.ino
@tomtor
tomtor / stm32_sleep.ino
Last active May 16, 2020
stm32 low power sleep code
View stm32_sleep.ino
#include <libmaple/pwr.h>
#include <libmaple/scb.h>
#include <RTClock.h>
// Define the Base address of the RTC registers (battery backed up CMOS Ram), so we can use them for config of touch screen or whatever.
// See http://stm32duino.com/viewtopic.php?f=15&t=132&hilit=rtc&start=40 for a more details about the RTC NVRam
// 10x 16 bit registers are available on the STM32F103CXXX more on the higher density device.
#define BKP_REG_BASE ((uint32_t *)(0x40006C00 + 0x04))
@tomtor
tomtor / STM32-OTA.ino
Last active Nov 28, 2019
STM32 OTA Example
View STM32-OTA.ino
/*******************************************************************************
Copyright (c) 2015 Thomas Telkamp and Matthijs Kooijman
(c) 2017 Tom Vijlbrief
Permission is hereby granted, free of charge, to anyone
obtaining a copy of this document and accompanying files,
to do whatever they want with them without any restriction,
including, but not limited to, copying, modification and redistribution.
NO WARRANTY OF ANY KIND IS PROVIDED.
@tomtor
tomtor / STM32-LORA.ino
Last active Oct 31, 2018
stm32duino LORA Example
View STM32-LORA.ino
/*******************************************************************************
Copyright (c) 2015 Thomas Telkamp and Matthijs Kooijman
(c) 2017 Tom Vijlbrief
Permission is hereby granted, free of charge, to anyone
obtaining a copy of this document and accompanying files,
to do whatever they want with them without any restriction,
including, but not limited to, copying, modification and redistribution.
NO WARRANTY OF ANY KIND IS PROVIDED.
@tomtor
tomtor / up2.sh
Created Aug 16, 2018
Wrapper to make upload.py more robust
View up2.sh
#!/bin/sh
while :
do
if upload.py "$@"
then
break
else
echo Retry in 60s
sleep 60
@tomtor
tomtor / clone_drive.py
Last active Aug 16, 2018
Clone fishtest LTC PGN files to Google Drive
View clone_drive.py
#!/usr/bin/env python3
import os
import sys
import subprocess
import re
import requests
import bz2
from pymongo import MongoClient, ASCENDING, DESCENDING
@tomtor
tomtor / upload.py
Last active May 18, 2018
Upload file to Google Drive
View upload.py
#!/usr/bin/python
import sys
import os
from optparse import OptionParser
from os.path import expanduser
from pydrive.auth import GoogleAuth
from pydrive.drive import GoogleDrive
@tomtor
tomtor / XOR.S
Last active Oct 13, 2017
Esp32 ULP macro function
View XOR.S
/* r0 = r0 xor r2, spills r1 */
.macro xor
/*
See https://stackoverflow.com/a/5377173
int bitwise_XOR(int a, int b)
{
return (a + b) - (a & b) - (a & b);
}
@tomtor
tomtor / ULP-stack.S
Last active Oct 11, 2017
ESP32 ULP subroutine and stack macros and multiply routine
View ULP-stack.S
/*
* Demo of Stack and subroutine macros for ESP32 ULP
*
* R3 is the SP
*/
#include "soc/rtc_cntl_reg.h"
#include "soc/rtc_io_reg.h"
#include "soc/soc_ulp.h"
View STM32-OTA-CCS811.ino
/*******************************************************************************
Copyright (c) 2015 Thomas Telkamp and Matthijs Kooijman
(c) 2017 Tom Vijlbrief
Permission is hereby granted, free of charge, to anyone
obtaining a copy of this document and accompanying files,
to do whatever they want with them without any restriction,
including, but not limited to, copying, modification and redistribution.
NO WARRANTY OF ANY KIND IS PROVIDED.