Skip to content

Instantly share code, notes, and snippets.

View mengstr's full-sized avatar

Mats Engstrom mengstr

View GitHub Profile
@mengstr
mengstr / sorttest.asm
Last active May 7, 2019 18:03
Atari 2600 sorting of 8 byts of data
;
; Results for sorting 8 bytes
;
; First value is the number of scanlines required for pre-sorted data, second is
; for data that is fully reverse order.
;
; Yellow 3.0 - 7.5 (369 bytes) Continous Unrolled
; Orange 7.5 - 12.0 (262 bytes) Continous Subroutined
; Red 4.0 - 9.0 (138 bytes) Continous Fallthrough
; Blue 2.4 - 29.9 ( 51 bytes) Bubblesort
curl "https://circleci.com/gh/SmallRoomLabs/circleci-demo-go/tree/master.svg?style=shield&circle-token=632f67b7a9980f59c8b802d6a155885b55313a70"
<?xml version="1.0" encoding="UTF-8"?>
<svg xmlns="http://www.w3.org/2000/svg" width="93" height="20">
<linearGradient id="b" x2="0" y2="100%">
<stop offset="0" stop-color="#bbb" stop-opacity=".1" />
<stop offset="1" stop-opacity=".1" />
</linearGradient>
<mask id="a">
<rect width="93" height="20" rx="3" fill="#fff" />
@mengstr
mengstr / gpioblink.ino
Last active November 5, 2022 18:34
Blink the blue LED on a NodeMCU using direct port manipulation
@mengstr
mengstr / main.c
Created October 21, 2018 14:12
Output 4MHz square wave at PA14 on SAMD20 with AFS
#include <compiler.h>
#undef ENABLE
#undef DISABLE
#include <asf.h>
int main (void) {
system_init();
PORT->Group[0].DIRSET.reg=PORT_PA14;
PORT->Group[0].PINCFG[PIN_PA14].bit.PMUXEN=1;
@mengstr
mengstr / gist:eb729c9b50a1b243bdd3342e694e53ae
Created February 10, 2018 11:53
ESP32 Basic keyboard scanner
NEW
10 IODIR 33,1 : IODIR 26,1 : IODIR 27,1
11 IOSET 33,0 : IOSET 26,0 : IOSET 27,0
20 IODIR 15,0 : IODIR 2,0 : IODIR 4,0 : IODIR 16,0
21 IODIR 17,0 : IODIR 5,0 : IODIR 18,0 : IODIR 23,0
30 X=27 : Y=33 : Z=26
40 PRINT "DATA=",X," CLOCK=",Y," LATCH=",Z
50 V=&B0111111111111111 : GOSUB 1000
51 V=&B1011111111111111 : GOSUB 1000
@mengstr
mengstr / ESP8266_speed_test.md
Last active March 14, 2017 06:02
ESP8266 NOSDK speed tests
Mhz Elapsed Theoretical Diff
52 134.61 x x
80 87.50 87.50 0.0
104 67.31 67.31 0.0
115 60.58 60.87 -0.3
160 43.75 43.75 0.0
173 40.38 40.46 -0.1
189 38.15 37.04 1.1
231 30.29 30.30 0.0
@mengstr
mengstr / wificonfig.c
Created January 9, 2017 08:27
Example of wifi-config for esp8266
int WaitForWifi() {
int timeout=30;
while(timeout-- && WiFi.status()!=WL_CONNECTED) {
delay(1000);
}
return (WiFi.status()==WL_CONNECTED);
}
@mengstr
mengstr / gist:801a406be8bc7debd17a1847461aa85d
Created January 2, 2017 15:58
Find the IP address(es) of ESP8266 on the network
sudo arp-scan --interface=wlp5s0b1 --localnet | grep 5c\:cf\:7f
@mengstr
mengstr / style.js
Created December 4, 2016 16:57
javascript add stylesheet
var style=document.createElement('style');
style.innerHTML = `
.item {
background-color:#333;
border:1px solid rgba(255,255,255,0.2);
border-radius: 5px;
padding:0;
margin:0;
}
@mengstr
mengstr / bank.inc
Created November 28, 2016 03:57
Automatic bankswitching for PIC in absolute code
#define @ & 0x7F ; Supress warning of Non-bank 0 register
variable CBANK = -1
setbank macro banknum
if CBANK!=(banknum & (-1<<7))
CBANK = banknum & (-1<<7)
banksel CBANK
endif
endm