Skip to content

Commit

Permalink
Merge branch 'main' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
hexagon5un authored Nov 3, 2024
2 parents 0a158bb + 09a3a9f commit 31b237a
Show file tree
Hide file tree
Showing 9 changed files with 568 additions and 4 deletions.
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,6 @@
[submodule "software/libraries/MicroPython-SSD1306"]
path = software/libraries/MicroPython-SSD1306
url = https://github.com/TimHanewich/MicroPython-SSD1306
[submodule "i2c_proto_petal_tutorial/pico_ch32v003_prog"]
path = i2c_proto_petal_tutorial/pico_ch32v003_prog
url = [email protected]:hexagon5un/pico_ch32v003_prog.git
4 changes: 3 additions & 1 deletion i2c-addresses.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,7 @@ If you have made an SAO that you are bringing, please add it to this list submit
| 0x12 | I2C Proto Badge (default) | In firmware, change to whatever | |
| 0x19 | Blinky Loop SAO | Can also use 0x18 | [hackaday.io](https://hackaday.io/project/198163-blinky-loop-sao) |
| 0x1A | Hack-Man SAO | See project for commands | [hackaday.io](https://hackaday.io/project/198301-hack-man-sao) |
| 0x54 | TouchwheelSAO | Can change addr in Arduino src | [hackaday.io](https://hackaday.io/project/199100-touchwheelsao) |
| 0x55 | Badge Tag NFC SAO | Can be changed in a register | [hackaday.io](https://hackaday.io/project/198165-badge-tag-nfc-sao) |

| 0x6C | duckGLOW SAO | Change to 0x6C-06F w/ solder jumpers | [hackaday.io](https://hackaday.io/project/198918-duckglow-sao) |
| 0x13 | Skull of Fate SAO | Can be changed. See doc. | [hackaday.io](https://hackaday.io/project/198974-skull-of-fate-sao) |
Binary file added i2c_proto_petal_tutorial/demo_binaries/blink.bin
Binary file not shown.
Binary file added i2c_proto_petal_tutorial/demo_binaries/blink2.bin
Binary file not shown.
1 change: 1 addition & 0 deletions i2c_proto_petal_tutorial/pico_ch32v003_prog
Submodule pico_ch32v003_prog added at b27aed
54 changes: 54 additions & 0 deletions software/badge_image/flash_badge.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
#!/usr/bin/env bash
# Mount Pico and copy firmware file

FIRMWARE=./supercon_image.uf2

# Function to execute on new device
new_device ()
{
# First save the device to variable
DEVICE=$(echo $1 | cut -d'/' -f3)

# Notify user
#echo "Found Device: $DEVICE"

# Create mount point if it doesn't exist
mkdir -p /mnt/$DEVICE

# Mount device
mount /dev/$DEVICE /mnt/$DEVICE

# Copy firmware
cp $FIRMWARE /mnt/$DEVICE/

# Attempt unmount to force write
echo -n "Copying firmware to $DEVICE ..."
umount /mnt/$DEVICE
echo "Done"

# Delete device node so we don't try to do it again
rm /dev/$DEVICE
}

# Must have root permission
if [ "$EUID" -ne 0 ]
then echo "Must run as root or via sudo"
exit
fi

# Start here
systemctl daemon-reload

echo "Looking for new devices..."
echo "Hold BOOTSEL for 5 seconds while plugging in."

# Loop through, looking for device files
while true
do
for I in `ls /dev/sd*1 2>/dev/null`
do new_device $I
done
sleep 5
done

# EOF
37 changes: 37 additions & 0 deletions software/libraries/Alpha_Petal/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# Alpha Petal

Displays a string on the SAO petal, one char at a time. the font is hand drawn and hard coded, crafted with love in the alley. The class needs to be initialized then can be passed a string consisting of [a-z] or space. There is no exception handling.


# Usage
### Initialization:
Initialize the class:
`ap = alpha_petal(petal_bus, PETAL_ADDRESS, time)`

### Functions
`set_slot(slot:int[1-6])` This wraps the `set_rotation` function allowing you to specify a slot on the badge. 1,2,5,6 are recommended.

`set_rotation(rotation:int[0-7])` This allows you to natively set the rotation, [0-7], 45* incriments

`rotate_string(string:string)` This displays a string, rotating 45* between each char

`disp_string(string:string)` This displays a string, should be called after `set_rotation` or `set_slot`

`petal_letter_reset()` This is used internally to wipe letters

`petal_char(char:char)` This is used internally to display a single char and then wipe it away

`touchwheel_string(disp_str:string, touchwheel_bus:bus)` This displays a string which can be rotated with the touchwheel.

### Usage
#### To just display text:

`set_rotation(0) #not strictly needed, but it's best to clean up`

`disp_string('your string ') #the trailing space is important to delinate between the trailing 'g' and leading 'y'`

#### Display text that rotates:

Automatically: `rotate_string('your string ')`

Based on touchwheel: `touchwheel_string('your string ', touchwheel_bus)`
Loading

0 comments on commit 31b237a

Please sign in to comment.