Skip to content

Instantly share code, notes, and snippets.

View sanchox's full-sized avatar
🏠
Working from home

Aleksandr Gusarov sanchox

🏠
Working from home
  • ARRIVAL
  • Berlin
View GitHub Profile
@sanchox
sanchox / siprog.sh
Last active May 23, 2021 22:18
Bash script to program Silabs SI53xx devices via I2C bus using txt file exported from ClockBuilder tool
#!/bin/bash
I2CBUS="1"
I2CADDR="0x6a"
current_page="-1"
function set_page {
if [ "x$current_page" == "x$1" ]; then return; fi
@sanchox
sanchox / decode.js
Created April 29, 2020 14:46
ChirpStack JS decoder for VEGA TS-11 (https://en.iotvega.com/product/tester) payloads
// 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 February 10, 2019 22:03
Bash script to program AD9547/AD9548
#!/bin/bash
modprobe i2c-dev
I2CBUS="1"
I2CADDR="0x49"
function h2d() {
echo $((16#$1))
}

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: