How yangyuanxin/qt-sensor works
This repository contains STM32 firmware that samples the BH750 light sensor and MQ-2 gas sensor, packages readings in the documented 0xAA sensor frame, and sends the bytes over USART1 for a host to consume. The main loop hands control to an RTOS task; that task selects sensor reads, frames each value, and transmits it. The tree also contains a Qt serial-thread module, but its behavior and connection to the firmware are not established by the available excerpts. Firmware wiring is based on the sampled entry point and application source; peripheral-driver internals were not sampled.
Main entry points: App.c RTOS app task · main.c Firmware entry · Bh750.c BH750 driver · MQ_2.c MQ-2 driver
Components 12
Firmware workflow
- Firmware entry
Mcu/McuPlatform/Core/Src/main.c - RTOS app task
Mcu/APP/App.c
Sensor acquisition
- BH750 driver
Mcu/Bsp/Bh750.c - MQ-2 driver
Mcu/Bsp/MQ_2.c
Serial transport
- Sensor framing
Mcu/Common/data_protocol/sensor_protocol.c - USART1 setup
Mcu/McuPlatform/Core/Src/usart.c - USART1 transmitter
Mcu/APP/App.c
Host software
- Qt serial thread
QT/SerialDriver/serialthread.cpp
Other components
- STM32 board
- BH750 sensor
- MQ-2 sensor
- Serial host
Connections 10
- STM32 board → Firmware entry: boots
- Firmware entry → USART1 setup: initializes
- Firmware entry → RTOS app task: starts
- RTOS app task → BH750 driver: reads light
- BH750 sensor → BH750 driver: provides reading
- RTOS app task → MQ-2 driver: reads gas
- MQ-2 sensor → MQ-2 driver: provides reading
- RTOS app task → Sensor framing: packs value
- RTOS app task → USART1 transmitter: sends frame
- USART1 transmitter → Serial host: transmits bytes