-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 762bc01
Showing
215 changed files
with
123,679 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
* text=auto | ||
*.c text | ||
*.h text | ||
*.sch text | ||
*.kicad_pcb text | ||
*.kicad_mod text |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
[submodule "firmware/esp-idf"] | ||
path = firmware/esp-idf | ||
url = https://github.com/espressif/esp-idf.git | ||
branch = release/v3.0 | ||
[submodule "firmware/esp32/components/micropython/micropython"] | ||
path = firmware/esp32/components/micropython/micropython | ||
url = [email protected]:supersat/micropython-cpv2018.git | ||
[submodule "firmware/esp32/components/micropython/micropython-lib"] | ||
path = firmware/esp32/components/micropython/micropython-lib | ||
url = https://github.com/micropython/micropython-lib.git |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
# badge2018 | ||
|
||
To buld the ESP32 firmware: | ||
|
||
1. Install the ESP32 toolchain for your OS. You do not need to install the ESP-IDF -- that happens automatically in the next step. | ||
* For Linux: https://esp-idf.readthedocs.io/en/v3.1-beta1/get-started/linux-setup.html | ||
* For Windows: https://esp-idf.readthedocs.io/en/v3.1-beta1/get-started/windows-setup.html | ||
* For OSX: https://esp-idf.readthedocs.io/en/v3.1-beta1/get-started/macos-setup.html | ||
|
||
2. Pull in the ESP-IDF, MicroPython, and other dependencies: | ||
`git submodule update --init --recursive` | ||
|
||
3. Build mpy_cross: | ||
`cd firmware/esp32/components/micropython/micropython/mpy-cross/ && make && cd ../../../..` | ||
|
||
4. Optionally configure the serial port that your badge appears on (under Serial Flasher Config): | ||
`make menuconfig` | ||
|
||
5. Build it: | ||
`make -j5` | ||
|
||
6. Flash it: | ||
`make flash` | ||
|
||
The EFM8 firmware has only been built inside Simplicity Studio. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
#!/bin/sh | ||
|
||
git submodule update --init --recursive | ||
cd firmware/esp32/components/micropython/micropython/mpy-cross | ||
make | ||
cd ../../../.. | ||
make | ||
|
||
|
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
F���+��N$��%;��G���+��U&��)z�_L���+��G#��)��@L���;��!Q����CF���+��Q%��)~�^H���,��E!��,��EJ���4��!M����ER��|Z��"e����CF���+��@"��/��;I���4��!R�� ��HC���Z��"d����E��Khc��!b����CF���6��#U��&��,B���a��"c��"��?��Klf��!a����G��Mjb��!b����DH���d��#~�L ��+��Orj��"`��%��+��Ond��!a����=��Mjb��!b����F��MO���.��;/��(��Svi�� r�Q��,��Ond��"`��$��.��Mjb��!c����:��/7���7��</��(��SVy��,��>/��(��Ptf��s�O��/��Mkb��"`�� ��/��$L���5��</��(��.4���7��>.��(��SR{��.��@2��,��Npb��x�Q!��1��#J���6��</��(��$N���6��>/��)��*<���8��B0��/��PJ|��2��67��'��#J���5��</��(��#L���6��A0��.��&S���7��9-��*��*A���H��d�t��#J���5��>0��-��#L���6��8,��,��%O���?��_�y��*d�xci��"z�v��#J���?�� h�u#��$Ṫfp��"x��#��.��9Uz�� v�{�� ��>Su��!w�v��$Y�~is��&��C(��/��<Z�� v�"��"��?Vy�� v�~�{��>Su��!w�v��/��;D���6��0@��%��A]~��"��G ����?Wy��!u�~ �|��>Tu��!w�y��+��,B���D��2@��$��AF���4��3?����@[z��!��D!�|��>Tv��"u�w�11�[�w�B��2@�i"��%_�v�D��3>��&��(F�I��5>�}��>;���;��0H�3<��[�w�B��2@�3.��\�z�D��5?�f"��(e�|�F��1=��#��(Lė�V��%y�3:��[�w�B��3@�5:��\�{�E��0<�43��!_̅�M��#u�_ ��-~�bOx��+��3:�[�x�C��.>�59��]Ɓ�K��#{�7<��#n�pPx��+��64��*��-D���*��3;� q�eS���.��88��,��.N���)��'K�u��1J���*��%��c��0G���*��68��*��.C���B��&L�v ��3P���)��$��g��0J���)��(��d��0G���*��$S�w%��*T�|~V��$��l!��2@���?��(��h��1N���(��(��d��0H���)��(��O%��%u�\U��'��p$��)NƂ�Y��'��i��1<�¿C��(��d��0K���(��N��'Q��q�aU��1��'<��s�c�W��(��U��)}�d�Z��(��h��']�~~eƎS��&O��q�bU��O��'O��s�d�X��1��(B��w�l�\��)��O��.��NA���R��&O��q�b�U��U��&L��t�h�Z��S��(P��!��Y>���3��*C��(��%@���R��&N��q�f�Y��T��'M����V<�јX��)J��(��$C���X��#k�]��'C���R��(L��%��(K���U��_�b��*J��vl��&��Q#��&E��:���,��N"��%C���R��f�c!��,v�_rn��'��T&��(B��9���,��Q#��'G��G���+��N"��%D��kp��+��A,��'��>?���,��W'��*o�cI���+��R$��&>��E���+��N"��&E��B���<��!R����DM���,��G$��)��@G���*��U&��)z�^E���+��O#��%;����Lhc��!c����DC���[��"d����EJ���4��!S�� ��IE���,��@!��.��;��Nka��!c����E��Klf��!a����GB���a��"d��"��?E���6��#T��$��+��Nka��!c����G��Ond��!a����=��Mqj��"_��$��+G���e��#}�M��*��Nka��!c����;��One��"`��#��.��Swh�� q�Q��,��MO���.��;.��'��Oqa��x�Q"��2��SSz��.��@1��,��.4���7��>.��(��#L���6��<.��'��PL{��1��59��(��*=���8��B1��0��$N���6��>/��)��"I���6��<.��'��+A���H��e�s��'R���7��9.��*��#L���6��A0��.��"I���6��=.��'��+f�xci��"{�u��%O���@��`�y��#L���6��8,��,��"I���5��>/��,��!��?Tu��!x�v��.��9Tz�� v�{��$Ṫeq��"x��#��"J���@�� g�v"�z��?Tu��!x�v��"��?Vy�� v�~��/��:Y��� u��!��#X�|ht��'��C&�{��?Tu��!x�x����?Wy��!u�~ ��&��B^}��"��G ��.��:D���6��1?�{��?Tu��!v�w����@[z��!��E!��$��BF���4��3?��*��+A���D��2?�|��?<���:��/J��&��(F�H��5?�i"��&_�w�D��3>�20��Z�v�C��2?��$��)Lę�V��${�f!��)d�}�F��1>�3.��\�z�D��5?�3;��Z�v�C��2?�_ ��.�bOx��*��52��!`̃�M��#v�5:��\�|�E��0<�3:��Z�v�C��3?�55��+��-D���)��7<��#o�oOx��+��59��]Ɓ�K��#|�3:��Z�w�C��.=�$��b��1H���)��(L�u��1J���*��88��,��-M���)��4:�p�cR���.��(��d��1H���)��$��g��0J���*��%M�v!��4P���(��67��)��.C���B��(��d��1H���)��(��h��1N���(��$��l!��2@���>��$R�w$��)R�|~V��(��d��1L���(��'��i��1<�¿C��(��p#��)MƂ�Y��(��O#��$t�[~U��'��h ��(]π~e��(��U��)|�e�Z��0��'<��s�d�W��N��'P�p�`~U��(��O��/��NA���1��(A��w�j�]ŠO��'O��s�d�X��S��&N�q�aU��2��*C��)��&A���S��(O��"��X>�˓U��&L��t�h�Z��R��&N��q�a�U��W��#m�\��(D���W��)K��)��$C���T��&M����V;�ҏR��'N��p�eY�:���,��N#��'D��ul��&��P#��&E���U��`�a��*J���R��(K��$��'J��G���+��N#��&E��9���,��Q#��'G��qn��'��T'��(A���R��e�c!��+u�_F���+��N#��'F��I���+��R$��&>��>���,��W'��*o�diq��+��A+��&��> |
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
# Bling emulator | ||
|
||
This is a bling emulator that renders the effect of playing a .RAW animation and a .RGB LED bling file on a badge. It was specifically written for the Trans-Ionospheric badge but should be adaptable to other badges which use the same base platform (which is the AND!XOR DC25 Bender Badge). TO do that you'll need to change the configuration that's defined at the top of the source file. | ||
|
||
The emulator does not emulate the menu system or bling previews. | ||
|
||
``` | ||
Usage: | ||
renderbling -master=<filename> -bling=<filename> -rgb=<filename> -out=<filename> [-frames=<numframes>] | ||
Where: master = filename for background image in .RAW format [REQUIRED] | ||
bling = filename for LCD animation in .RAW format [OPTIONAL] | ||
rgb = filename for LED bling in .RGB format [REQUIRED] | ||
out = output filename [REQUIRED] | ||
frames = number of frames to render (defaults to 200) | ||
``` | ||
# Example usage | ||
|
||
``` | ||
go run renderbling.go -master=CPV.RAW -rgb=BOUNCE.RGB -out=OUTPUT.RAW | ||
``` | ||
|
||
To view the output: | ||
``` | ||
./playbadge ./OUTPUT.RAW | ||
``` | ||
|
||
# To customize this for other badges | ||
|
||
Create a single frame .RAW image of the badge, at 100 Pixels/Inch scale | ||
Determine the x,y values for the upper left origin of the LCD display within that image. | ||
|
||
Determine the x,y values for the center of each LED on the badge, in the order that they are serially wired | ||
|
||
Update the source code with these values. | ||
|
||
You'll also need to change the playbadge script to the new dimensions of the master file. | ||
|
||
To generate background raw image with ffmpeg/avconv: | ||
``` | ||
avconv -i trans-ionospheric_proto_front.png -vcodec rawvideo -f rawvideo -pix_fmt rgb565be TIBASE.RAW | ||
``` |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
#!/bin/sh | ||
|
||
EXPECTED_ARGS=1 | ||
E_BADARGS=65 | ||
|
||
if [ $# -ne $EXPECTED_ARGS ] | ||
then | ||
echo "Usage: `basename $0` gifinputfile rawoutputfile" | ||
exit $E_BADARGS | ||
fi | ||
ffplay -f rawvideo -pixel_format rgb565be -video_size 520x565 -framerate 22 $1 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,259 @@ | ||
package main | ||
|
||
import ( | ||
"encoding/binary" | ||
"flag" | ||
"fmt" | ||
"io" | ||
"log" | ||
"os" | ||
"path/filepath" | ||
) | ||
|
||
/* | ||
* Lots of things are hard coded, since it's assumed that this will be converted for use per-badge. | ||
* This assumes a 128x128 pixel LED display, the same as on the Bender, Joco, and Trans-Ionospheric badges | ||
*/ | ||
|
||
/* The size of the master badge image */ | ||
const masterxsz = 520 | ||
const masterysz = 565 | ||
|
||
/* | ||
* This is an attempt to abstract the LCD bling display size, but it's only ever been tested with | ||
* 128x128 pixels | ||
*/ | ||
const anixsz = 128 | ||
const aniysz = 128 | ||
|
||
/* Location of the 128x128 LCD display within the master image */ | ||
const lcdorgx = 200 | ||
const lcdorgy = 200 | ||
|
||
/* LED Locations */ | ||
type location struct { | ||
x uint | ||
y uint | ||
} | ||
|
||
/* | ||
* Locations of the RGB LEDs | ||
* | ||
* These are the locations of the center of each of the LEDs on the badge, | ||
* mapped to the order that they appear in the .RGB file | ||
*/ | ||
var ll = []location{ | ||
location{x: 180, y: 84}, /* 0 */ | ||
location{x: 220, y: 84}, /* 1 */ | ||
location{x: 260, y: 107}, /* 2 */ | ||
location{x: 300, y: 84}, /* 3 */ | ||
location{x: 338, y: 84}, /* 4 */ | ||
location{x: 260, y: 144}, /* 5 */ | ||
location{x: 260, y: 175}, /* 6 */ | ||
location{x: 260, y: 210}, /* 7 */ | ||
location{x: 260, y: 250}, /* 8 */ | ||
location{x: 190, y: 250}, /* 9 */ | ||
location{x: 325, y: 250}, /* 10 */ | ||
location{x: 63, y: 357}, /* 11 */ | ||
location{x: 40, y: 324}, /* 12 */ | ||
location{x: 475, y: 325}, /* 13 */ | ||
location{x: 400, y: 460}, /* 14 */ | ||
location{x: 416, y: 382}, /* 15 */ | ||
location{x: 457, y: 361}, /* 16 */ | ||
location{x: 418, y: 427}, /* 17 */ | ||
location{x: 388, y: 366}, /* 18 */ | ||
location{x: 358, y: 348}, /* 19 */ | ||
location{x: 328, y: 328}, /* 20 */ | ||
location{x: 293, y: 309}, /* 21 */ | ||
location{x: 260, y: 289}, /* 22 */ | ||
location{x: 259, y: 372}, /* 23 */ | ||
location{x: 225, y: 309}, /* 24 */ | ||
location{x: 190, y: 329}, /* 25 */ | ||
location{x: 160, y: 348}, /* 26 */ | ||
location{x: 131, y: 364}, /* 27 */ | ||
location{x: 100, y: 382}, /* 28 */ | ||
location{x: 121, y: 460}, /* 29 */ | ||
location{x: 102, y: 425}, /* 30 */ | ||
} | ||
|
||
/* | ||
* The number of bytes in an LED frame in the .RGB files. | ||
* There are 3 bytes per LED for RGB. | ||
* For all the supported badges, the frame length is 60, even though | ||
* fewer than 20 LEDs are used. | ||
*/ | ||
const lflen = 120 | ||
|
||
/* The default number of frames to render */ | ||
const defframes = 200 | ||
|
||
/* End of customization */ | ||
|
||
/* | ||
We're converting from 8 bits per color to 565, so we shift | ||
to remove the low order bits | ||
*/ | ||
func rgb2pixel(r uint8, g uint8, b uint8) uint16 { | ||
var rt uint16 | ||
var gt uint16 | ||
var bt uint16 | ||
var all uint16 | ||
rt = uint16(r) >> 3 | ||
gt = uint16(g) >> 2 | ||
bt = uint16(b) >> 3 | ||
all = (rt << 11) | (gt << 5) | bt | ||
return (all) | ||
} | ||
|
||
func writepixel(x uint, y uint, value uint16, image [][]uint16) { | ||
image[x][y] = value | ||
} | ||
|
||
func readSome(f *os.File, len int) ([]uint16, error) { | ||
/* read a frame from the file. If we hit EOF, reset to start at beginning */ | ||
frame := make([]uint16, len) | ||
err := binary.Read(f, binary.BigEndian, frame) | ||
if err == io.EOF { | ||
_, err = f.Seek(0, 0) | ||
if err != nil { | ||
log.Fatal(err) | ||
} | ||
err = binary.Read(f, binary.BigEndian, frame) | ||
if err != nil { | ||
log.Fatal(err) | ||
} | ||
} | ||
return frame, err | ||
} | ||
|
||
func readRGB(f *os.File) ([]uint8, error) { | ||
frame := make([]byte, lflen) | ||
_, err := f.Read(frame) | ||
if err == io.EOF { | ||
_, err = f.Seek(0, 0) | ||
if err != nil { | ||
log.Fatal(err) | ||
} | ||
_, err = f.Read(frame) | ||
if err != nil { | ||
log.Fatal(err) | ||
} | ||
} | ||
return frame, err | ||
} | ||
|
||
func usage() { | ||
fmt.Printf("Usage:\n") | ||
fmt.Printf("%s -master=<filename> -bling=<filename> -rgb=<filename> -out=<filename> [-frames=<numframes>]\n\n", filepath.Base(os.Args[0])) | ||
fmt.Printf("Where: master = filename for background image in .RAW format [REQUIRED]\n") | ||
fmt.Printf(" bling = filename for LCD animation in .RAW format [REQUIRED]\n") | ||
fmt.Printf(" rgb = filename for LED bling in .RGB format [REQUIRED]\n") | ||
fmt.Printf(" out = output filename [REQUIRED]\n") | ||
fmt.Printf(" frames = number of frames to render (defaults to %d)\n", defframes) | ||
return | ||
} | ||
|
||
func main() { | ||
log.SetFlags(log.LstdFlags | log.Lshortfile) | ||
|
||
var masterimagefile = flag.String("master", "", "Master Image File for badge background") | ||
var blingfile = flag.String("bling", "", "Bling Animation to display in LCD panel") | ||
var rgbfile = flag.String("rgb", "", "LED .RGB file to use for LED displays") | ||
var outfilename = flag.String("out", "", "Output File Name") | ||
var numframes = flag.Int("frames", defframes, "Number of output frames to render") | ||
flag.Parse() | ||
var skiplcd = *blingfile == "" | ||
|
||
if *masterimagefile == "" || *rgbfile == "" || *outfilename == "" { | ||
usage() | ||
os.Exit(1) | ||
} | ||
|
||
|
||
masterimage := make([][]uint16, masterysz) | ||
for i := range masterimage { | ||
masterimage[i] = make([]uint16, masterxsz) | ||
} | ||
|
||
aniimage := make([][]uint16, aniysz) | ||
for i := range aniimage { | ||
aniimage[i] = make([]uint16, anixsz) | ||
} | ||
|
||
file, err := os.Open(*masterimagefile) | ||
defer file.Close() | ||
if err != nil { | ||
log.Fatal(err) | ||
} | ||
|
||
/* Read the master image */ | ||
for yp := 0; yp < masterysz; yp++ { | ||
for xp := 0; xp < masterxsz; xp++ { | ||
err := binary.Read(file, binary.BigEndian, &masterimage[yp][xp]) | ||
if err != nil { | ||
log.Println(err) | ||
break | ||
} | ||
} | ||
} | ||
|
||
/* Open the input LCD bling */ | ||
anifile, err := os.Open(*blingfile) | ||
defer anifile.Close() | ||
|
||
/* Open the LED RGB Bling */ | ||
rgbf, err := os.Open(*rgbfile) | ||
defer rgbf.Close() | ||
if err != nil { | ||
log.Fatal(err) | ||
} | ||
|
||
/* Open the output file */ | ||
outfile, err := os.Create(*outfilename) | ||
defer outfile.Close() | ||
if err != nil { | ||
log.Fatal(err) | ||
} | ||
|
||
for frame := 0; frame < *numframes; frame++ { | ||
if skiplcd == false { | ||
for row := 0; row < aniysz; row++ { | ||
rowdata, err := readSome(anifile, anixsz) | ||
if err != nil { | ||
log.Fatal(err) | ||
} | ||
for col, val := range rowdata { | ||
masterimage[row+lcdorgy][col+lcdorgx] = val | ||
} | ||
} | ||
} | ||
ledval, err := readRGB(rgbf) | ||
if err != nil { | ||
log.Fatal(err) | ||
} | ||
|
||
didx := 0 | ||
for _, pos := range ll { | ||
var red uint8 | ||
var green uint8 | ||
var blue uint8 | ||
red = ledval[didx] | ||
green = ledval[didx+1] | ||
blue = ledval[didx+2] | ||
pxval := rgb2pixel(red, green, blue) | ||
for x := pos.x - 7; x <= pos.x+7; x++ { | ||
for y := pos.y - 7; y <= pos.y+7; y++ { | ||
masterimage[y][x] = pxval | ||
} | ||
} | ||
didx += 3 | ||
} | ||
|
||
for y := 0; y < masterysz; y++ { | ||
err := binary.Write(outfile, binary.BigEndian, masterimage[y]) | ||
if err != nil { | ||
log.Fatal(err) | ||
} | ||
} | ||
} | ||
} |
Oops, something went wrong.