The RP2040 example files are a great start. I simply used the templated and moved from there.
Some of the changes I did to it:
- GPIO writes now map each bit to the intended pin (bit 3 no longer toggles pin 0), fixing incorrect patterns when writing full bytes to multiple pins. See write(_:to:) in Sources/RP2040/HAL/Digital.swift.
- setMode configures pads for inputs (with optional pull-up/down) and outputs with selectable drive strengths, ensuring pins are put in a safe, explicit state before use. The new cases set pulls, input/output enables, slew rate, and drive strength in Sources/RP2040/HAL/Digital.swift:
public func setMode(_ mode: PinMode, pin: some DigitalPin) {
hardware.ioBank0.gpioControl\[idx\].modify { $0.functionSelection = .sio0 }
switch mode {
case .inputPullup: hardware.padsBank0.gpio[idx].modify { $0.pullUpEnable = true; $0.outputDisable = true }
case .output8mA: hardware.padsBank0.gpio[idx].modify { $0.outputDisable = false; $0.driveStrength = .level8mA }
// …other input/output variants
}
}
- Added digitalRead and the underlying SIO gpioIn accessor so firmware can read logic levels from GPIOs instead of only driving them. References: Sources/RP2040/HAL/Digital.swift and Sources/RP2040/Hardware/SIO.swift.
public var gpioIn: UInt32 {
RP2040Hardware.read(UInt32.self, from: unsafeAddress, offset: 0x0004)
}
public func digitalRead(pin: some DigitalPin) -> Bool {
((hardware.sio.gpioIn >> pin.rawValue) & 1) != 0
}
- The monotonic timer (now) is public and sleep(forMilliseconds:) now delegates to the microsecond sleep helper, giving more accurate, timer-based delays than the previous fixed loop. See Sources/RP2040/HAL/Time.swift:
public var now: UInt64 { /* awh/awl latch */ }
public func sleep(forMilliseconds ms: Int) {
if ms > 0 { sleep(forMicroseconds: UInt64(ms) * 1_000) }
}
I will add state machine diagram and sequence diagram for the main loop and a control loop for input output.
Right now project doesn’t bind IR to control servos nor engines. It is all done via the breadboard buttons.
But WIP. Idea is to learn as I go 
Community support and feedback is very important.
To be done yet:
- IR support
- Main Loop
- Bind input output control loop
- Add failsafe for IR to shutdown it (so it won’t fly away) in case of no IR control input in X number of seconds. As we know sun kills red light, but in theory I should have 5-20m range lol
Stay tuned!
Assembling my little guy 
Cheers!
Thanks to you all, for all the warm words! Bumps my motivation! 