Skip to content

Instantly share code, notes, and snippets.

crc_table16
calcCRC16(buf, len)
sub_C8069E54 - message dispatch towards end of func?
sub_C8069D60
called with len 0, 1, 2, 4
sub_C80697CC (sets byte_CC066B3C[0] = 26 = 0x1a)
sub_C806A2C8
uses CRC to validate something
sub_C80A2070
some 9 byte message with 0xCC and a lot of zeros in it
Page data:
2016-10-22 19:18:06.038064 RileyLink[22532:9245270] GlucosePage 00 - (bytes 000-255): 0541400008052143000c050143000c050143000b0541400008050157020a0541400008052157020c054140000c0541400008052140000c10174a820c10174a820b000001101857811000000110185c811000000110185e811000000110186e8e1010386f8e0b10186f8e0b00000110186d9410000001101849951000000110184396100000011018479710000001101e728d100000011007b38c100000011007b48c100000011007b59410000001100782951000000110078f961000000110088a97100000011009b992100000011014b5941000000110148e95100000011015948c100000011015848f101035b1900b1036938d0d0004020402040204020402
2016-10-22 19:18:06.050216 RileyLink[22532:9245270] GlucosePage 00 - (bytes 256-511): 04030304030303020402040204020402040204020402040204020402040204020402040204000300036610169a8f0e01036610169f8f0e0103010333de141016ac8f0f32323130132f2e2e2d2d132d132c132c132d132c132c1056ba9008132b132b2b2b2c2c2d2e2f1332373c3f40424313454747461345454546464748010000000000000000000000000000000000000000000000000000000000000000000000000
2016-10-22 16:15:37.977536 RileyLink[22343:9172021] GlucosePage 00 - (bytes 000-255): 0541400008052143000c050143000c050143000b0541400008050157020a0541400008052157020c054140000c0541400008052140000c10174a820c10174a820b000001101857811000000110185c811000000110185e811000000110186e8e1010386f8e0b10186f8e0b00000110186d9410000001101849951000000110184396100000011018479710000001101e728d100000011007b38c100000011007b48c100000011007b59410000001100782951000000110078f961000000110088a97100000011009b992100000011014b5941000000110148e95100000011015948c100000011015848f101035b1900b1036938d0d0004020402040204020402
2016-10-22 16:15:37.988285 RileyLink[22343:9172021] GlucosePage 00 - (bytes 256-511): 04030304030303020402040204020402040204020402040204020402040204020402040204000300036610169a8f0e01036610169f8f0e0103010333de141016ac8f0f32323130132f2e01000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
@ps2
ps2 / gist:b714b7ae08642ffdae93ca22731f06b5
Last active October 22, 2016 21:16
sensor data at 3:38
# Initial read
2016-10-22 15:38:54.653694 RileyLink[22328:9159570] GlucosePage 00 - (bytes 000-255): 0541400008052143000c050143000c050143000b0541400008050157020a0541400008052157020c054140000c0541400008052140000c10174a820c10174a820b000001101857811000000110185c811000000110185e811000000110186e8e1010386f8e0b10186f8e0b00000110186d9410000001101849951000000110184396100000011018479710000001101e728d100000011007b38c100000011007b48c100000011007b59410000001100782951000000110078f961000000110088a97100000011009b992100000011014b5941000000110148e95100000011015948c100000011015848f101035b1900b1036938d0d0004020402040204020402
2016-10-22 15:38:54.665307 RileyLink[22328:9159570] GlucosePage 00 - (bytes 256-511): 04030304030303020402040204020402040204020402040204020402040204020402040204000300036610169a8f0e01036610169f8f0e010301000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000

How can this code:

    api( ).update(query, obj, {upsert: true, new: true}, function complete (err, r1) {
      if (!err) {
        console.log("r1 = " + r1)
        console.log("typeof(r1) = " + typeof(r1))
        console.log("r1.upserted = " + r1.upserted)
        console.log("Object.keys(r1) = " + Object.keys(r1))
@ps2
ps2 / gist:8694b78571f2cbf061d2c1797434fa5d
Last active September 13, 2016 22:39
CC Debugger program firmware
- NOP
Read Status 0x34 [], 178
Write Config 0x1d [34], 178
=============================================== Get PARTNUM & VERSION ======================
- NOP
- MOV A, DPS -> 0
- MOV DPS, #0
- MOV A, DPH0 -> 0
- MOV A, DPL0 -> 0
- MOV DPTR, PARTNUM
 0
Target:blank
Partitioning already done...
Flashing already done...
GADGET DRIVER: usb_dnl_dfu
@ps2
ps2 / corr.py
Created July 8, 2016 04:01
bit correlation plot
from matplotlib import gridspec
ticks = np.arange(0, bit_deltas.shape[1], 8.0)
fig = plt.figure(figsize=(15, 15))
gs = gridspec.GridSpec(4, 1)
ax1 = fig.add_subplot(gs[0:3,:])
ax2 = fig.add_subplot(gs[3,:])
ax1.matshow(bit_deltas.corr(), aspect='auto')
#!/usr/bin/env python
from subprocess import call
import sys
for width in range(4,17):
for skip in range(0,9):
packets = map(lambda x: x[skip*2:], sys.argv[1:])
#print "***** data = %s" % packets
print "***** width = %d" % width
from bluepy.btle import UUID, Peripheral, ADDR_TYPE_PUBLIC, DefaultDelegate
import time
import struct
class RileyLinkBLE(DefaultDelegate):
SERVICE_UUID = "0235733b-99c5-4197-b856-69219c2a3845"
DATA_UUID = "c842e849-5028-42e2-867c-016adada9155"
RESPONSE_COUNT_UUID = "6e6c7910-b89e-43a5-a0fe-50c5e2b81f4a"
CUSTOM_NAME_UUID = "d93b2af0-1e28-11e4-8c21-0800200c9a66"
TIMER_TICK_UUID = "6e6c7910-b89e-43a5-78af-50c5e2b86f7e"