Skip to content

Instantly share code, notes, and snippets.

@sago35
sago35 / main.go
Created March 29, 2022 08:32
tinygo + bitmap
package main
import (
"fmt"
"image/color"
"strings"
"time"
"golang.org/x/image/bmp"
@sago35
sago35 / examples_rtl8720dn_version_wioterminal.go
Created February 26, 2022 07:29
TinyGo で rtl8720dn との UART を TX:BCM1 RX:BCM2 に出力する設定
//go:build wioterminal
// +build wioterminal
package main
import (
"device/sam"
"machine"
"runtime/interrupt"
"time"
@sago35
sago35 / copytext.ahk
Last active December 19, 2022 12:39
AutoHotkey を使って Adbe Acrobat Reader DC からのコピーの改行を翻訳用に調整する
;#IfWinActive Adobe Acrobat Reader DC
#IfWinActive Adobe Acrobat Reader (64-bit)
^c::
Send, ^c
ClipWait
x = %clipboard%
space := " "
StringReplace, x, x, .`r`n, .`r, All
StringReplace, x, x, :`r`n, :`r, All
StringReplace, x, x, `r`n, %space%, All
@sago35
sago35 / launch.json
Last active September 14, 2024 11:05
TinyGo + VSCode + Cortex-Debug for Wio Terminal (ATSAMD51P19A)
{
"version": "0.2.0",
"configurations": [
{
"type": "cortex-debug",
"servertype": "openocd",
"request": "launch",
"name": "tinygo-debug",
"runToEntryPoint": "main.main",
"executable": "${workspaceRoot}/out.elf",
@sago35
sago35 / tinygo_wioterminal_lcd_backlight.go
Created February 1, 2022 10:40
TinyGo + Wio Terminal + LCD_BACKLIGHT
package main
import (
"device/sam"
"log"
"machine"
"time"
)
func main() {
@sago35
sago35 / generic.go
Created December 20, 2021 00:35
tinygo (./examples/touch_paint) for https://github.com/sago35/tinydisplay/pull/2
//go:build !baremetal
// +build !baremetal
package main
import (
"image/color"
"image/png"
"log"
"os"
@sago35
sago35 / echo.go
Created October 5, 2021 21:16
TinyGo + XIAO + USBCDC + UART (D6/D7)
package main
import (
"machine"
"time"
)
var (
usbcdc = machine.USB
@sago35
sago35 / tinygo-qrcode.go
Created October 4, 2021 23:40
TinyGo with QR Code
package main
import (
"image/color"
"time"
"github.com/boombuler/barcode"
"github.com/boombuler/barcode/qr"
"tinygo.org/x/tinyfont"
"tinygo.org/x/tinyfont/freemono"
diff --git a/.vscode/settings.json b/.vscode/settings.json
new file mode 100644
index 0000000..a8e65e5
--- /dev/null
+++ b/.vscode/settings.json
@@ -0,0 +1,6 @@
+{
+ "go.toolsEnvVars": {
+ "GOROOT": "/home/tobias/.cache/tinygo/goroot-go1.16-65176e9981f9146086a1cca207bd1d47f4da8a15455d548a5d84fac12d1814d2-syscall",
+ "GOFLAGS": "-tags=arduino_nano33,atsamd21g18a,atsamd21g18,atsamd21,sam,cortexm,baremetal,linux,arm,tinygo,gc.conservative,scheduler.tasks"
@sago35
sago35 / tinygo_target.vim
Last active March 2, 2021 21:10
tinygo integration for vim
function! s:ChangeTinygoTargetTo(target)
let info = split(system('tinygo info -target ' . a:target), "\n")
for i in info
let data = split(i)
if len(data) > 2 && data[0] == "build" && data[1] == "tags:"
let s:goflags = "-tags=" . join(data[2:-1], ",")
elseif len(data) > 2 && data[0] == "cached" && data[1] == "GOROOT:"
let s:goroot = join(data[2:-1], ",")
endif
endfor