Skip to content

Instantly share code, notes, and snippets.

@Bilgus
Bilgus / Bluetooth_iface.c
Created November 7, 2020 04:34
Rockbox bluetooth interface
/*BLUETOOTH DRIVER FUNCTIONS*/
#define BT_DEVICE_SCAN_MAX_DEVICES 5 /*(64 x 5) 320 bytes*/
#define BT_ADDR_BYTES 18 /*'xx:xx:xx:xx:xx:xx\0'*/
#define BT_NAME_BYTES 32 /*device name*/
#define BT_PIN_BYTES 5 /*0000\0*/
#define BT_RSSI_BYTES 5 /*0000\0*/
struct bluetooth_device
{
char address[BT_ADDR_BYTES];
@Bilgus
Bilgus / is_dst.c
Last active February 7, 2020 00:22
Arduino Esp8266 DST calculation a faster less obtuse way (for NAmerica anyway)
#include <TimeLib.h>
//DST epoch indexed by offset from 2020 [{Begin}, {End}]
//2nd sunday in march to 1st sunday in november DST = TRUE
#define DST_TIME(mon,day,yr,hr,min) {0, min, hr, 0, day, mon, CalendarYrToTm(yr)}
const tmElements_t DST_TIME_START[16] PROGMEM = {
DST_TIME(3,8,2020, 2,0),
DST_TIME(3,14,2021, 2,0),
DST_TIME(3,13,2022, 2,0),
DST_TIME(3,12,2023, 2,0),
@Bilgus
Bilgus / lmarshal.c
Created July 23, 2019 13:19
richardhundt/lua-marshal rewrite
/*
* lmarshal.c
* A Lua library for serializing and deserializing Lua values
* Richard Hundt <richardhundt@gmail.com>
*
* License: MIT
*
* Copyright (c) 2010 Richard Hundt
* Copyright (c) 2019 William Wilgus -- rewrite with pagefile storage
*