Skip to content

Instantly share code, notes, and snippets.

@m-mcgowan
m-mcgowan / gist:3195ac229d672593e0eb
Created August 27, 2014 00:46
Spark UDP Write test harness
#include "application.h"
SYSTEM_MODE(SEMI_AUTOMATIC);
UDP Udp;
unsigned char TxMsg[12] = { 1, 254, 1, 254, 1, 254, 43, 212, 71, 184, 3, 252 };
unsigned char recbuf[12];
IPAddress addr(192,168,1,199);

Keybase proof

I hereby claim:

  • I am m-mcgowan on github.
  • I am mdma (https://keybase.io/mdma) on keybase.
  • I have a public key whose fingerprint is 4A3E CCF8 94E9 E2FF 260E 6F7B F401 D981 DA11 523A

To claim this, I am signing this object:

@m-mcgowan
m-mcgowan / closed issues.txt
Last active August 29, 2015 14:18
closed issues Sprint 32
68 - TCP Client fixes on photon
110 - trust TCP to make OTA faster
129 - Factory reset without clearing wifi credentials.
146 - Compiler getting confused by String
162 - USB HID, Mouse, Keyboard support
217 - RAM enhancement.
220 - Printing empty String object should be a no-op
235, 316 - contribute link
250 - YModem serial upgrade
253 - Support for WiFi channels >11

The binaries consumed in the Particle ecosystem should include "module info" descriptors that appear at fixed locations in the binary. There are 2 module info structures:

  • start info: appears at the start of the binary, this defines the platform, version, module type, module dependencies
  • end info: appears at the end of the binary. Defines product ID and version, as set in user code and provides storage for the SHA256 and CRC32 hashes that are added after the binary is built.

Compiling Module Info

The module info structures are defined in dynalib/inc/module_info.h. The structures are instantiated in dynalib/inc/module_info.inc which defines the default values for all platforms.

The main project compiles the module info structure instances into a module_info.o object file - main/src/module_info.c simply includes module_info.inc from dynalib so the instance declarations become static data.

Keybase proof

I hereby claim:

  • I am m-mcgowan on github.
  • I am mdma (https://keybase.io/mdma) on keybase.
  • I have a public key whose fingerprint is 716B CFD0 EC60 85EB D2C6 D047 53BF 5C5A 27D8 B54A

To claim this, I am signing this object:

@m-mcgowan
m-mcgowan / STM32 clock counter profiling.h
Created November 8, 2022 22:41
STM32 function profiling using the cycle counter
// Quick and dirty profiler for STM32 devices with the DWT cycle counter
// Computes the percentage of processor time spent in a function. Best suited for functions that are called routinely.
// Can be used in mixed C/C++ code.
// profile.h
#pragma once
inline uint32_t perfCounter() {
return DWT->CYCCNT;
}