Skip to content

Instantly share code, notes, and snippets.

View janjongboom's full-sized avatar

Jan Jongboom janjongboom

View GitHub Profile
@janjongboom
janjongboom / gist:94d575526a689687a6b8
Last active February 24, 2023 14:40
Firefox OS / JanOS on Raspberry Pi with GPIO support

This does NOT work on Raspberry Pi 2!

  1. Obtain a 8GB (or bigger) SD Card
  2. Download disk image from http://janos.io/builds/fxos-pi-gpio.img.zip and unzip
  3. Put SD card in your computer
  4. Find out where your SD card is mounted (BE REALLY SURE ITS THE RIGHT DEVICE, IT WILL BE WIPED COMPLETELY!!!), f.e. /dev/disk5 on OSX
  5. On Linux, run: sudo dd bs=4M if=fxos-pi-gpio.img of=/path/to/your/disk
  6. On OSX, run: sudo dd bs=4m if=fxos-pi-gpio.img of=/dev/rdisk5 (do rdisk, not disk here!)
  7. When it's done put it in your Pi and start up
  8. The demo's are wired like this: yellow LED on GPIO2, red LED on GPIO3, button (wire it as pulldown) on GPIO26.
@janjongboom
janjongboom / vscode.js
Last active January 5, 2023 07:30
Cloud9 IDE keybindings for Visual Studio Code
// Place your key bindings in this file to overwrite the defaults
[
{
"key": "cmd+e",
"command": "workbench.action.quickOpen"
},
{
"key": "shift+cmd+e",
"command": "workbench.action.gotoSymbol"
},
@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.

<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Web Bluetooth demo</title>
</head>
<body>
<button id="go">Go Bluetooth</button>
<script>
document.querySelector('#go').onclick = (e) => {
@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 / 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.
@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 / 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