conejoninja / gopherbadge

22 stars 8 forks source link

Gopher Badge

TinyGo powered badge in the shape of your favorite burrowing rodent, the mighty Go Gopher.

https://gopherbadge.com

How to install

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

make flash

otherwise run tinygo directly

tinygo flash -target gopher-badge .

Note: if you get a permision denied error; please, consult this page for possible solution. You many need to restart the computer; afterward to get the group to stick.

make flash-gopherconeu NAME="@_CONEJO" TITLEA1="Go compiler" TITLEA2="small places"

Add an new logo

const (
tinygoLogo         = "./cmd/assets/tinygo.jpg"
purpleHardwareLogo = "./cmd/assets/purpleHardware.jpg"
gopherconEU        = "./cmd/assets/gopherconeu.jpg"
gopherconIE        = "./cmd/assets/gopherconie.jpg"
gopherconUK        = "./cmd/assets/gopherconuk.jpg"
gopherconUS        = "./cmd/assets/gopherconus.jpg"
wasmio             = "./cmd/assets/wasmio.jpg"
)
func confs() map[string]string {
    return map[string]string{
        "tinygo":      tinygoLogo,
        "purple":      purpleHardwareLogo,
        "gopherconeu": gopherconEU,
        "gopherconie": gopherconIE,
        "gopherconuk": gopherconUK,
        "gopherconus": gopherconUS,
        "wasmio":      wasmio,
    }
}

Add a new target to the Makefile:

flash-yourconf:
    go run cmd/main.go -conf=flagLogo
    tinygo flash -target gopher-badge .

You can run:

make flash-yourconf

It will store the data in logo.bin file that will be embedded into the code.

//go:embed logo.bin
var badgeLogo string

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

👏 Congratulations! It is now your own customized Gopher Badge.

Not powering up with battery connected

If your battery is connected and switching your badge to ON doesn't power it up, disconnect your battery, switch to ON and connect your battery again. If it doesn't power up, then check the battery charge.