Skip to content

Commit

Permalink
Add rp2040-tiny, rework led code, rework some extras stuff
Browse files Browse the repository at this point in the history
  • Loading branch information
bill88t committed Jan 14, 2024
1 parent 1c97dfb commit 7f65f30
Show file tree
Hide file tree
Showing 68 changed files with 507 additions and 135 deletions.
5 changes: 3 additions & 2 deletions Boardfiles/Seeed_XIAO_nRF52840_Sense/boot.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
01-early-connection.py
02-path.py
04-advance-time.lja
06-reload-hostname.py
03-LEDs.py
05-reload-hostname.py
06-advance-time.lja
Empty file.
Empty file.
9 changes: 5 additions & 4 deletions Boardfiles/adafruit_feather_esp32s2/boot.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
01-early-connection.py
02-path.py
03-wifi.py
04-advance-time.lja
05-telnet.lja
06-reload-hostname.py
03-LEDs.py
04-wifi.py
05-reload-hostname.py
06-advance-time.lja
50-telnet.lja
Empty file.
Empty file.
9 changes: 5 additions & 4 deletions Boardfiles/adafruit_feather_esp32s3_tft/boot.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
01-early-connection.py
02-path.py
03-wifi.py
04-advance-time.lja
05-telnet.lja
06-reload-hostname.py
03-LEDs.py
04-wifi.py
06-advance-time.lja
50-telnet.lja
05-reload-hostname.py
Empty file.
Empty file.
5 changes: 3 additions & 2 deletions Boardfiles/adafruit_kb2040/boot.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
01-early-connection.py
02-path.py
04-advance-time.lja
06-reload-hostname.py
03-LEDs.py
06-advance-time.lja
05-reload-hostname.py
Empty file.
11 changes: 6 additions & 5 deletions Boardfiles/beetle-esp32-c3/boot.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
00-no-dmesg.lja
01-early-connection.py
02-path.py
03-wifi.py
04-advance-time.lja
05-telnet.lja
06-reload-hostname.py
07-no-dmesg.lja
03-LEDs.py
04-wifi.py
05-reload-hostname.py
06-advance-time.lja
50-telnet.lja
Empty file.
9 changes: 5 additions & 4 deletions Boardfiles/firebeetle2_esp32s3/boot.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
01-early-connection.py
02-path.py
03-wifi.py
04-advance-time.lja
05-telnet.lja
06-reload-hostname.py
03-LEDs.py
04-wifi.py
05-reload-hostname.py
06-advance-time.lja
50-telnet.lja
Empty file.
Empty file.
9 changes: 5 additions & 4 deletions Boardfiles/lolin_s2_mini/boot.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
01-early-connection.py
02-path.py
03-wifi.py
04-advance-time.lja
05-telnet.lja
06-reload-hostname.py
03-LEDs.py
04-wifi.py
05-reload-hostname.py
06-advance-time.lja
50-telnet.lja
Empty file.
9 changes: 5 additions & 4 deletions Boardfiles/m5stack_timer_camera_x/boot.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
01-early-connection.py
02-path.py
03-wifi.py
04-advance-time.lja
05-telnet.lja
06-reload-hostname.py
03-LEDs.py
04-wifi.py
05-reload-hostname.py
06-advance-time.lja
50-telnet.lja
Empty file.
5 changes: 3 additions & 2 deletions Boardfiles/pimoroni_picolipo_16mb/boot.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
01-early-connection.py
02-path.py
04-advance-time.lja
06-reload-hostname.py
03-LEDs.py
05-reload-hostname.py
06-advance-time.lja
Empty file.
5 changes: 3 additions & 2 deletions Boardfiles/pimoroni_picolipo_4mb/boot.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
01-early-connection.py
02-path.py
04-advance-time.lja
06-reload-hostname.py
03-LEDs.py
05-reload-hostname.py
06-advance-time.lja
Empty file.
5 changes: 3 additions & 2 deletions Boardfiles/raspberry_pi_pico/boot.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
01-early-connection.py
02-path.py
04-advance-time.lja
06-reload-hostname.py
03-LEDs.py
05-reload-hostname.py
06-advance-time.lja
Empty file.
11 changes: 6 additions & 5 deletions Boardfiles/raspberry_pi_pico_w/boot.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
00-no-dmesg.lja
01-early-connection.py
02-path.py
03-wifi.py
04-advance-time.lja
05-telnet.lja
06-reload-hostname.py
07-no-dmesg.lja
03-LEDs.py
04-wifi.py
05-reload-hostname.py
06-advance-time.lja
50-telnet.lja
Empty file.
9 changes: 5 additions & 4 deletions Boardfiles/waveshare_esp32s2_pico/boot.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
01-early-connection.py
02-path.py
03-wifi.py
04-advance-time.lja
05-telnet.lja
06-reload-hostname.py
03-LEDs.py
04-wifi.py
05-reload-hostname.py
06-advance-time.lja
50-telnet.lja
Empty file.
Empty file.
5 changes: 5 additions & 0 deletions Boardfiles/waveshare_rp2040_tiny/boot.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
01-early-connection.py
02-path.py
03-LEDs.py
05-reload-hostname.py
06-advance-time.lja
Empty file.
Empty file.
25 changes: 25 additions & 0 deletions Boardfiles/waveshare_rp2040_tiny/pinout.map
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
,----.....----.
[ | ] 5V (32) |o5V ````` o| (0) GP0 [SPI0 RX |I2C0 SDA|UART0 TX]
[ | ] GND (31) |o usbC o| (1) GP1 [SPI0 CSn|I2C0 SCL|UART0 RX]
[ | ] 3V3 (30) |oRP2040-Tinyo| (2) GP2 [SPI0 SCK|I2C1 SDA| ]
[ | ADC3 ] GP29 (29) |o o| (3) GP3 [SPI0 TX |I2C1 SCL| ]
[ | ADC2 ] GP28 (28) |o . o| (4) GP4 [SPI0 RX |I2C0 SDA|UART1 TX]
[I2C1 SCL| ADC1 ] GP27 (27) |o / \ o| (5) GP5 [SPI0 CSn|I2C0 SCL|UART1 RX]
[I2C1 SDA| ADC0 ] GP26 (26) |o \ / o| (6) GP6 [SPI0 SCK|I2C1 SDA| ]
[I2C1 SCL|SPI1 TX ] GP15 (25) |o ` L o| (7) GP7 [SPI0 TX |I2C1 SCL| ]
[I2C1 SDA|SPI1 CLK] GP14 (24) |o o o o o o o| (8) GP8 [SPI1 RX |I2C0 SDA|UART1 TX]
`-------------'
| | | | |
,----------------. | | | \ `-- (9) GP9 [SPI1 CSn|I2C1 SCL|UART1 RX]
/ LED used pin \ | | \ `--- (10) GP10 [SPI1 SCK|I2C1 SDA| ]
| | | \ `----- (11) GP11 [SPI1 TX |I2C1 SCL| ]
\ [ GP16 | DIN ] / \ `------- (12) GP12 [SPI1 RX |I2C0 SDA|UART0 TX]
`----------------' `--------- (13) GP13 [SPI1 CSn|I2C0 SCL|UART0 RX]

Waveshare RP2040-Tiny

SoC : RP2040
RAM : 264KB
Storage : SQPI (2MB)
Wi-fi : False
Bluetooth : False
45 changes: 45 additions & 0 deletions Boardfiles/waveshare_rp2040_tiny/pintab.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
from board import (
GP0,
GP1,
GP2,
GP3,
GP4,
GP5,
GP6,
GP7,
GP8,
GP9,
GP10,
GP11,
GP12,
GP13,
GP14,
GP15,
GP16,
GP26,
GP27,
GP28,
)

pintab = {
0: GP0,
1: GP1,
2: GP2,
3: GP3,
4: GP4,
5: GP5,
6: GP6,
7: GP7,
8: GP8,
9: GP9,
10: GP10,
11: GP11,
12: GP12,
13: GP13,
14: GP14,
15: GP15,
16: GP16,
26: GP26,
27: GP27,
28: GP28,
}
28 changes: 28 additions & 0 deletions Boardfiles/waveshare_rp2040_tiny/settings.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
CIRCUITPY_PYSTACK_SIZE = 4608

[LJINUX]
setup = true

fs_label = "LJINUX"

serial_console_enabled = true
usb_msc_available = true
usb_hid_available = true
usb_midi_available = true
wifi_available = false
ble_available = false
blc_available = false
usb_msc_enabled = false
usb_hid_enabled = false
usb_midi_enabled = false

leden = -1
ledtype = "neopixel_invert"
led = 16

DEBUG = false

root_SCLK = -1
root_SCSn = -1
root_MOSI = -1
root_MISO = -1
5 changes: 3 additions & 2 deletions Boardfiles/waveshare_rp2040_zero/boot.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
01-early-connection.py
02-path.py
04-advance-time.lja
06-reload-hostname.py
03-LEDs.py
05-reload-hostname.py
06-advance-time.lja
Empty file.
Empty file.
11 changes: 6 additions & 5 deletions Boardfiles/weact_esp32c6_n4/boot.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
00-no-dmesg.lja
01-early-connection.py
02-path.py
03-wifi.py
04-advance-time.lja
05-telnet.lja
06-reload-hostname.py
07-no-dmesg.lja
03-LEDs.py
04-wifi.py
06-advance-time.lja
50-telnet.lja
05-reload-hostname.py
Empty file.
Empty file.
11 changes: 6 additions & 5 deletions Boardfiles/weact_esp32c6_n8/boot.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
00-no-dmesg.lja
01-early-connection.py
02-path.py
03-wifi.py
04-advance-time.lja
05-telnet.lja
06-reload-hostname.py
07-no-dmesg.lja
03-LEDs.py
04-wifi.py
05-reload-hostname.py
06-advance-time.lja
50-telnet.lja
Empty file.
Empty file.
9 changes: 5 additions & 4 deletions Boardfiles/yd_esp32_s3_n16r8/boot.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
01-early-connection.py
02-path.py
03-wifi.py
04-advance-time.lja
05-telnet.lja
06-reload-hostname.py
03-LEDs.py
04-wifi.py
05-reload-hostname.py
06-advance-time.lja
50-telnet.lja
Empty file.
Empty file.
9 changes: 5 additions & 4 deletions Boardfiles/yd_esp32_s3_n8r8/boot.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
01-early-connection.py
02-path.py
03-wifi.py
04-advance-time.lja
05-telnet.lja
06-reload-hostname.py
03-LEDs.py
04-wifi.py
05-reload-hostname.py
06-advance-time.lja
50-telnet.lja
Empty file.
Empty file.
File renamed without changes.
13 changes: 13 additions & 0 deletions bootcfg/boot.d/03-LEDs.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
systemprints(2, "Setting up LEDs")
ljinux.based.run("modprobe " + ljinux.io.ledtype)
if ljinux.io.ledtype in ljinux.modules:
if ljinux.io.ledtype.startswith("rgb"):
ljinux.modules[ljinux.io.ledtype].setup(
ljinux.io.led, ljinux.io.ledg, ljinux.io.ledb
)
else:
ljinux.modules[ljinux.io.ledtype].setup(ljinux.io.led)
ljinux.io.led_setup = True
systemprints(1, "Setting up LEDs")
else:
systemprints(3, "Setting up LEDs")
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
35 changes: 35 additions & 0 deletions drivers/led_generic.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
class led_generic:
def __init__(self):
self._dg = None # digitalio object

def setup(self, dg) -> None:
if self._dg is not None:
return
self._dg = dg
self._dg.switch_to_output()
self._dg.value = 0

@property
def value(self):
if self._dg is None:
return
return self._dg.value

@value.setter
def value(self, value) -> None:
if self._dg is None:
return
if value in [None, False]:
value = 0
elif value is True:
value = 1
if isinstance(value, int):
self._dg.value = value not in [0, 3, 4, 5]
elif isinstance(value, tuple):
self._dg.value = sum(value)
else:
raise TypeError("Invalid led value type")

def deinit(self) -> None:
if self._dg is not None:
self._dg.deinit()
35 changes: 35 additions & 0 deletions drivers/led_generic_invert.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
class led_generic_invert:
def __init__(self):
self._dg = None # digitalio object

def setup(self, dg) -> None:
if self._dg is not None:
return
self._dg = dg
self._dg.switch_to_output()
self._dg.value = 1

@property
def value(self):
if self._dg is None:
return
return not self._dg.value

@value.setter
def value(self, value) -> None:
if self._dg is None:
return
if value in [None, False]:
value = 0
elif value is True:
value = 1
if isinstance(value, int) or value is None:
self._dg.value = value in [0, 3, 4, 5]
elif isinstance(value, tuple):
self._dg.value = not sum(value)
else:
raise TypeError("Invalid led value type")

def deinit(self) -> None:
if self._dg is not None:
self._dg.deinit()
Loading

0 comments on commit 7f65f30

Please sign in to comment.