Skip to content

Instantly share code, notes, and snippets.

View pfeerick's full-sized avatar

Peter Feerick pfeerick

  • Australia
  • 02:26 (UTC +10:00)
View GitHub Profile
@pfeerick
pfeerick / flash_SYSLED.sh
Last active April 15, 2021 04:59
Flash the SYSLED of the pine64/clusterboard
#!/bin/bash
function openGPIO
{
#test if GPIO sysfs entry exists, create if necessary
if [ ! -e "/sys/class/gpio/gpio359" ]; then
# echo "DEBUG: export 359"
echo 359 > "/sys/class/gpio/export"
sleep 0.1
fi
@pfeerick
pfeerick / keybase.md
Last active September 22, 2021 03:28
Keybase proof - account reset

Keybase proof

I hereby claim:

  • I am pfeerick on github.
  • I am pfeerick (https://keybase.io/pfeerick) on keybase.
  • I have a public key ASDnUoeLmUrvFSkRC51KpJD7BftOaXoHqJ--LdLzZPQQrAo

To claim this, I am signing this object:

@pfeerick
pfeerick / flash-app.sh
Last active January 14, 2021 23:45
stlink pinetime swd
#!/bin/bash
OCD_SCRIPTS=/home/pfeerick/repos
openocd -f ${OCD_SCRIPTS}/stlink.cfg -f ${OCD_SCRIPTS}/flash_app.ocd
@pfeerick
pfeerick / build steps
Last active January 10, 2021 09:29
Steps to build joaquimorg pinetime fork on a debian system
sudo apt-get update -qq && sudo apt-get install -y wget unzip cmake make build-essential git python3 python3-pip
wget "https://developer.nordicsemi.com/nRF5_SDK/nRF5_SDK_v15.x.x/nRF5_SDK_15.3.0_59ac345.zip" -O /tmp/nRF5_SDK_15.3.0_59ac345.zip && unzip -q /tmp/nRF5_SDK_15.3.0_59ac345.zip -d /opt/ && rm nRF5_SDK_15.3.0_59ac345.zip
wget "https://developer.arm.com/-/media/Files/downloads/gnu-rm/9-2020q2/gcc-arm-none-eabi-9-2020-q2-update-x86_64-linux.tar.bz" -O - | tar -xj -C /opt/
git clone https://github.com/JuulLabs-OSS/mcuboot.git /opt/mcuboot && pip3 install -r /opt/mcuboot/scripts/requirements.txt
pip3 install adafruit-nrfutil
#include "flashLOG.h"
flashLOG::flashLOG(char *filename)
{
_logfilename = filename;
}
void flashLOG::start() {
if (!LittleFS.begin())
{
@pfeerick
pfeerick / flashLOG.cpp
Created August 8, 2020 06:02
flashlog testing
#include "flashLOG.h"
flashLOG::flashLOG(char *filename)
{
_logfilename = filename;
}
void flashLOG::start() {
if (!LittleFS.begin())
{
@pfeerick
pfeerick / compressed_ota.py
Last active January 5, 2024 09:15
Extra script to make PlatformIO do compressed OTA updates for the ESP8266
import gzip
import shutil
import os
Import("env")
def compressFirmware(source, target, env):
""" Compress ESP8266 firmware using gzip for 'compressed OTA upload' """
SOURCE_FILE = env.subst("$BUILD_DIR") + os.sep + env.subst("$PROGNAME") + ".bin"
if not os.path.exists(SOURCE_FILE+'.bak'):
@pfeerick
pfeerick / batteryChecker.sh
Last active April 30, 2020 05:54
Intiial rewrite of pine64-battery script from https://github.com/pfeerick/pine64-scripts/ supporting the use of the RGB leds on pinephone
#!/bin/bash
# Simple (!!) script that displays battery info for various pine64 (and possibly other) devices
# (specifically, those that use an AXP20x series power management chip).
# Get device model
if [ -f /proc/device-tree/model ]; then
IFS= read -r -d '' DEVICE_MODEL </proc/device-tree/model || [[ $DEVICE_MODEL ]]
else
DEVICE_MODEL="Unknown model"
@pfeerick
pfeerick / main.cpp
Created February 10, 2019 11:06
ESP32 AP platformio forum code
#include <Arduino.h>
#include <WiFi.h>
#include <WiFiClient.h>
#include <IPAddress.h>
String inputString="";
String inputStringWiFi="";
String hello="hello\r";
@pfeerick
pfeerick / main.cpp
Last active February 10, 2019 00:14
PlatformIO build_flags docs issue
#include <Arduino.h>
#include <ESP8266WiFi.h> //https://github.com/esp8266/Arduino
#include <DNSServer.h>
#include <ESP8266mDNS.h>
#include <ESP8266WebServer.h>
#include <ArduinoOTA.h>
#define SSID "fancy-ssid"
#define PASS "pass"