Skip to content

Instantly share code, notes, and snippets.

// source https://wiki.maemo.org/SimpleGL_example
/* Created by exoticorn ( http://talk.maemo.org/showthread.php?t=37356 )
* edited and commented by André Bergner [endboss]
*
* libraries needed: libx11-dev, libgles2-dev
*
* compile with: g++ -lX11 -lEGL -lGLESv2 egl-example.cpp
*/
@rclabs
rclabs / gist:fb6954f1de70e7b8f81cb83d38488552
Created August 15, 2017 05:49
Blink LED on esp32 thing
/*
https://cdn.sparkfun.com/datasheets/Wireless/WiFi/ESP32ThingV1.pdf - esp32 thing pinout
https://cdn.sparkfun.com/assets/learn_tutorials/5/0/7/esp32-thing-schematic.pdf
http://esp-idf.readthedocs.io/en/latest/api-reference/peripherals/gpio.html - GPIO documentation
http://www.lucadentella.it/en/2016/12/22/esp32-4-flash-bootloader-e-freertos/ - RTOS explanation
*/
void loop_task(void *pvParameter) {
#define PIN (1 << 5)
gpio_config_t io_conf;
@rclabs
rclabs / uart-pi.c
Last active December 12, 2015 09:29
uart test code
#include <msp430.h>
#include <legacymsp430.h>
// https://github.com/wendlers/msp430-harduart/blob/master/src/uart.c
// https://github.com/ideasium/msp430-uart/blob/master/msp430-uart/uart.c
// http://www.geom.uiuc.edu/~huberty/math5337/groupe/digits.html
char *pi = "3.141592653589793238462643383279502884197169399375105820974944592307816406286";
int pos = 0;
@rclabs
rclabs / timer.c
Last active December 12, 2015 08:39
msp430 msp430g2553 using ccr0, ccr1 and timer overflow interrupts to generate a pwm signal on p1.0 and p1.6
// using ccr0, ccr1 and timer overflow interrupts to generate a pwm signal on p1.0 and p1.6
#include <msp430.h>
#define interrupt(x) void __attribute__((interrupt (x)))
interrupt(TIMER0_A0_VECTOR) tmr_ccr0 () {
// interrupt flag is automatically reset
// ccr0
P1OUT &= ~(BIT0);
@rclabs
rclabs / interrupt.c
Created February 4, 2013 16:17
msp430 i/o and interrupts: led state track button press on launchpad
#include <msp430.h>
#define interrupt(x) void __attribute__((interrupt (x)))
interrupt(PORT1_VECTOR) isr() {
P1OUT ^= BIT6 | BIT0; // toggle
P1IES ^= BIT3; // change edge
P1IFG = 0x00;
}
@rclabs
rclabs / youtube2xbmc.js
Created January 18, 2013 11:38
youtube to xbmc using node.js
// based on
// xbmc api example http://userscripts.org/scripts/review/117046
// node.js example code http://nodejs.org/api/http.html#http_http_request_options_callback
var http = require('http');
var options = {
hostname: '192.168.1.100',
port: 80,
path: '/jsonrpc',
@rclabs
rclabs / gist:3925294
Created October 20, 2012 23:59
forth
." hello world" cr
: hello ." hello world" cr ;
: 3times hello hello hello ;
: ntimes ( n -- ) begin dup 0> while hello 1- repeat drop ;
: sum ( xi n -- sum ) 0 swap begin dup 0> while 1- -rot + swap repeat drop ;