Skip to content

Instantly share code, notes, and snippets.

View janjongboom's full-sized avatar

Jan Jongboom janjongboom

View GitHub Profile
@janjongboom
janjongboom / keybase.md
Created November 20, 2019 00:38
keybase.md

Keybase proof

I hereby claim:

  • I am janjongboom on github.
  • I am janjongboom_ei (https://keybase.io/janjongboom_ei) on keybase.
  • I have a public key ASBw8qHhTjPwmtNwu1g_Aqjb5STs958rb5JFtxrorS7hwAo

To claim this, I am signing this object:

@janjongboom
janjongboom / fsb.md
Last active March 7, 2019 07:12
Mbed OS + The Things Network (setting frequency sub band)

You might have trouble connecting your Mbed OS device to The Things Network if you're in the US. The reason is that there are 72 channels available in the US, but your gateway is only listening to 8 channels. You can limit the channels that the Mbed OS LoRaWAN stack is using by setting the fsb-mask option. TTN is using FSB 1.

In your Mbed OS project, open mbed_app.json and add under target_overrides:

           "lora.phy": "US915",
           "lora.fsb-mask": "{0xFF00, 0x0000, 0x0000, 0x0000, 0x0002}",

And re-compile.

@janjongboom
janjongboom / 1_instructions.md
Created June 18, 2018 03:23
DISCO_F413ZH debugging with OpenOCD and Visual Studio Code
  1. Download OpenOCD.

  2. Place the folder in ~/openocd - so that the scripts is directly under ~/openocd/scripts.

  3. Add it to your PATH via:

    ln -s ~/openocd/bin/openocd /usr/local/bin/openocd

  4. Make sure no applications are bound to port 3333.

  5. Place launch.json and tasks.json in your .vscode folder.

Note: Set the right path in debugServerArgs.

@janjongboom
janjongboom / jerryscript.patch
Created January 12, 2018 14:05
RTL8195AM w/ Mbed.js
diff --git a/targets/mbedos5/jerryscript-mbed/jerryscript-mbed-drivers/source/DigitalOut-js.cpp b/targets/mbedos5/jerryscript-mbed/jerryscript-mbed-drivers/source/DigitalOut-js.cpp
index 7edae943..bb361542 100644
--- a/targets/mbedos5/jerryscript-mbed/jerryscript-mbed-drivers/source/DigitalOut-js.cpp
+++ b/targets/mbedos5/jerryscript-mbed/jerryscript-mbed-drivers/source/DigitalOut-js.cpp
@@ -92,31 +92,6 @@ DECLARE_CLASS_FUNCTION(DigitalOut, read) {
return jerry_create_number(result);
}
-/**
- * DigitalOut#is_connected (native JavaScript method)
@janjongboom
janjongboom / DebounceInterruptIn.h
Created November 21, 2017 11:42
Mbed OS DebounceInterruptIn
// This is a wrapper around InterruptIn, which can debounce
#ifndef _DEBOUNCE_INTERRUPT_IN
#define _DEBOUNCE_INTERRUPT_IN
#if defined (DEVICE_INTERRUPTIN) || defined(DOXYGEN_ONLY)
#include "mbed.h"
namespace mbed {
@janjongboom
janjongboom / debian64.sh
Last active November 8, 2017 14:57
Mbed CLI install script
#!/bin/bash
cwd=$(pwd)
DIR=$(dirname $(readlink -f $0))
echo "This application will install Mbed CLI..."
sudo apt-get update
sudo apt -y install dh-autoreconf build-essential libncurses5-dev
@janjongboom
janjongboom / main.cpp
Created August 30, 2017 10:11
Ubidots
#include "mbed.h"
#include "easy-connect.h"
#include "http_request.h"
Serial pc(USBTX, USBRX);
void dump_response(HttpResponse* res) {
printf("Status: %d - %s\n", res->get_status_code(), res->get_status_message().c_str());
printf("Headers:\n");
@janjongboom
janjongboom / PinNames.h
Created August 28, 2017 09:34
NUCLEO_F207ZG JerryScript PinNames.h
/* mbed Microcontroller Library
*******************************************************************************
* Copyright (c) 2016, STMicroelectronics
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
@janjongboom
janjongboom / Makefile
Created August 12, 2017 09:15
NUCLEO F411RE mbed OS 5.5 blinky makefile
# This file was automagically generated by mbed.org. For more information,
# see http://mbed.org/handbook/Exporting-to-GCC-ARM-Embedded
###############################################################################
# Boiler-plate
# cross-platform directory manipulation
ifeq ($(shell echo $$OS),$$OS)
MAKEDIR = if not exist "$(1)" mkdir "$(1)"
RM = rmdir /S /Q "$(1)"
@janjongboom
janjongboom / firebase.cpp
Last active March 30, 2019 09:10
HTTPS request to firebase.google.com using https://developer.mbed.org/teams/sandbox/code/mbed-http/
#include "mbed.h"
#include "easy-connect.h"
#include "https_request.h"
Serial pc(USBTX, USBRX);
/* List of trusted root CA certificates
* This is the root CA for Google from GeoTrustGlobalCA
*
* To add more root certificates, just concatenate them.