mrwormhole / gobadge

Custom TinyGo powered badge :battery:
GNU General Public License v2.0
0 stars 0 forks source link
adafruit pybadge tinygo

GoBadge

My custom conference badge powered by TinyGo on top of Adafruit hardware (EdgeBadge)

Important, in this fork, pressing "START" takes to main menu while "SELECT" directs to other apps. The main tinygo/gobadge repository uses the opposite.

MyCustomBadge

Compilation

If you are running Mac or Linux, or have task installed you can run the following:

task flash

otherwise run tinygo directly

tinygo flash -target pybadge .
task flash NAME="@TinyGolang" SLOGAN1="Go compiler" SLOGAN2="small places"

Custom Logo

const (
    gcuk22Logo = "./cmd/assets/gopherconuk-2022.jpg"
    yourPathLogoHere = "./your/path/to/the/logo"
)
func confs() map[string]string {
    return map[string]string{
        "gcuk22"    : gopherconUK22Logo,
        "customLogo"  : yourPathLogoHere,
    }
}

Add a new target to the Taskfile:

go run cmd/main.go -conf=customLogo
tinygo flash -target pybadge .

You can run:

task flash CONF=customLogo

It will use cmd/logos/logo-template.txt to generate the image into a []color.RGBA. Then it is stored in variable in logo.go file.

package main

import "image/color"

var logoRGBA = []color.RGBA{ {255, 255, 255} }

After the image has been generated, the task command will flash it to the board.