Skip to content

Instantly share code, notes, and snippets.

@sanchox
sanchox / decode.js
Created Apr 29, 2020
ChirpStack JS decoder for VEGA TS-11 (https://en.iotvega.com/product/tester) payloads
View decode.js
// Decode decodes an array of bytes into an object.
// - fPort contains the LoRaWAN fPort number
// - bytes is an array of bytes, e.g. [225, 230, 255, 0]
// - variables contains the device variables e.g. {"calibration": "3.5"} (both the key / value are of type string)
// The function must return an object, e.g. {"temperature": 22.5}
function Decode(fPort, bytes, variables) {
output = {}
if (fPort == 4) {
flag_bits = bytes[0].toString(2).split('').reverse()
@sanchox
sanchox / adprog.sh
Last active Feb 10, 2019
Bash script to program AD9547/AD9548
View adprog.sh
#!/bin/bash
modprobe i2c-dev
I2CBUS="1"
I2CADDR="0x49"
function h2d() {
echo $((16#$1))
}
@sanchox
sanchox / siprog.sh
Last active May 23, 2021
Bash script to program Silabs SI53xx devices via I2C bus using txt file exported from ClockBuilder tool
View siprog.sh
#!/bin/bash
I2CBUS="1"
I2CADDR="0x6a"
current_page="-1"
function set_page {
if [ "x$current_page" == "x$1" ]; then return; fi
View keybase.md

Keybase proof

I hereby claim:

  • I am sanchox on github.
  • I am sanchox (https://keybase.io/sanchox) on keybase.
  • I have a public key ASBn-DG74NovwjQ5xbIdImmJ3KLB6UzlbcigKSU2LKIvWgo

To claim this, I am signing this object: