Skip to content

Commit dff7ec3

Browse files
committed
Merge branch 'main' of github.com:proveskit/CircuitPython_RP2040_v4 into beacon-ground-station-split
2 parents b30fae2 + 4fc060f commit dff7ec3

File tree

2 files changed

+102
-3
lines changed

2 files changed

+102
-3
lines changed

README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,11 @@
33
[![License](https://img.shields.io/badge/license-MIT-blue.svg)](LICENSE)
44
![CI](https://github.com/proveskit/CircuitPython_RP2040_v4/actions/workflows/ci.yaml/badge.svg)
55

6-
Software for the v4 PROVES Kit flight control board.
6+
This is the reference software for the v4x PROVES Kit Flight Controller boards. Clone this repository and use the `make install ...` tooling to get your v4x Flight Controller Board up and running!
77

88
# Development Getting Started
99
We welcome contributions, so please feel free to join us. If you have any questions about contributing please open an issue or a discussion.
1010

1111
You can find our Getting Started Guide [here](https://github.com/proveskit/pysquared/blob/main/docs/dev-guide.md).
12+
13+
If you have a mission specific usecase for the CircuitPython Flight Software you can fork this repo and use it as a baseline for developing your own system!

src/flight-software/repl.py

Lines changed: 99 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,107 @@
1+
"""
2+
Built for the PySquared FC Board V4x
3+
Published: May, 2025
4+
"""
5+
6+
import os
7+
import time
8+
9+
import digitalio
10+
from busio import SPI
11+
12+
try:
13+
from board_definitions import proveskit_rp2040_v4 as board
14+
except ImportError:
15+
import board
16+
117
from lib.proveskit_rp2040_v4.register import Register
18+
from lib.pysquared.beacon import Beacon
19+
from lib.pysquared.cdh import CommandDataHandler
220
from lib.pysquared.config.config import Config
21+
from lib.pysquared.hardware.busio import _spi_init, initialize_i2c_bus
22+
from lib.pysquared.hardware.digitalio import initialize_pin
23+
from lib.pysquared.hardware.imu.manager.lsm6dsox import LSM6DSOXManager
24+
from lib.pysquared.hardware.magnetometer.manager.lis2mdl import LIS2MDLManager
25+
from lib.pysquared.hardware.radio.manager.rfm9x import RFM9xManager
26+
from lib.pysquared.hardware.radio.packetizer.packet_manager import PacketManager
327
from lib.pysquared.logger import Logger
428
from lib.pysquared.nvm.counter import Counter
29+
from lib.pysquared.rtc.manager.microcontroller import MicrocontrollerManager
30+
from lib.pysquared.sleep_helper import SleepHelper
31+
from lib.pysquared.watchdog import Watchdog
32+
from version import __version__
33+
34+
boot_time: float = time.time()
35+
36+
rtc = MicrocontrollerManager()
37+
38+
(boot_count := Counter(index=Register.boot_count)).increment()
39+
error_count: Counter = Counter(index=Register.error_count)
540

641
logger: Logger = Logger(
7-
error_counter=Counter(index=Register.error_count),
42+
error_counter=error_count,
843
colorized=False,
944
)
10-
config: Config = Config("config.json")
45+
46+
logger.info(
47+
"Booting",
48+
hardware_version=os.uname().version,
49+
software_version=__version__,
50+
)
51+
52+
try:
53+
watchdog = Watchdog(logger, board.WDT_WDI)
54+
55+
logger.debug("Initializing Config")
56+
config: Config = Config("config.json")
57+
58+
# TODO(nateinaction): fix spi init
59+
spi0: SPI = _spi_init(
60+
logger,
61+
board.SPI0_SCK,
62+
board.SPI0_MOSI,
63+
board.SPI0_MISO,
64+
)
65+
66+
radio = RFM9xManager(
67+
logger,
68+
config.radio,
69+
spi0,
70+
initialize_pin(logger, board.SPI0_CS0, digitalio.Direction.OUTPUT, True),
71+
initialize_pin(logger, board.RF1_RST, digitalio.Direction.OUTPUT, True),
72+
)
73+
74+
packet_manager = PacketManager(
75+
logger,
76+
radio,
77+
config.radio.license,
78+
0.2,
79+
)
80+
81+
i2c1 = initialize_i2c_bus(
82+
logger,
83+
board.I2C1_SCL,
84+
board.I2C1_SDA,
85+
100000,
86+
)
87+
88+
magnetometer = LIS2MDLManager(logger, i2c1)
89+
90+
imu = LSM6DSOXManager(logger, i2c1, 0x6B)
91+
92+
sleep_helper = SleepHelper(logger, watchdog, config)
93+
94+
cdh = CommandDataHandler(logger, config, packet_manager)
95+
96+
beacon = Beacon(
97+
logger,
98+
config.cubesat_name,
99+
packet_manager,
100+
boot_time,
101+
imu,
102+
magnetometer,
103+
radio,
104+
)
105+
106+
except Exception as e:
107+
logger.critical("An exception occurred within repl.py", e)

0 commit comments

Comments
 (0)