Skip to content

Instantly share code, notes, and snippets.

@sago35
sago35 / main.go
Created March 14, 2020 02:09
tinygo + tinyfont + notoemoji
package main
import (
"image/color"
"machine"
"time"
"tinygo.org/x/drivers/ili9341"
"tinygo.org/x/tinyfont"
)
@sago35
sago35 / main.go
Last active April 17, 2020 12:26
ili9341 improve test code
package main
import (
"fmt"
"image/color"
"machine"
"time"
"tinygo.org/x/drivers/ili9341"
"tinygo.org/x/tinyfont"
@sago35
sago35 / touchSerialPortAt1200bps.go
Created April 27, 2020 12:15
touchSerialPortAt1200bps
package main
import (
"fmt"
"log"
"time"
"go.bug.st/serial"
)
@sago35
sago35 / enablefpu.go
Created May 22, 2020 22:21
A workaround for crashes when trying to use SAMD5x FPU on windows version of tinygo
// +build atsamd51
// Put this file in the main package directory
// https://github.com/tinygo-org/tinygo/issues/944#issuecomment-597065613
// http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.ddi0439b/BEHBJHIG.html
package main
import (
"runtime/volatile"
@sago35
sago35 / console.go
Created June 25, 2020 10:15
tinygo spi sdcard driver
package main
import (
"fmt"
"io"
"machine"
"os"
"strconv"
"strings"
"time"
at_spi_write('AT+CWMODE=1\r\n', 13, 500)
at_spi_read ('OK\r\n', 4, 500)
at_spi_write('AT+CWMODE?\r\n', 12, 500)
at_spi_read ('+CWMODE:1\r\nOK\r\n', 15, 500)
at_spi_write('AT+CWQAP\r\n', 10, 500)
at_spi_read ('OK\r\n', 4, 500)
at_spi_write('AT+CWMODE?\r\n', 12, 500)
at_spi_read ('+CWMODE:1\r\nOK\r\n', 15, 500)
at_spi_write('AT+CWQAP\r\n', 10, 500)
at_spi_read ('OK\r\n', 4, 500)
@sago35
sago35 / build-openocd-windows.sh
Created September 16, 2020 12:57
openocd-windows build script
set -e
BUILD_DIR=${HOME}/openocd-windows
LIBUSB1_BUILD_DIR=${BUILD_DIR}/libusb
LIBUSB0_BUILD_DIR=${BUILD_DIR}/libusb-compat
LIBCONFUSE_BUILD_DIR=${BUILD_DIR}/libconfuse
HIDAPI_BUILD_DIR=${BUILD_DIR}/hidapi
LIBFTDI_BUILD_DIR=${BUILD_DIR}/libftdi
mkdir -p ${BUILD_DIR}
cd ${BUILD_DIR}
@sago35
sago35 / dissassemble machine.SPI.txrx
Last active October 26, 2020 05:48
(machine.SPI).txrx
(gdb) disassemble
Dump of assembler code for function (machine.SPI).txrx:
0x00005b82 <+0>: stmdb sp!, {r4, r5, r6, r7, r8, r9, r10, r11, lr}
0x00005b86 <+4>: sub sp, #12
=> 0x00005b88 <+6>: cmp r0, #0
0x00005b8a <+8>: str r3, [sp, #8]
0x00005b8c <+10>: beq.n 0x5c24 <(machine.SPI).txrx+162>
0x00005b8e <+12>: mov r11, r2
0x00005b90 <+14>: cmp r2, #0
0x00005b92 <+16>: beq.n 0x5c20 <(machine.SPI).txrx+158>
@sago35
sago35 / erpc_debug_passthrough.ino
Created November 20, 2020 13:34
Wio Terminal RTL8720D UART Transport Passthrough
#include <wiring_private.h>
#define PIN_BLE_SERIAL_X_RX (84ul)
#define PIN_BLE_SERIAL_X_TX (85ul)
#define PAD_BLE_SERIAL_X_RX (SERCOM_RX_PAD_2)
#define PAD_BLE_SERIAL_X_TX (UART_TX_PAD_0)
#define SERCOM_BLE_SERIAL_X sercom0
static Uart rtl_uart(&SERCOM_BLE_SERIAL_X, PIN_BLE_SERIAL_X_RX, PIN_BLE_SERIAL_X_TX, PAD_BLE_SERIAL_X_RX, PAD_BLE_SERIAL_X_TX);
@sago35
sago35 / rtl8270dn.erpc
Created November 22, 2020 09:24
Wio Terminal RTL8720D eRPC IDL
// erpc_idl/rpc_system.erpc
@output_dir("erpc_shim")
@types_header("rpc_system_header.h")
program rpc
@group("system")
interface rpc_system {