Skip to content

Instantly share code, notes, and snippets.

View towynlin's full-sized avatar

Zachary Crockett towynlin

View GitHub Profile
@towynlin
towynlin / 2021-03-12-ble-trace-logs-time-overrun-error.txt
Last active March 13, 2021 01:08
STM32WB55 BLE Trace Log in which twice occurs HCI_HARDWARE_ERROR_EVENT event_time_overrun
[tl_mbox.c][OutputDbgTrace][830] sys evt: 0xFF
[tl_mbox.c][OutputDbgTrace][831] subevtcode: 0x9200
[tl_mbox.c][OutputDbgTrace][834] payload: 00
[tl_mbox.c][OutputDbgTrace][839]
[tl_mbox.c][OutputDbgTrace][785] sys cmd: 0xFC68
[tl_mbox.c][OutputDbgTrace][789] payload: 98 DE 02 08 E4 01 03 20 E0 01 03 20 22 04 04
[tl_mbox.c][OutputDbgTrace][792]
@towynlin
towynlin / set-pebble-time.py
Created July 5, 2019 07:29
I just wanted to set the time on my pebble, but there's no more app on the play store. So, after some fun searching, reading, learning, trial, and error...
import sys
import time
from libpebble2.communication import PebbleConnection
from libpebble2.communication.transports.serial import SerialTransport
from libpebble2.protocol.base import PebblePacket
from libpebble2.protocol.base.types import *
from libpebble2.protocol.system import *
pebble = PebbleConnection(SerialTransport(sys.argv[1])) # argument like /dev/cu.Pebble...
pebble.connect()
@towynlin
towynlin / multicast-demo.ino
Created November 30, 2016 07:39
Multicast demo between several Photons on the same local network
const int multicastPort = 23232;
const IPAddress multicastAddress(233,252,1,64);
UDP udp;
char buf[100];
void setup() {
udp.begin(multicastPort);
udp.joinMulticast(multicastAddress);
}
@towynlin
towynlin / a-b.diff
Last active September 30, 2015 02:50
Getting Particle Devices to have Identical Firmware
1482c1482
< 0005c90: 0b50 686f 746f 6e2d 4342 4558 ffff ffff .Photon-CBEX....
---
> 0005c90: 0b50 686f 746f 6e2d 4433 3235 ffff ffff .Photon-D325....
1499,1537c1499,1537
< 0005da0: 025f 0201 0002 8181 00c2 b20a 811d 8590 ._..............
< 0005db0: e3da cdc5 3295 4159 76e2 4b56 6a49 4489 ....2.AYv.KVjID.
< 0005dc0: 1c70 3fb1 5690 bf14 a3be 80b8 cd2b dcfd .p?.V........+..
< 0005dd0: d36d 8b65 382a baec c664 a7ea d47c 6e01 .m.e8*...d...|n.
< 0005de0: 205e 7816 af6b 8d3a 4ea9 59cc ca96 e932 ^x..k.:N.Y....2
@towynlin
towynlin / presence_announce.ino
Created June 1, 2015 07:48
Photon Multicast Presence Announcement from user app
SYSTEM_MODE(SEMI_AUTOMATIC);
UDP udp;
char binaryDeviceID[12];
const char SKIP_FROM_9_TO_A = 'a' - '9' - 1;
int presence_announcement_coap(unsigned char *buf, const char *id)
{
buf[0] = 0x50; // Confirmable, no token
buf[1] = 0x02; // Code POST
@towynlin
towynlin / mac-addr.ino
Created March 27, 2015 00:57
Get Spark Core MAC address any of several ways
static char macString[18];
static int t = 0;
static bool printed = false;
void setup() {
Spark.variable("mac", macString, STRING);
Serial.begin(115200);
byte mac[6];
WiFi.macAddress(mac);
@towynlin
towynlin / serial-and-wifi.ino
Created January 17, 2015 03:20
Show both serial and Wi-Fi working together
int last = 0;
char buf[256];
int toSerial(String s) {
Serial.print("You said via REST API: ");
Serial.println(s);
memset(buf, 0, 256);
int charsRead = 0;
while (Serial.available() && charsRead < 255) {
@towynlin
towynlin / wifi-connecting-timeout.ino
Last active August 29, 2015 14:11
Incorrect Spark Core Wi-Fi password timeout
SYSTEM_MODE(SEMI_AUTOMATIC);
bool wasConnecting = false;
int startedConnectingAt = 0;
void setup() {
Spark.connect();
}
void checkForTimeout() {
@towynlin
towynlin / binary-to-serial.ino
Created October 29, 2014 23:46
Quick Spark test app for sending binary to a Spark.function
int binaryToSerial(String s) {
int len = s.length();
for (int i=0; i < len; i++) {
Serial.write(s[i]);
Serial.write(' ');
Serial.println(s[i], HEX);
}
return len;
}
@towynlin
towynlin / keybase.md
Created October 29, 2014 19:50
Keybase Proof of Identity

Keybase proof

I hereby claim:

  • I am towynlin on github.
  • I am towynlin (https://keybase.io/towynlin) on keybase.
  • I have a public key whose fingerprint is 6477 2407 CE3A 48C0 2D32 0DD9 585E 75DD 1E3E 7AA1

To claim this, I am signing this object: