Skip to content

Commit 1869b62

Browse files
committed
googly eye SW update
1 parent 65d011c commit 1869b62

File tree

4 files changed

+89
-17
lines changed

4 files changed

+89
-17
lines changed

thinkl33t/googly-eye-hexpansion/README.md

+6-9
Original file line numberDiff line numberDiff line change
@@ -14,15 +14,12 @@ And here's a render!
1414

1515
## Some Code!
1616

17-
You can output to the LEDs from an app using the HS_F pin:
17+
For the firmware running on the hexpansion, have a look at `app.py`
1818

19-
```python
20-
import neopixel
19+
To flash this, have mpremote open, make sure you have a checkout of
20+
`badge-2024-software` and replace the `prepare_eeprom.py` in modules/scripts/
21+
with the one from here, then run the following:
2122

22-
np = neopixel.NeoPixel(hexpansion.HS_F, 2)
23-
np[0] = (255,0,0)
24-
np[1] = (255,0,0)
25-
np.write()
2623
```
27-
28-
Note i pretty much made up how talking to the pins works, as the firmware isn't that complete yet!
24+
mpremote mount modules + run modules/scripts/prepare_eeprom.py + cp ../badge-2024-addons/thinkl33t/googly-eye-hexpansion/firmware/app.py :/eeprom/app.py + reset
25+
```
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
from app import App
2+
from neopixel import NeoPixel
3+
from tildagonos import tildagonos
4+
from system.scheduler import scheduler
5+
import asyncio
6+
7+
class GooglyEyeApp(App):
8+
def __init__(self, config):
9+
self._n = NeoPixel(config.pin[0], 2)
10+
self._port = config.port
11+
self._fps = 5
12+
for a in scheduler.apps:
13+
if 'PatternDisplay' == a.__class__.__name__:
14+
self._fps = a._p.fps
15+
16+
async def background_task(self):
17+
while True:
18+
self._n[1] = tildagonos.leds[(2*self._port)-1]
19+
self._n[0] = tildagonos.leds[2*self._port]
20+
self._n.write()
21+
await asyncio.sleep(1 / self._fps)
22+
23+
24+
__app_export__ = GooglyEyeApp
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
from machine import I2C
2+
from system.hexpansion.header import HexpansionHeader, write_header
3+
from system.hexpansion.util import (
4+
detect_eeprom_addr,
5+
get_hexpansion_block_devices,
6+
read_hexpansion_header,
7+
)
8+
import vfs
9+
10+
# Need to init this to make sure i2c works
11+
12+
# Set up i2c
13+
port = 2 # <<-- Customize!!
14+
i2c = I2C(port)
15+
16+
# autodetect eeprom address
17+
addr = detect_eeprom_addr(i2c)
18+
print(f"Detected eeprom at {hex(addr)}")
19+
20+
# Fill in your desired header info here:
21+
header = HexpansionHeader(
22+
manifest_version="2024",
23+
fs_offset=32,
24+
eeprom_page_size=32,
25+
eeprom_total_size=1024 * 8,
26+
vid=0xF055,
27+
pid=0x9009,
28+
unique_id=0x0,
29+
friendly_name="GooglyEye",
30+
)
31+
32+
# Determine amount of bytes in internal address
33+
addr_len = 2 if header.eeprom_total_size > 256 else 1
34+
print(f"Using {addr_len} bytes for eeprom internal address")
35+
36+
# Write and read back header
37+
i2c.writeto(addr, bytes([0, 0]) + header.to_bytes())
38+
header = read_hexpansion_header(i2c, addr, set_read_addr=True, addr_len=addr_len)
39+
40+
if header is None:
41+
raise RuntimeError("Failed to read back hexpansion header")
42+
43+
# Get block devices
44+
eep, partition = get_hexpansion_block_devices(i2c, header, addr)
45+
46+
# Format
47+
vfs.VfsLfs2.mkfs(partition)
48+
49+
# And mount!
50+
vfs.mount(partition, "/eeprom")

thinkl33t/googly-eye-hexpansion/googly-eye-hexpansion.kicad_pro

+9-8
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,14 @@
66
"apply_defaults_to_fp_fields": false,
77
"apply_defaults_to_fp_shapes": false,
88
"apply_defaults_to_fp_text": false,
9-
"board_outline_line_width": 0.09999999999999999,
10-
"copper_line_width": 0.19999999999999998,
9+
"board_outline_line_width": 0.1,
10+
"copper_line_width": 0.2,
1111
"copper_text_italic": false,
1212
"copper_text_size_h": 1.5,
1313
"copper_text_size_v": 1.5,
1414
"copper_text_thickness": 0.3,
1515
"copper_text_upright": false,
16-
"courtyard_line_width": 0.049999999999999996,
16+
"courtyard_line_width": 0.05,
1717
"dimension_precision": 4,
1818
"dimension_units": 3,
1919
"dimensions": {
@@ -24,7 +24,7 @@
2424
"text_position": 0,
2525
"units_format": 1
2626
},
27-
"fab_line_width": 0.09999999999999999,
27+
"fab_line_width": 0.1,
2828
"fab_text_italic": false,
2929
"fab_text_size_h": 1.0,
3030
"fab_text_size_v": 1.0,
@@ -73,6 +73,7 @@
7373
"footprint_type_mismatch": "ignore",
7474
"hole_clearance": "error",
7575
"hole_near_hole": "error",
76+
"holes_co_located": "warning",
7677
"invalid_outline": "error",
7778
"isolated_copper": "warning",
7879
"item_on_disabled_layer": "error",
@@ -114,15 +115,15 @@
114115
"min_copper_edge_clearance": 0.0,
115116
"min_hole_clearance": 0.25,
116117
"min_hole_to_hole": 0.25,
117-
"min_microvia_diameter": 0.19999999999999998,
118-
"min_microvia_drill": 0.09999999999999999,
118+
"min_microvia_diameter": 0.2,
119+
"min_microvia_drill": 0.1,
119120
"min_resolved_spokes": 2,
120121
"min_silk_clearance": 0.0,
121-
"min_text_height": 0.7999999999999999,
122+
"min_text_height": 0.8,
122123
"min_text_thickness": 0.08,
123124
"min_through_hole_diameter": 0.3,
124125
"min_track_width": 0.0,
125-
"min_via_annular_width": 0.09999999999999999,
126+
"min_via_annular_width": 0.1,
126127
"min_via_diameter": 0.5,
127128
"solder_mask_clearance": 0.0,
128129
"solder_mask_min_width": 0.0,

0 commit comments

Comments
 (0)