$ show bird-sanctuary/bluejay
Bluejay is embedded firmware for Electronic Speed Controllers (ESCs) that control brushless motors in multirotor drones. It processes DShot digital signals (150/300/600) to regulate motor speed, provides bidirectional DShot telemetry for RPM data, and implements motor commutation, power management, and safety features. The architecture is a monolithic 8051 assembly program built for SiLabs EFM8 BB2/BB51 MCUs, using a superloop design with interrupt handlers for real-time signal processing. Key components include DShot decoding/encoding, six-step motor commutation, and a cooperative scheduler for background tasks like telemetry transmission and temperature monitoring.
The LLM identified 3 files worth highlighting for reuse:
Implements DShot signal decoding and telemetry generation with GCR encoding. Handles DShot command processing (beeps, direction changes, telemetry enable/disable) and produces precise telemetry pulses via Timer0 interrupts. Demonstrates skill in timing-sensitive protocol implementation and efficient bit-packing for telemetry data.
Implements 6-step brushless motor commutation for both forward and reverse directions. Manages commutation timing based on BEMF zero-crossing detection with configurable timing advance. Contains the core motor control state machine that switches PWM outputs to create rotating magnetic fields. Shows proper implementation of commutation logic with hysteresis and noise immunity.
Provides musical beep sequences for user feedback using PWM-driven commutation FETs. Generates tones of varying frequencies and durations without blocking CPU execution by leveraging hardware PWM. Includes specialized beep sequences for events like signal lost, motor stalled, and bootloader entry. Demonstrates efficient audio feedback implementation in resource-constrained embedded systems.