Skip to content

Instantly share code, notes, and snippets.

View jjmilburn's full-sized avatar

Josh Milburn jjmilburn

View GitHub Profile
@jjmilburn
jjmilburn / SketchSystems.spec
Last active June 25, 2021 06:45
PAYG Credit Resource Interaction with NXC Links
PAYG Credit Resource Interaction with NXC Links
# Initial state -
# implies that link state should be initialized before PAYG credit initializes
NXC Linked?*
No links? -> No NXC links
Any linked accessory has PAYG credit resource? -> Credit Leading
Any linked controller has PAYG credit resource? -> Credit Following
No NXC links
@jjmilburn
jjmilburn / SketchSystems.spec
Last active April 14, 2021 00:04
PAYG Accessory&
PAYG Accessory&
Link State
Unlinked*
valid_link_challenge_received->Authenticating Link
Linking
Authenticating Link
authenticated_ok->Respond Confirming Link
failed_authentication-> Error During Linking
Respond Confirming Link
respond_success->Linked
@jjmilburn
jjmilburn / SketchSystems.spec
Last active November 25, 2020 02:11 — forked from ricehornet/SketchSystems.spec
# Theoretically, do we want to allow an 'independent' mode where PAYG credit is always independent of link state?
# Theoretically, do we want to allow an 'independent' mode where PAYG credit is always independent of link state?
1 or more NX Channel Links
link or unlink event -> link state?
reset -> Credit Independent
Credit Leading&
tick? -> push credit update to accessory
event indicates PAYG credit has updated? -> push credit update to accessory
@jjmilburn
jjmilburn / SketchSystems.spec
Last active December 4, 2020 00:53
Generating dlight unit keycode
Generating dlight unit keycode
#dlight server index is unknown
Angaza index is X*
get_dlight_server_latest_token_data -> unit number exists on dlight server?
unit number exists on dlight server?
yes? -> dlight latest token index is X minus 1 or None?
no? -> Raise error require ticket to add unit on dlight side
dlight latest token index is X minus 1 or None?
yes? -> dlight_create_token_with_id_x
no? -> is dlight server index and token value equal to Angaza index and requested value?
@jjmilburn
jjmilburn / SketchSystems.spec
Last active October 30, 2020 02:27
POST_PAY Phone in Backend*
POST_PAY Phone in Backend*
No unit record*
# Upload IMEIs to Angaza, we will attempt to upload to Samsung
batch_upload ->SHOULD_UPLOAD
SHOULD_UPLOAD
# successfully sets reported data, marks as uploaded OK to samsung
activation_success ->UPLOADED
@jjmilburn
jjmilburn / SketchSystems.spec
Created December 27, 2019 07:12
ASP Accessory Symmetric Key Link Manager
ASP Accessory Symmetric Key Link Manager
Unlinked
Unlinked Idle*
TICK->Broadcast Timeout Expired?
valid_asp_link_challenge_received->Computing Link Key
Broadcasting Identity
send_asp_notify_accessory_unlinked->Unlinked Idle
Broadcast Timeout Expired?
timeout expired?->Broadcasting Identity
timeout not expired?->Unlinked Idle
@jjmilburn
jjmilburn / SketchSystems.spec
Last active April 14, 2021 00:33
ASP Accessory Symmetric Key Link Manager
ASP Accessory Symmetric Key Link Manager
Unlinked
Unlinked Idle*
TICK->Broadcast Timeout Expired?
valid_asp_link_challenge_received->Computing Link Key
Broadcasting Identity
send_asp_notify_accessory_unlinked->Unlinked Idle
Broadcast Timeout Expired?
timeout expired?->Broadcasting Identity
timeout not expired?->Unlinked Idle
#!/bin/sh
DAM_RO_BASE=0x43000000
export TOOL_PATH_ROOT="../../Snapdragon-llvm-4.0.3-linux64/"
export TOOLCHAIN_PATH="$TOOL_PATH_ROOT/bin"
export LLVMLINK_PATH="$TOOL_PATH_ROOT/tools/bin"
export TOOLCHAIN_PATH_STANDARDS="$TOOL_PATH_ROOT/armv7m-none-eabi/libc/include"
export LLVMLIB="$TOOL_PATH_ROOT/lib/clang/4.0.3/lib"
export PYTHON_PATH="/usr/bin/python2"
@jjmilburn
jjmilburn / SketchSystems.spec
Last active April 29, 2019 07:10
Product MCU - PAYG MCU UART Link
Product MCU - PAYG MCU UART Link
Idle*
uart_from_payg_mcu -> Buffer Message
Buffer Message
message_is_payg_uart -> Process Message
message_is_asp -> Forward Message to Accessory
Process Message
message_processed -> Idle
Forward Message to Accessory
message_forwarded -> Idle
/****************************************************************************
** hw_ftdi.c ***************************************************************
****************************************************************************
*
* Mode2 receiver + transmitter using the bitbang mode of an FTDI
* USB-to-serial chip such as the FT232R, with a demodulating IR receiver
* connected to one of the FTDI chip's data pins -- by default, D1 (RXD).
*
* Copyright (C) 2008 Albert Huitsing <albert@huitsing.nl>
* Copyright (C) 2008 Adam Sampson <ats@offog.org>