├── .gitattributes
├── .gitignore
├── .travis.sh
├── .travis.yml
├── CONTRIBUTING.md
├── JLinkSettings.ini
├── LICENSE
├── Makefile
├── Notes.md
├── README.md
├── Vagrantfile
├── build_docs.sh
├── docs
├── API
│ └── MSP_extensions.md
├── Battery.md
├── Blackbox.md
├── Board - AlienFlight.md
├── Board - CC3D.md
├── Board - CJMCU.md
├── Board - ChebuzzF3.md
├── Board - ColibriRace.md
├── Board - F3FC Racing.md
├── Board - MotoLab.md
├── Board - Naze32.md
├── Board - Olimexino.md
├── Board - Paris Air Hero 32.md
├── Board - RMDO.md
├── Board - SPRacingF3.md
├── Board - SPRacingF3Evo.md
├── Board - SPRacingF3Mini.md
├── Board - Sparky.md
├── Boards.md
├── Buzzer.md
├── Cli.md
├── Configuration.md
├── Controls.md
├── Display.md
├── Failsafe.md
├── Getting Started.md
├── Gps.md
├── Gtune.md
├── Inflight Adjustments.md
├── Installation.md
├── Introduction.md
├── LedStrip.md
├── Migrating from baseflight.md
├── Mixer.md
├── Modes.md
├── Oneshot.md
├── PID tuning.md
├── Profiles.md
├── Rssi.md
├── Rx.md
├── Safety.md
├── Screenshots
│ ├── adjustments-incorrect-config-1.png
│ ├── adjustments-incorrect-config-2-corrected.png
│ ├── adjustments-incorrect-config-2.png
│ ├── adjustments-pid-via-6pos-and-3pos.png
│ ├── adjustments-pid-via-two-3pos.png
│ ├── adjustments-pitch-and-roll-rate-adjustment-via-3pos.png
│ ├── adjustments-rate-profile-selection-via-3pos.png
│ ├── adjustments-rates-via-a-2pos-and-3pos.png
│ ├── blackbox-dataflash.png
│ ├── blackbox-screenshot-1.jpg
│ └── cleanflight-gui.png
├── Serial.md
├── Sonar.md
├── Spektrum bind.md
├── Telemetry.md
├── USB Flashing.md
├── Wiring
│ ├── CC3D - buzzer circuit.pdf
│ ├── Crius CO-16 OLED diagram.png
│ ├── Crius CO-16 OLED modifications.jpg
│ ├── PPMRSSI conditioning.pdf
│ └── blackbox-installation-1.jpg
├── assets
│ ├── cleanflight
│ │ ├── cleanflight-icon_128.png
│ │ ├── cleanflight-logo-light-wide-1-240px-transparent.png
│ │ ├── cleanflight-logo-light-wide-1-240px.jpg
│ │ └── cleanflight-logo-light-wide-1.svg
│ └── images
│ │ ├── StickPositions.png
│ │ ├── StickPositions.svg
│ │ ├── blheli-bootloader.png
│ │ ├── integrate_smartport.png
│ │ ├── serial1wire-cc3d-wiring.jpg
│ │ └── zadig-dfu.png
├── development
│ ├── Atomic Barrier.md
│ ├── Blackbox Internals.md
│ ├── Building Manual.md
│ ├── Building in Eclipse.md
│ ├── Building in Fedora.md
│ ├── Building in Mac OS X.md
│ ├── Building in Ubuntu.md
│ ├── Building in Windows.md
│ ├── Configuration Format.md
│ ├── Configuration Storage.md
│ ├── Development.md
│ ├── Hardware Debugging in Eclipse.md
│ ├── Hardware Debugging.md
│ ├── PID Internals.md
│ ├── Travis.md
│ └── assets
│ │ ├── 001.cygwin_dl.png
│ │ ├── 002.cygwin_setup.png
│ │ ├── 003.cygwin_setup.png
│ │ ├── 004.cygwin_setup.png
│ │ ├── 005.cygwin_setup.png
│ │ ├── 006.cygwin_setup.png
│ │ ├── 007.cygwin_setup.png
│ │ ├── 008.toolchain.png
│ │ ├── 009.toolchain_path.png
│ │ ├── 010.toolchain_path.png
│ │ ├── 011.git_checkout.png
│ │ ├── 012.git_checkout.png
│ │ ├── 013.compile.png
│ │ ├── hardware
│ │ ├── OLIMEX-ARM-JTAG-ADAPTER-2144328-40.jpg
│ │ ├── THAOYU-USB-MiniJTAG.jpg
│ │ ├── cepark-stlink-v2-front.jpg
│ │ ├── cjmcu-jlink-back.jpg
│ │ ├── cjmcu-jlink-front.jpg
│ │ └── j-link-edu.jpg
│ │ └── mac-prompt-tools-install.png
└── override.css
├── fake_travis_build.sh
├── lib
├── main
│ ├── CMSIS
│ │ ├── CM1
│ │ │ ├── CoreSupport
│ │ │ │ ├── arm_common_tables.h
│ │ │ │ ├── arm_const_structs.h
│ │ │ │ ├── arm_math.h
│ │ │ │ ├── core_cm0.h
│ │ │ │ ├── core_cm0plus.h
│ │ │ │ ├── core_cm3.h
│ │ │ │ ├── core_cm4.h
│ │ │ │ ├── core_cm4_simd.h
│ │ │ │ ├── core_cmFunc.h
│ │ │ │ ├── core_cmInstr.h
│ │ │ │ ├── core_sc000.h
│ │ │ │ └── core_sc300.h
│ │ │ └── DeviceSupport
│ │ │ │ └── ST
│ │ │ │ ├── STM32F30x
│ │ │ │ ├── startup
│ │ │ │ │ ├── TrueSTUDIO
│ │ │ │ │ │ ├── startup_stm32f302x8.s
│ │ │ │ │ │ ├── startup_stm32f303xc.s
│ │ │ │ │ │ ├── startup_stm32f30x.s
│ │ │ │ │ │ └── startup_stm32f334x8.s
│ │ │ │ │ ├── arm
│ │ │ │ │ │ ├── startup_stm32f302x8.s
│ │ │ │ │ │ ├── startup_stm32f303xc.s
│ │ │ │ │ │ ├── startup_stm32f30x.s
│ │ │ │ │ │ └── startup_stm32f334x8.s
│ │ │ │ │ ├── gcc_ride7
│ │ │ │ │ │ └── startup_stm32f30x.s
│ │ │ │ │ └── iar
│ │ │ │ │ │ ├── startup_stm32f302x8.s
│ │ │ │ │ │ ├── startup_stm32f303xc.s
│ │ │ │ │ │ ├── startup_stm32f30x.s
│ │ │ │ │ │ └── startup_stm32f334x8.s
│ │ │ │ ├── stm32f30x.h
│ │ │ │ ├── stm32f30x_conf.h
│ │ │ │ ├── stm32f30x_gpio.c
│ │ │ │ ├── stm32f30x_gpio.h
│ │ │ │ ├── stm32f30x_rcc.c
│ │ │ │ └── stm32f30x_rcc.h
│ │ │ │ └── STM32F4xx
│ │ │ │ ├── Include
│ │ │ │ └── system_stm32f4xx.h
│ │ │ │ ├── Release_Notes.html
│ │ │ │ ├── Source
│ │ │ │ └── startup
│ │ │ │ │ ├── TASKING
│ │ │ │ │ └── cstart_thumb2.asm
│ │ │ │ │ ├── TrueSTUDIO
│ │ │ │ │ ├── startup_stm32f401xx.s
│ │ │ │ │ ├── startup_stm32f40_41xxx.s
│ │ │ │ │ ├── startup_stm32f40xx.s
│ │ │ │ │ ├── startup_stm32f427_437xx.s
│ │ │ │ │ ├── startup_stm32f427xx.s
│ │ │ │ │ └── startup_stm32f429_439xx.s
│ │ │ │ │ ├── arm
│ │ │ │ │ ├── startup_stm32f401xx.s
│ │ │ │ │ ├── startup_stm32f40_41xxx.s
│ │ │ │ │ ├── startup_stm32f40xx.s
│ │ │ │ │ ├── startup_stm32f427_437xx.s
│ │ │ │ │ ├── startup_stm32f427x.s
│ │ │ │ │ └── startup_stm32f429_439xx.s
│ │ │ │ │ ├── gcc_ride7
│ │ │ │ │ ├── startup_stm32f401xx.s
│ │ │ │ │ ├── startup_stm32f40_41xxx.s
│ │ │ │ │ ├── startup_stm32f40xx.s
│ │ │ │ │ ├── startup_stm32f427_437xx.s
│ │ │ │ │ ├── startup_stm32f427x.s
│ │ │ │ │ └── startup_stm32f429_439xx.s
│ │ │ │ │ ├── iar
│ │ │ │ │ ├── startup_stm32f401xx.s
│ │ │ │ │ ├── startup_stm32f40_41xxx.s
│ │ │ │ │ ├── startup_stm32f40xx.s
│ │ │ │ │ ├── startup_stm32f427_437xx.s
│ │ │ │ │ ├── startup_stm32f427x.s
│ │ │ │ │ └── startup_stm32f429_439xx.s
│ │ │ │ │ └── system_stm32f4xx.c
│ │ │ │ ├── stm32f4xx.h
│ │ │ │ ├── stm32f4xx_conf.h
│ │ │ │ ├── stm32f4xx_gpio.c
│ │ │ │ ├── stm32f4xx_gpio.h
│ │ │ │ ├── stm32f4xx_rcc.c
│ │ │ │ └── stm32f4xx_rcc.h
│ │ └── CM3
│ │ │ ├── CoreSupport
│ │ │ ├── core_cm3.c
│ │ │ └── core_cm3.h
│ │ │ └── DeviceSupport
│ │ │ └── ST
│ │ │ └── STM32F10x
│ │ │ ├── Release_Notes.html
│ │ │ ├── startup
│ │ │ ├── TrueSTUDIO
│ │ │ │ ├── startup_stm32f10x_cl.s
│ │ │ │ ├── startup_stm32f10x_hd.s
│ │ │ │ ├── startup_stm32f10x_hd_vl.s
│ │ │ │ ├── startup_stm32f10x_ld.s
│ │ │ │ ├── startup_stm32f10x_ld_vl.s
│ │ │ │ ├── startup_stm32f10x_md.s
│ │ │ │ ├── startup_stm32f10x_md_vl.s
│ │ │ │ └── startup_stm32f10x_xl.s
│ │ │ ├── arm
│ │ │ │ ├── startup_stm32f10x_cl.s
│ │ │ │ ├── startup_stm32f10x_hd.s
│ │ │ │ ├── startup_stm32f10x_hd_vl.s
│ │ │ │ ├── startup_stm32f10x_ld.s
│ │ │ │ ├── startup_stm32f10x_ld_vl.s
│ │ │ │ ├── startup_stm32f10x_md.s
│ │ │ │ ├── startup_stm32f10x_md_vl.s
│ │ │ │ └── startup_stm32f10x_xl.s
│ │ │ ├── gcc_ride7
│ │ │ │ ├── startup_stm32f10x_cl.s
│ │ │ │ ├── startup_stm32f10x_hd.s
│ │ │ │ ├── startup_stm32f10x_hd_vl.s
│ │ │ │ ├── startup_stm32f10x_ld.s
│ │ │ │ ├── startup_stm32f10x_ld_vl.s
│ │ │ │ ├── startup_stm32f10x_md.s
│ │ │ │ ├── startup_stm32f10x_md_vl.s
│ │ │ │ └── startup_stm32f10x_xl.s
│ │ │ └── iar
│ │ │ │ ├── startup_stm32f10x_cl.s
│ │ │ │ ├── startup_stm32f10x_hd.s
│ │ │ │ ├── startup_stm32f10x_hd_vl.s
│ │ │ │ ├── startup_stm32f10x_ld.s
│ │ │ │ ├── startup_stm32f10x_ld_vl.s
│ │ │ │ ├── startup_stm32f10x_md.s
│ │ │ │ ├── startup_stm32f10x_md_vl.s
│ │ │ │ └── startup_stm32f10x_xl.s
│ │ │ ├── stm32f10x.h
│ │ │ ├── stm32f10x_conf.h
│ │ │ ├── system_stm32f10x.c
│ │ │ └── system_stm32f10x.h
│ ├── STM32F10x_StdPeriph_Driver
│ │ ├── inc
│ │ │ ├── misc.h
│ │ │ ├── stm32f10x_adc.h
│ │ │ ├── stm32f10x_bkp.h
│ │ │ ├── stm32f10x_can.h
│ │ │ ├── stm32f10x_cec.h
│ │ │ ├── stm32f10x_crc.h
│ │ │ ├── stm32f10x_dac.h
│ │ │ ├── stm32f10x_dbgmcu.h
│ │ │ ├── stm32f10x_dma.h
│ │ │ ├── stm32f10x_exti.h
│ │ │ ├── stm32f10x_flash.h
│ │ │ ├── stm32f10x_fsmc.h
│ │ │ ├── stm32f10x_gpio.h
│ │ │ ├── stm32f10x_i2c.h
│ │ │ ├── stm32f10x_iwdg.h
│ │ │ ├── stm32f10x_pwr.h
│ │ │ ├── stm32f10x_rcc.h
│ │ │ ├── stm32f10x_rtc.h
│ │ │ ├── stm32f10x_sdio.h
│ │ │ ├── stm32f10x_spi.h
│ │ │ ├── stm32f10x_tim.h
│ │ │ ├── stm32f10x_usart.h
│ │ │ └── stm32f10x_wwdg.h
│ │ └── src
│ │ │ ├── misc.c
│ │ │ ├── stm32f10x_adc.c
│ │ │ ├── stm32f10x_bkp.c
│ │ │ ├── stm32f10x_can.c
│ │ │ ├── stm32f10x_cec.c
│ │ │ ├── stm32f10x_crc.c
│ │ │ ├── stm32f10x_dac.c
│ │ │ ├── stm32f10x_dbgmcu.c
│ │ │ ├── stm32f10x_dma.c
│ │ │ ├── stm32f10x_exti.c
│ │ │ ├── stm32f10x_flash.c
│ │ │ ├── stm32f10x_fsmc.c
│ │ │ ├── stm32f10x_gpio.c
│ │ │ ├── stm32f10x_i2c.c
│ │ │ ├── stm32f10x_iwdg.c
│ │ │ ├── stm32f10x_pwr.c
│ │ │ ├── stm32f10x_rcc.c
│ │ │ ├── stm32f10x_rtc.c
│ │ │ ├── stm32f10x_sdio.c
│ │ │ ├── stm32f10x_spi.c
│ │ │ ├── stm32f10x_tim.c
│ │ │ ├── stm32f10x_usart.c
│ │ │ └── stm32f10x_wwdg.c
│ ├── STM32F30x_StdPeriph_Driver
│ │ ├── Release_Notes.html
│ │ ├── inc
│ │ │ ├── stm32f30x_adc.h
│ │ │ ├── stm32f30x_can.h
│ │ │ ├── stm32f30x_comp.h
│ │ │ ├── stm32f30x_crc.h
│ │ │ ├── stm32f30x_dac.h
│ │ │ ├── stm32f30x_dbgmcu.h
│ │ │ ├── stm32f30x_dma.h
│ │ │ ├── stm32f30x_exti.h
│ │ │ ├── stm32f30x_flash.h
│ │ │ ├── stm32f30x_gpio.h
│ │ │ ├── stm32f30x_hrtim.h
│ │ │ ├── stm32f30x_i2c.h
│ │ │ ├── stm32f30x_iwdg.h
│ │ │ ├── stm32f30x_misc.h
│ │ │ ├── stm32f30x_opamp.h
│ │ │ ├── stm32f30x_pwr.h
│ │ │ ├── stm32f30x_rcc.h
│ │ │ ├── stm32f30x_rtc.h
│ │ │ ├── stm32f30x_spi.h
│ │ │ ├── stm32f30x_syscfg.h
│ │ │ ├── stm32f30x_tim.h
│ │ │ ├── stm32f30x_usart.h
│ │ │ └── stm32f30x_wwdg.h
│ │ └── src
│ │ │ ├── stm32f30x_adc.c
│ │ │ ├── stm32f30x_can.c
│ │ │ ├── stm32f30x_comp.c
│ │ │ ├── stm32f30x_crc.c
│ │ │ ├── stm32f30x_dac.c
│ │ │ ├── stm32f30x_dbgmcu.c
│ │ │ ├── stm32f30x_dma.c
│ │ │ ├── stm32f30x_exti.c
│ │ │ ├── stm32f30x_flash.c
│ │ │ ├── stm32f30x_gpio.c
│ │ │ ├── stm32f30x_hrtim.c
│ │ │ ├── stm32f30x_i2c.c
│ │ │ ├── stm32f30x_iwdg.c
│ │ │ ├── stm32f30x_misc.c
│ │ │ ├── stm32f30x_opamp.c
│ │ │ ├── stm32f30x_pwr.c
│ │ │ ├── stm32f30x_rcc.c
│ │ │ ├── stm32f30x_rtc.c
│ │ │ ├── stm32f30x_spi.c
│ │ │ ├── stm32f30x_syscfg.c
│ │ │ ├── stm32f30x_tim.c
│ │ │ ├── stm32f30x_usart.c
│ │ │ └── stm32f30x_wwdg.c
│ ├── STM32F4xx_StdPeriph_Driver
│ │ ├── Release_Notes.html
│ │ ├── inc
│ │ │ ├── misc.h
│ │ │ ├── stm32f4xx_adc.h
│ │ │ ├── stm32f4xx_can.h
│ │ │ ├── stm32f4xx_crc.h
│ │ │ ├── stm32f4xx_cryp.h
│ │ │ ├── stm32f4xx_dac.h
│ │ │ ├── stm32f4xx_dbgmcu.h
│ │ │ ├── stm32f4xx_dcmi.h
│ │ │ ├── stm32f4xx_dma.h
│ │ │ ├── stm32f4xx_dma2d.h
│ │ │ ├── stm32f4xx_exti.h
│ │ │ ├── stm32f4xx_flash.h
│ │ │ ├── stm32f4xx_fmc.h
│ │ │ ├── stm32f4xx_fsmc.h
│ │ │ ├── stm32f4xx_gpio.h
│ │ │ ├── stm32f4xx_hash.h
│ │ │ ├── stm32f4xx_i2c.h
│ │ │ ├── stm32f4xx_iwdg.h
│ │ │ ├── stm32f4xx_ltdc.h
│ │ │ ├── stm32f4xx_pwr.h
│ │ │ ├── stm32f4xx_rcc.h
│ │ │ ├── stm32f4xx_rng.h
│ │ │ ├── stm32f4xx_rtc.h
│ │ │ ├── stm32f4xx_sai.h
│ │ │ ├── stm32f4xx_sdio.h
│ │ │ ├── stm32f4xx_spi.h
│ │ │ ├── stm32f4xx_syscfg.h
│ │ │ ├── stm32f4xx_tim.h
│ │ │ ├── stm32f4xx_usart.h
│ │ │ └── stm32f4xx_wwdg.h
│ │ └── src
│ │ │ ├── misc.c
│ │ │ ├── stm32f4xx_adc.c
│ │ │ ├── stm32f4xx_can.c
│ │ │ ├── stm32f4xx_crc.c
│ │ │ ├── stm32f4xx_cryp.c
│ │ │ ├── stm32f4xx_cryp_aes.c
│ │ │ ├── stm32f4xx_cryp_des.c
│ │ │ ├── stm32f4xx_cryp_tdes.c
│ │ │ ├── stm32f4xx_dac.c
│ │ │ ├── stm32f4xx_dbgmcu.c
│ │ │ ├── stm32f4xx_dcmi.c
│ │ │ ├── stm32f4xx_dma.c
│ │ │ ├── stm32f4xx_dma2d.c
│ │ │ ├── stm32f4xx_exti.c
│ │ │ ├── stm32f4xx_flash.c
│ │ │ ├── stm32f4xx_fmc.c
│ │ │ ├── stm32f4xx_fsmc.c
│ │ │ ├── stm32f4xx_gpio.c
│ │ │ ├── stm32f4xx_hash.c
│ │ │ ├── stm32f4xx_hash_md5.c
│ │ │ ├── stm32f4xx_hash_sha1.c
│ │ │ ├── stm32f4xx_i2c.c
│ │ │ ├── stm32f4xx_iwdg.c
│ │ │ ├── stm32f4xx_ltdc.c
│ │ │ ├── stm32f4xx_pwr.c
│ │ │ ├── stm32f4xx_rcc.c
│ │ │ ├── stm32f4xx_rng.c
│ │ │ ├── stm32f4xx_rtc.c
│ │ │ ├── stm32f4xx_sai.c
│ │ │ ├── stm32f4xx_sdio.c
│ │ │ ├── stm32f4xx_spi.c
│ │ │ ├── stm32f4xx_syscfg.c
│ │ │ ├── stm32f4xx_tim.c
│ │ │ ├── stm32f4xx_usart.c
│ │ │ └── stm32f4xx_wwdg.c
│ ├── STM32_USB-FS-Device_Driver
│ │ ├── Release_Notes.html
│ │ ├── inc
│ │ │ ├── usb_core.h
│ │ │ ├── usb_def.h
│ │ │ ├── usb_init.h
│ │ │ ├── usb_int.h
│ │ │ ├── usb_lib.h
│ │ │ ├── usb_mem.h
│ │ │ ├── usb_regs.h
│ │ │ ├── usb_sil.h
│ │ │ └── usb_type.h
│ │ └── src
│ │ │ ├── usb_core.c
│ │ │ ├── usb_init.c
│ │ │ ├── usb_int.c
│ │ │ ├── usb_mem.c
│ │ │ ├── usb_regs.c
│ │ │ └── usb_sil.c
│ ├── STM32_USB_Device_Library
│ │ ├── Class
│ │ │ ├── audio
│ │ │ │ ├── inc
│ │ │ │ │ ├── usbd_audio_core.h
│ │ │ │ │ └── usbd_audio_out_if.h
│ │ │ │ └── src
│ │ │ │ │ ├── usbd_audio_core.c
│ │ │ │ │ └── usbd_audio_out_if.c
│ │ │ ├── cdc
│ │ │ │ ├── inc
│ │ │ │ │ ├── usbd_cdc_core.h
│ │ │ │ │ └── usbd_cdc_if_template.h
│ │ │ │ └── src
│ │ │ │ │ ├── usbd_cdc_core.c
│ │ │ │ │ └── usbd_cdc_if_template.c
│ │ │ ├── dfu
│ │ │ │ ├── inc
│ │ │ │ │ ├── usbd_dfu_core.h
│ │ │ │ │ ├── usbd_dfu_mal.h
│ │ │ │ │ ├── usbd_flash_if.h
│ │ │ │ │ ├── usbd_mem_if_template.h
│ │ │ │ │ └── usbd_otp_if.h
│ │ │ │ └── src
│ │ │ │ │ ├── usbd_dfu_core.c
│ │ │ │ │ ├── usbd_dfu_mal.c
│ │ │ │ │ ├── usbd_flash_if.c
│ │ │ │ │ ├── usbd_mem_if_template.c
│ │ │ │ │ └── usbd_otp_if.c
│ │ │ ├── hid
│ │ │ │ ├── inc
│ │ │ │ │ └── usbd_hid_core.h
│ │ │ │ └── src
│ │ │ │ │ └── usbd_hid_core.c
│ │ │ └── msc
│ │ │ │ ├── inc
│ │ │ │ ├── usbd_msc_bot.h
│ │ │ │ ├── usbd_msc_core.h
│ │ │ │ ├── usbd_msc_data.h
│ │ │ │ ├── usbd_msc_mem.h
│ │ │ │ └── usbd_msc_scsi.h
│ │ │ │ └── src
│ │ │ │ ├── usbd_msc_bot.c
│ │ │ │ ├── usbd_msc_core.c
│ │ │ │ ├── usbd_msc_data.c
│ │ │ │ ├── usbd_msc_scsi.c
│ │ │ │ └── usbd_storage_template.c
│ │ ├── Core
│ │ │ ├── inc
│ │ │ │ ├── usbd_conf_template.h
│ │ │ │ ├── usbd_core.h
│ │ │ │ ├── usbd_def.h
│ │ │ │ ├── usbd_ioreq.h
│ │ │ │ ├── usbd_req.h
│ │ │ │ └── usbd_usr.h
│ │ │ └── src
│ │ │ │ ├── usbd_core.c
│ │ │ │ ├── usbd_ioreq.c
│ │ │ │ └── usbd_req.c
│ │ └── Release_Notes.html
│ └── STM32_USB_OTG_Driver
│ │ ├── Release_Notes.html
│ │ ├── inc
│ │ ├── usb_bsp.h
│ │ ├── usb_conf_template.h
│ │ ├── usb_core.h
│ │ ├── usb_dcd.h
│ │ ├── usb_dcd_int.h
│ │ ├── usb_defines.h
│ │ ├── usb_hcd.h
│ │ ├── usb_hcd_int.h
│ │ ├── usb_otg.h
│ │ └── usb_regs.h
│ │ └── src
│ │ ├── usb_bsp_template.c
│ │ ├── usb_core.c
│ │ ├── usb_dcd.c
│ │ ├── usb_dcd_int.c
│ │ ├── usb_hcd.c
│ │ ├── usb_hcd_int.c
│ │ └── usb_otg.c
└── test
│ └── gtest
│ ├── inc
│ └── gtest
│ │ └── gtest.h
│ └── src
│ ├── gtest-all.cc
│ └── gtest_main.cc
├── media
└── cleanflight-font.mcm
├── src
├── main
│ ├── blackbox
│ │ ├── blackbox.c
│ │ ├── blackbox.h
│ │ ├── blackbox_fielddefs.h
│ │ ├── blackbox_io.c
│ │ └── blackbox_io.h
│ ├── build
│ │ ├── atomic.h
│ │ ├── build_config.c
│ │ ├── build_config.h
│ │ ├── debug.c
│ │ ├── debug.h
│ │ ├── version.c
│ │ └── version.h
│ ├── common
│ │ ├── axis.h
│ │ ├── color.h
│ │ ├── colorconversion.c
│ │ ├── colorconversion.h
│ │ ├── encoding.c
│ │ ├── encoding.h
│ │ ├── filter.c
│ │ ├── filter.h
│ │ ├── maths.c
│ │ ├── maths.h
│ │ ├── printf.c
│ │ ├── printf.h
│ │ ├── streambuf.c
│ │ ├── streambuf.h
│ │ ├── typeconversion.c
│ │ ├── typeconversion.h
│ │ └── utils.h
│ ├── config
│ │ ├── config_eeprom.c
│ │ ├── config_eeprom.h
│ │ ├── config_reset.h
│ │ ├── config_streamer.c
│ │ ├── config_streamer.h
│ │ ├── config_system.h
│ │ ├── config_unittest.h
│ │ ├── feature.c
│ │ ├── feature.h
│ │ ├── parameter_group.c
│ │ ├── parameter_group.h
│ │ ├── parameter_group_ids.h
│ │ ├── profile.c
│ │ └── profile.h
│ ├── drivers
│ │ ├── accgyro.h
│ │ ├── accgyro_adxl345.c
│ │ ├── accgyro_adxl345.h
│ │ ├── accgyro_bma280.c
│ │ ├── accgyro_bma280.h
│ │ ├── accgyro_l3g4200d.c
│ │ ├── accgyro_l3g4200d.h
│ │ ├── accgyro_l3gd20.c
│ │ ├── accgyro_l3gd20.h
│ │ ├── accgyro_lsm303dlhc.c
│ │ ├── accgyro_lsm303dlhc.h
│ │ ├── accgyro_mma845x.c
│ │ ├── accgyro_mma845x.h
│ │ ├── accgyro_mpu.c
│ │ ├── accgyro_mpu.h
│ │ ├── accgyro_mpu3050.c
│ │ ├── accgyro_mpu3050.h
│ │ ├── accgyro_mpu6050.c
│ │ ├── accgyro_mpu6050.h
│ │ ├── accgyro_mpu6500.c
│ │ ├── accgyro_mpu6500.h
│ │ ├── accgyro_spi_mpu6000.c
│ │ ├── accgyro_spi_mpu6000.h
│ │ ├── accgyro_spi_mpu6500.c
│ │ ├── accgyro_spi_mpu6500.h
│ │ ├── adc.c
│ │ ├── adc.h
│ │ ├── adc_impl.h
│ │ ├── adc_stm32f10x.c
│ │ ├── adc_stm32f30x.c
│ │ ├── adc_stm32f4xx.c
│ │ ├── barometer.h
│ │ ├── barometer_bmp085.c
│ │ ├── barometer_bmp085.h
│ │ ├── barometer_bmp280.c
│ │ ├── barometer_bmp280.h
│ │ ├── barometer_ms5611.c
│ │ ├── barometer_ms5611.h
│ │ ├── buf_writer.c
│ │ ├── buf_writer.h
│ │ ├── bus_i2c.h
│ │ ├── bus_i2c_soft.c
│ │ ├── bus_i2c_stm32f10x.c
│ │ ├── bus_i2c_stm32f30x.c
│ │ ├── bus_i2c_stm32f4xx.c
│ │ ├── bus_spi.c
│ │ ├── bus_spi.h
│ │ ├── compass.h
│ │ ├── compass_ak8963.c
│ │ ├── compass_ak8963.h
│ │ ├── compass_ak8975.c
│ │ ├── compass_ak8975.h
│ │ ├── compass_hmc5883l.c
│ │ ├── compass_hmc5883l.h
│ │ ├── display_ug2864hsweg01.c
│ │ ├── display_ug2864hsweg01.h
│ │ ├── dma.c
│ │ ├── dma.h
│ │ ├── exti.h
│ │ ├── flash.h
│ │ ├── flash_m25p16.c
│ │ ├── flash_m25p16.h
│ │ ├── gpio.h
│ │ ├── gpio_stm32f10x.c
│ │ ├── gpio_stm32f30x.c
│ │ ├── gpio_stm32f4xx.c
│ │ ├── gyro_sync.c
│ │ ├── gyro_sync.h
│ │ ├── inverter.c
│ │ ├── inverter.h
│ │ ├── light_led.h
│ │ ├── light_led_stm32f10x.c
│ │ ├── light_led_stm32f30x.c
│ │ ├── light_led_stm32f4xx.c
│ │ ├── light_ws2811strip.c
│ │ ├── light_ws2811strip.h
│ │ ├── light_ws2811strip_stm32f10x.c
│ │ ├── light_ws2811strip_stm32f30x.c
│ │ ├── light_ws2811strip_stm32f4xx.c
│ │ ├── nvic.h
│ │ ├── pitotmeter.h
│ │ ├── pitotmeter_ms4525.c
│ │ ├── pitotmeter_ms4525.h
│ │ ├── pwm_mapping.c
│ │ ├── pwm_mapping.h
│ │ ├── pwm_output.c
│ │ ├── pwm_output.h
│ │ ├── pwm_rx.c
│ │ ├── pwm_rx.h
│ │ ├── sdcard.c
│ │ ├── sdcard.h
│ │ ├── sdcard_standard.c
│ │ ├── sdcard_standard.h
│ │ ├── sensor.h
│ │ ├── serial.c
│ │ ├── serial.h
│ │ ├── serial_escserial.c
│ │ ├── serial_escserial.h
│ │ ├── serial_softserial.c
│ │ ├── serial_softserial.h
│ │ ├── serial_uart.c
│ │ ├── serial_uart.h
│ │ ├── serial_uart_impl.h
│ │ ├── serial_uart_stm32f10x.c
│ │ ├── serial_uart_stm32f10x.h
│ │ ├── serial_uart_stm32f30x.c
│ │ ├── serial_uart_stm32f30x.h
│ │ ├── serial_uart_stm32f4xx.c
│ │ ├── serial_uart_stm32f4xx.h
│ │ ├── serial_usb_vcp.c
│ │ ├── serial_usb_vcp.h
│ │ ├── sonar_hcsr04.c
│ │ ├── sonar_hcsr04.h
│ │ ├── sound_beeper.c
│ │ ├── sound_beeper.h
│ │ ├── sound_beeper_stm32f10x.c
│ │ ├── sound_beeper_stm32f30x.c
│ │ ├── sound_beeper_stm32f4xx.c
│ │ ├── system.c
│ │ ├── system.h
│ │ ├── system_stm32f10x.c
│ │ ├── system_stm32f30x.c
│ │ ├── system_stm32f4xx.c
│ │ ├── timer.c
│ │ ├── timer.h
│ │ ├── timer_impl.h
│ │ ├── timer_stm32f10x.c
│ │ ├── timer_stm32f10x.h
│ │ ├── timer_stm32f30x.c
│ │ ├── timer_stm32f30x.h
│ │ ├── timer_stm32f4xx.c
│ │ ├── timer_stm32f4xx.h
│ │ ├── transponder_ir.c
│ │ ├── transponder_ir.h
│ │ ├── transponder_ir_stm32f30x.c
│ │ ├── usb_io.c
│ │ ├── usb_io.h
│ │ ├── video.h
│ │ ├── video_max7456.c
│ │ ├── video_max7456.h
│ │ └── video_textscreen.h
│ ├── fc
│ │ ├── boot.c
│ │ ├── cleanflight_fc.c
│ │ ├── cleanflight_fc.h
│ │ ├── config.c
│ │ ├── config.h
│ │ ├── fc_serial.c
│ │ ├── fc_serial.h
│ │ ├── fc_tasks.c
│ │ ├── fc_tasks.h
│ │ ├── msp_server_fc.c
│ │ ├── msp_server_fc.h
│ │ ├── rate_profile.c
│ │ ├── rate_profile.h
│ │ ├── rc_adjustments.c
│ │ ├── rc_adjustments.h
│ │ ├── rc_controls.c
│ │ ├── rc_controls.h
│ │ ├── rc_curves.c
│ │ ├── rc_curves.h
│ │ ├── runtime_config.c
│ │ └── runtime_config.h
│ ├── flight
│ │ ├── altitudehold.c
│ │ ├── altitudehold.h
│ │ ├── failsafe.c
│ │ ├── failsafe.h
│ │ ├── gps_conversion.c
│ │ ├── gps_conversion.h
│ │ ├── gtune.c
│ │ ├── gtune.h
│ │ ├── imu.c
│ │ ├── imu.h
│ │ ├── mixer.c
│ │ ├── mixer.h
│ │ ├── navigation.c
│ │ ├── navigation.h
│ │ ├── pid.c
│ │ ├── pid.h
│ │ ├── pid_luxfloat.c
│ │ ├── pid_mw23.c
│ │ ├── pid_mwrewrite.c
│ │ ├── servos.c
│ │ └── servos.h
│ ├── io
│ │ ├── asyncfatfs
│ │ │ ├── asyncfatfs.c
│ │ │ ├── asyncfatfs.h
│ │ │ ├── fat_standard.c
│ │ │ └── fat_standard.h
│ │ ├── beeper.c
│ │ ├── beeper.h
│ │ ├── display.c
│ │ ├── display.h
│ │ ├── flashfs.c
│ │ ├── flashfs.h
│ │ ├── gimbal.c
│ │ ├── gimbal.h
│ │ ├── gps.c
│ │ ├── gps.h
│ │ ├── ledstrip.c
│ │ ├── ledstrip.h
│ │ ├── motor_and_servo.c
│ │ ├── motor_and_servo.h
│ │ ├── serial.c
│ │ ├── serial.h
│ │ ├── serial_4way.c
│ │ ├── serial_4way.h
│ │ ├── serial_4way_avrootloader.c
│ │ ├── serial_4way_avrootloader.h
│ │ ├── serial_4way_impl.h
│ │ ├── serial_4way_stk500v2.c
│ │ ├── serial_4way_stk500v2.h
│ │ ├── serial_cli.c
│ │ ├── serial_cli.h
│ │ ├── statusindicator.c
│ │ ├── statusindicator.h
│ │ ├── transponder_ir.c
│ │ └── transponder_ir.h
│ ├── mavlink
│ │ ├── ASLUAV
│ │ │ ├── ASLUAV.h
│ │ │ ├── mavlink.h
│ │ │ ├── mavlink_msg_asl_obctrl.h
│ │ │ ├── mavlink_msg_aslctrl_data.h
│ │ │ ├── mavlink_msg_aslctrl_debug.h
│ │ │ ├── mavlink_msg_asluav_status.h
│ │ │ ├── mavlink_msg_ekf_ext.h
│ │ │ ├── mavlink_msg_sens_atmos.h
│ │ │ ├── mavlink_msg_sens_batmon.h
│ │ │ ├── mavlink_msg_sens_mppt.h
│ │ │ ├── mavlink_msg_sens_power.h
│ │ │ ├── testsuite.h
│ │ │ └── version.h
│ │ ├── ardupilotmega
│ │ │ ├── ardupilotmega.h
│ │ │ ├── mavlink.h
│ │ │ ├── mavlink_msg_ahrs.h
│ │ │ ├── mavlink_msg_ahrs2.h
│ │ │ ├── mavlink_msg_ahrs3.h
│ │ │ ├── mavlink_msg_airspeed_autocal.h
│ │ │ ├── mavlink_msg_ap_adc.h
│ │ │ ├── mavlink_msg_autopilot_version_request.h
│ │ │ ├── mavlink_msg_battery2.h
│ │ │ ├── mavlink_msg_camera_feedback.h
│ │ │ ├── mavlink_msg_camera_status.h
│ │ │ ├── mavlink_msg_compassmot_status.h
│ │ │ ├── mavlink_msg_data16.h
│ │ │ ├── mavlink_msg_data32.h
│ │ │ ├── mavlink_msg_data64.h
│ │ │ ├── mavlink_msg_data96.h
│ │ │ ├── mavlink_msg_digicam_configure.h
│ │ │ ├── mavlink_msg_digicam_control.h
│ │ │ ├── mavlink_msg_ekf_status_report.h
│ │ │ ├── mavlink_msg_fence_fetch_point.h
│ │ │ ├── mavlink_msg_fence_point.h
│ │ │ ├── mavlink_msg_fence_status.h
│ │ │ ├── mavlink_msg_gimbal_axis_calibration_progress.h
│ │ │ ├── mavlink_msg_gimbal_control.h
│ │ │ ├── mavlink_msg_gimbal_erase_firmware_and_config.h
│ │ │ ├── mavlink_msg_gimbal_factory_parameters_loaded.h
│ │ │ ├── mavlink_msg_gimbal_home_offset_calibration_result.h
│ │ │ ├── mavlink_msg_gimbal_perform_factory_tests.h
│ │ │ ├── mavlink_msg_gimbal_report.h
│ │ │ ├── mavlink_msg_gimbal_report_factory_tests_progress.h
│ │ │ ├── mavlink_msg_gimbal_reset.h
│ │ │ ├── mavlink_msg_gimbal_set_factory_parameters.h
│ │ │ ├── mavlink_msg_gimbal_set_home_offsets.h
│ │ │ ├── mavlink_msg_gopro_command.h
│ │ │ ├── mavlink_msg_gopro_power_off.h
│ │ │ ├── mavlink_msg_gopro_power_on.h
│ │ │ ├── mavlink_msg_gopro_response.h
│ │ │ ├── mavlink_msg_hwstatus.h
│ │ │ ├── mavlink_msg_led_control.h
│ │ │ ├── mavlink_msg_limits_status.h
│ │ │ ├── mavlink_msg_mag_cal_progress.h
│ │ │ ├── mavlink_msg_mag_cal_report.h
│ │ │ ├── mavlink_msg_meminfo.h
│ │ │ ├── mavlink_msg_mount_configure.h
│ │ │ ├── mavlink_msg_mount_control.h
│ │ │ ├── mavlink_msg_mount_status.h
│ │ │ ├── mavlink_msg_radio.h
│ │ │ ├── mavlink_msg_rally_fetch_point.h
│ │ │ ├── mavlink_msg_rally_point.h
│ │ │ ├── mavlink_msg_rangefinder.h
│ │ │ ├── mavlink_msg_sensor_offsets.h
│ │ │ ├── mavlink_msg_set_mag_offsets.h
│ │ │ ├── mavlink_msg_simstate.h
│ │ │ ├── mavlink_msg_wind.h
│ │ │ ├── testsuite.h
│ │ │ └── version.h
│ │ ├── autoquad
│ │ │ ├── autoquad.h
│ │ │ ├── mavlink.h
│ │ │ ├── mavlink_msg_aq_esc_telemetry.h
│ │ │ ├── mavlink_msg_aq_telemetry_f.h
│ │ │ ├── testsuite.h
│ │ │ └── version.h
│ │ ├── checksum.h
│ │ ├── common
│ │ │ ├── common.h
│ │ │ ├── mavlink.h
│ │ │ ├── mavlink_msg_actuator_control_target.h
│ │ │ ├── mavlink_msg_att_pos_mocap.h
│ │ │ ├── mavlink_msg_attitude.h
│ │ │ ├── mavlink_msg_attitude_quaternion.h
│ │ │ ├── mavlink_msg_attitude_quaternion_cov.h
│ │ │ ├── mavlink_msg_attitude_target.h
│ │ │ ├── mavlink_msg_auth_key.h
│ │ │ ├── mavlink_msg_autopilot_version.h
│ │ │ ├── mavlink_msg_battery_status.h
│ │ │ ├── mavlink_msg_camera_trigger.h
│ │ │ ├── mavlink_msg_change_operator_control.h
│ │ │ ├── mavlink_msg_change_operator_control_ack.h
│ │ │ ├── mavlink_msg_command_ack.h
│ │ │ ├── mavlink_msg_command_int.h
│ │ │ ├── mavlink_msg_command_long.h
│ │ │ ├── mavlink_msg_data_stream.h
│ │ │ ├── mavlink_msg_data_transmission_handshake.h
│ │ │ ├── mavlink_msg_debug.h
│ │ │ ├── mavlink_msg_debug_vect.h
│ │ │ ├── mavlink_msg_distance_sensor.h
│ │ │ ├── mavlink_msg_encapsulated_data.h
│ │ │ ├── mavlink_msg_file_transfer_protocol.h
│ │ │ ├── mavlink_msg_global_position_int.h
│ │ │ ├── mavlink_msg_global_position_int_cov.h
│ │ │ ├── mavlink_msg_global_vision_position_estimate.h
│ │ │ ├── mavlink_msg_gps2_raw.h
│ │ │ ├── mavlink_msg_gps2_rtk.h
│ │ │ ├── mavlink_msg_gps_global_origin.h
│ │ │ ├── mavlink_msg_gps_inject_data.h
│ │ │ ├── mavlink_msg_gps_raw_int.h
│ │ │ ├── mavlink_msg_gps_rtk.h
│ │ │ ├── mavlink_msg_gps_status.h
│ │ │ ├── mavlink_msg_heartbeat.h
│ │ │ ├── mavlink_msg_highres_imu.h
│ │ │ ├── mavlink_msg_hil_controls.h
│ │ │ ├── mavlink_msg_hil_gps.h
│ │ │ ├── mavlink_msg_hil_optical_flow.h
│ │ │ ├── mavlink_msg_hil_rc_inputs_raw.h
│ │ │ ├── mavlink_msg_hil_sensor.h
│ │ │ ├── mavlink_msg_hil_state.h
│ │ │ ├── mavlink_msg_hil_state_quaternion.h
│ │ │ ├── mavlink_msg_local_position_ned.h
│ │ │ ├── mavlink_msg_local_position_ned_cov.h
│ │ │ ├── mavlink_msg_local_position_ned_system_global_offset.h
│ │ │ ├── mavlink_msg_log_data.h
│ │ │ ├── mavlink_msg_log_entry.h
│ │ │ ├── mavlink_msg_log_erase.h
│ │ │ ├── mavlink_msg_log_request_data.h
│ │ │ ├── mavlink_msg_log_request_end.h
│ │ │ ├── mavlink_msg_log_request_list.h
│ │ │ ├── mavlink_msg_manual_control.h
│ │ │ ├── mavlink_msg_manual_setpoint.h
│ │ │ ├── mavlink_msg_memory_vect.h
│ │ │ ├── mavlink_msg_mission_ack.h
│ │ │ ├── mavlink_msg_mission_clear_all.h
│ │ │ ├── mavlink_msg_mission_count.h
│ │ │ ├── mavlink_msg_mission_current.h
│ │ │ ├── mavlink_msg_mission_item.h
│ │ │ ├── mavlink_msg_mission_item_int.h
│ │ │ ├── mavlink_msg_mission_item_reached.h
│ │ │ ├── mavlink_msg_mission_request.h
│ │ │ ├── mavlink_msg_mission_request_list.h
│ │ │ ├── mavlink_msg_mission_request_partial_list.h
│ │ │ ├── mavlink_msg_mission_set_current.h
│ │ │ ├── mavlink_msg_mission_write_partial_list.h
│ │ │ ├── mavlink_msg_named_value_float.h
│ │ │ ├── mavlink_msg_named_value_int.h
│ │ │ ├── mavlink_msg_nav_controller_output.h
│ │ │ ├── mavlink_msg_optical_flow.h
│ │ │ ├── mavlink_msg_optical_flow_rad.h
│ │ │ ├── mavlink_msg_param_map_rc.h
│ │ │ ├── mavlink_msg_param_request_list.h
│ │ │ ├── mavlink_msg_param_request_read.h
│ │ │ ├── mavlink_msg_param_set.h
│ │ │ ├── mavlink_msg_param_value.h
│ │ │ ├── mavlink_msg_ping.h
│ │ │ ├── mavlink_msg_position_target_global_int.h
│ │ │ ├── mavlink_msg_position_target_local_ned.h
│ │ │ ├── mavlink_msg_power_status.h
│ │ │ ├── mavlink_msg_radio_status.h
│ │ │ ├── mavlink_msg_raw_imu.h
│ │ │ ├── mavlink_msg_raw_pressure.h
│ │ │ ├── mavlink_msg_rc_channels.h
│ │ │ ├── mavlink_msg_rc_channels_override.h
│ │ │ ├── mavlink_msg_rc_channels_raw.h
│ │ │ ├── mavlink_msg_rc_channels_scaled.h
│ │ │ ├── mavlink_msg_request_data_stream.h
│ │ │ ├── mavlink_msg_safety_allowed_area.h
│ │ │ ├── mavlink_msg_safety_set_allowed_area.h
│ │ │ ├── mavlink_msg_scaled_imu.h
│ │ │ ├── mavlink_msg_scaled_imu2.h
│ │ │ ├── mavlink_msg_scaled_imu3.h
│ │ │ ├── mavlink_msg_scaled_pressure.h
│ │ │ ├── mavlink_msg_scaled_pressure2.h
│ │ │ ├── mavlink_msg_serial_control.h
│ │ │ ├── mavlink_msg_servo_output_raw.h
│ │ │ ├── mavlink_msg_set_actuator_control_target.h
│ │ │ ├── mavlink_msg_set_attitude_target.h
│ │ │ ├── mavlink_msg_set_gps_global_origin.h
│ │ │ ├── mavlink_msg_set_mode.h
│ │ │ ├── mavlink_msg_set_position_target_global_int.h
│ │ │ ├── mavlink_msg_set_position_target_local_ned.h
│ │ │ ├── mavlink_msg_sim_state.h
│ │ │ ├── mavlink_msg_statustext.h
│ │ │ ├── mavlink_msg_sys_status.h
│ │ │ ├── mavlink_msg_system_time.h
│ │ │ ├── mavlink_msg_terrain_check.h
│ │ │ ├── mavlink_msg_terrain_data.h
│ │ │ ├── mavlink_msg_terrain_report.h
│ │ │ ├── mavlink_msg_terrain_request.h
│ │ │ ├── mavlink_msg_timesync.h
│ │ │ ├── mavlink_msg_v2_extension.h
│ │ │ ├── mavlink_msg_vfr_hud.h
│ │ │ ├── mavlink_msg_vicon_position_estimate.h
│ │ │ ├── mavlink_msg_vision_position_estimate.h
│ │ │ ├── mavlink_msg_vision_speed_estimate.h
│ │ │ ├── testsuite.h
│ │ │ └── version.h
│ │ ├── matrixpilot
│ │ │ ├── matrixpilot.h
│ │ │ ├── mavlink.h
│ │ │ ├── mavlink_msg_airspeeds.h
│ │ │ ├── mavlink_msg_altitudes.h
│ │ │ ├── mavlink_msg_flexifunction_buffer_function.h
│ │ │ ├── mavlink_msg_flexifunction_buffer_function_ack.h
│ │ │ ├── mavlink_msg_flexifunction_command.h
│ │ │ ├── mavlink_msg_flexifunction_command_ack.h
│ │ │ ├── mavlink_msg_flexifunction_directory.h
│ │ │ ├── mavlink_msg_flexifunction_directory_ack.h
│ │ │ ├── mavlink_msg_flexifunction_read_req.h
│ │ │ ├── mavlink_msg_flexifunction_set.h
│ │ │ ├── mavlink_msg_serial_udb_extra_f13.h
│ │ │ ├── mavlink_msg_serial_udb_extra_f14.h
│ │ │ ├── mavlink_msg_serial_udb_extra_f15.h
│ │ │ ├── mavlink_msg_serial_udb_extra_f16.h
│ │ │ ├── mavlink_msg_serial_udb_extra_f2_a.h
│ │ │ ├── mavlink_msg_serial_udb_extra_f2_b.h
│ │ │ ├── mavlink_msg_serial_udb_extra_f4.h
│ │ │ ├── mavlink_msg_serial_udb_extra_f5.h
│ │ │ ├── mavlink_msg_serial_udb_extra_f6.h
│ │ │ ├── mavlink_msg_serial_udb_extra_f7.h
│ │ │ ├── mavlink_msg_serial_udb_extra_f8.h
│ │ │ ├── testsuite.h
│ │ │ └── version.h
│ │ ├── mavlink_conversions.h
│ │ ├── mavlink_helpers.h
│ │ ├── mavlink_types.h
│ │ ├── minimal
│ │ │ ├── mavlink.h
│ │ │ ├── mavlink_msg_heartbeat.h
│ │ │ ├── minimal.h
│ │ │ ├── testsuite.h
│ │ │ └── version.h
│ │ ├── pixhawk
│ │ │ ├── mavlink.h
│ │ │ ├── mavlink_msg_attitude_control.h
│ │ │ ├── mavlink_msg_brief_feature.h
│ │ │ ├── mavlink_msg_detection_stats.h
│ │ │ ├── mavlink_msg_image_available.h
│ │ │ ├── mavlink_msg_image_trigger_control.h
│ │ │ ├── mavlink_msg_image_triggered.h
│ │ │ ├── mavlink_msg_marker.h
│ │ │ ├── mavlink_msg_onboard_health.h
│ │ │ ├── mavlink_msg_pattern_detected.h
│ │ │ ├── mavlink_msg_point_of_interest.h
│ │ │ ├── mavlink_msg_point_of_interest_connection.h
│ │ │ ├── mavlink_msg_position_control_setpoint.h
│ │ │ ├── mavlink_msg_raw_aux.h
│ │ │ ├── mavlink_msg_set_cam_shutter.h
│ │ │ ├── mavlink_msg_set_position_control_offset.h
│ │ │ ├── mavlink_msg_watchdog_command.h
│ │ │ ├── mavlink_msg_watchdog_heartbeat.h
│ │ │ ├── mavlink_msg_watchdog_process_info.h
│ │ │ ├── mavlink_msg_watchdog_process_status.h
│ │ │ ├── pixhawk.h
│ │ │ ├── testsuite.h
│ │ │ └── version.h
│ │ ├── protocol.h
│ │ ├── slugs
│ │ │ ├── mavlink.h
│ │ │ ├── mavlink_msg_boot.h
│ │ │ ├── mavlink_msg_control_surface.h
│ │ │ ├── mavlink_msg_cpu_load.h
│ │ │ ├── mavlink_msg_ctrl_srfc_pt.h
│ │ │ ├── mavlink_msg_data_log.h
│ │ │ ├── mavlink_msg_diagnostic.h
│ │ │ ├── mavlink_msg_gps_date_time.h
│ │ │ ├── mavlink_msg_isr_location.h
│ │ │ ├── mavlink_msg_mid_lvl_cmds.h
│ │ │ ├── mavlink_msg_novatel_diag.h
│ │ │ ├── mavlink_msg_ptz_status.h
│ │ │ ├── mavlink_msg_sensor_bias.h
│ │ │ ├── mavlink_msg_sensor_diag.h
│ │ │ ├── mavlink_msg_slugs_camera_order.h
│ │ │ ├── mavlink_msg_slugs_configuration_camera.h
│ │ │ ├── mavlink_msg_slugs_mobile_location.h
│ │ │ ├── mavlink_msg_slugs_navigation.h
│ │ │ ├── mavlink_msg_status_gps.h
│ │ │ ├── mavlink_msg_uav_status.h
│ │ │ ├── mavlink_msg_volt_sensor.h
│ │ │ ├── slugs.h
│ │ │ ├── testsuite.h
│ │ │ └── version.h
│ │ ├── test
│ │ │ ├── mavlink.h
│ │ │ ├── mavlink_msg_test_types.h
│ │ │ ├── test.h
│ │ │ ├── testsuite.h
│ │ │ └── version.h
│ │ └── ualberta
│ │ │ ├── mavlink.h
│ │ │ ├── mavlink_msg_nav_filter_bias.h
│ │ │ ├── mavlink_msg_radio_calibration.h
│ │ │ ├── mavlink_msg_ualberta_sys_status.h
│ │ │ ├── testsuite.h
│ │ │ ├── ualberta.h
│ │ │ └── version.h
│ ├── msp
│ │ ├── msp.c
│ │ ├── msp.h
│ │ ├── msp_protocol.h
│ │ ├── msp_serial.c
│ │ └── msp_serial.h
│ ├── osd
│ │ ├── boot.c
│ │ ├── cleanflight_osd.c
│ │ ├── cleanflight_osd.h
│ │ ├── config.c
│ │ ├── config.h
│ │ ├── fc_state.c
│ │ ├── fc_state.h
│ │ ├── fonts
│ │ │ ├── font_max7456_12x18.c
│ │ │ └── font_max7456_12x18.h
│ │ ├── msp_client_osd.c
│ │ ├── msp_client_osd.h
│ │ ├── msp_server_osd.c
│ │ ├── msp_server_osd.h
│ │ ├── osd.c
│ │ ├── osd.h
│ │ ├── osd_max7456.c
│ │ ├── osd_serial.c
│ │ ├── osd_serial.h
│ │ ├── osd_tasks.c
│ │ └── osd_tasks.h
│ ├── platform.h
│ ├── rx
│ │ ├── ibus.c
│ │ ├── ibus.h
│ │ ├── msp.c
│ │ ├── msp.h
│ │ ├── pwm.c
│ │ ├── pwm.h
│ │ ├── rx.c
│ │ ├── rx.h
│ │ ├── sbus.c
│ │ ├── sbus.h
│ │ ├── spektrum.c
│ │ ├── spektrum.h
│ │ ├── sumd.c
│ │ ├── sumd.h
│ │ ├── sumh.c
│ │ ├── sumh.h
│ │ ├── xbus.c
│ │ └── xbus.h
│ ├── scheduler
│ │ ├── scheduler.c
│ │ └── scheduler.h
│ ├── sensors
│ │ ├── acceleration.c
│ │ ├── acceleration.h
│ │ ├── barometer.c
│ │ ├── barometer.h
│ │ ├── battery.c
│ │ ├── battery.h
│ │ ├── boardalignment.c
│ │ ├── boardalignment.h
│ │ ├── compass.c
│ │ ├── compass.h
│ │ ├── gyro.c
│ │ ├── gyro.h
│ │ ├── initialisation.c
│ │ ├── initialisation.h
│ │ ├── pitotmeter.c
│ │ ├── pitotmeter.h
│ │ ├── sensors.c
│ │ ├── sensors.h
│ │ ├── sonar.c
│ │ └── sonar.h
│ ├── startup
│ │ ├── startup_stm32f10x_hd_gcc.S
│ │ ├── startup_stm32f10x_md_gcc.S
│ │ ├── startup_stm32f30x_md_gcc.S
│ │ └── startup_stm32f40xx.s
│ ├── target
│ │ ├── ALIENFLIGHTF3
│ │ │ ├── hardware_revision.c
│ │ │ ├── hardware_revision.h
│ │ │ └── target.h
│ │ ├── ANYFC
│ │ │ ├── system_stm32f4xx.c
│ │ │ ├── system_stm32f4xx.h
│ │ │ └── target.h
│ │ ├── CC3D
│ │ │ └── target.h
│ │ ├── CHEBUZZF3
│ │ │ └── target.h
│ │ ├── CJMCU
│ │ │ ├── hardware_revision.c
│ │ │ ├── hardware_revision.h
│ │ │ └── target.h
│ │ ├── COLIBRI
│ │ │ ├── system_stm32f4xx.c
│ │ │ ├── system_stm32f4xx.h
│ │ │ └── target.h
│ │ ├── COLIBRI_RACE
│ │ │ └── target.h
│ │ ├── EUSTM32F103RC
│ │ │ └── target.h
│ │ ├── IRCFUSIONF3
│ │ │ └── target.h
│ │ ├── LUX_RACE
│ │ │ └── target.h
│ │ ├── MOTOLAB
│ │ │ └── target.h
│ │ ├── NAZE
│ │ │ ├── hardware_revision.c
│ │ │ ├── hardware_revision.h
│ │ │ └── target.h
│ │ ├── OLIMEXINO
│ │ │ └── target.h
│ │ ├── PORT103R
│ │ │ └── target.h
│ │ ├── RCEXPLORERF3
│ │ │ └── target.h
│ │ ├── REVO
│ │ │ ├── system_stm32f4xx.c
│ │ │ ├── system_stm32f4xx.h
│ │ │ └── target.h
│ │ ├── RMDO
│ │ │ └── target.h
│ │ ├── SPARKY
│ │ │ └── target.h
│ │ ├── SPRACINGF1OSD
│ │ │ └── target.h
│ │ ├── SPRACINGF3
│ │ │ └── target.h
│ │ ├── SPRACINGF3EVO
│ │ │ └── target.h
│ │ ├── SPRACINGF3MINI
│ │ │ └── target.h
│ │ ├── SPRACINGF3OSD
│ │ │ └── target.h
│ │ ├── STM32F3DISCOVERY
│ │ │ └── target.h
│ │ ├── stm32_flash.ld
│ │ ├── stm32_flash_f103_128k.ld
│ │ ├── stm32_flash_f103_256k.ld
│ │ ├── stm32_flash_f103_64k.ld
│ │ ├── stm32_flash_f303_128k.ld
│ │ ├── stm32_flash_f303_256k.ld
│ │ ├── stm32_flash_f405.ld
│ │ ├── stm32_flash_f405_bl.ld
│ │ ├── system_stm32f30x.c
│ │ └── system_stm32f30x.h
│ ├── telemetry
│ │ ├── frsky.c
│ │ ├── frsky.h
│ │ ├── hott.c
│ │ ├── hott.h
│ │ ├── ltm.c
│ │ ├── ltm.h
│ │ ├── mavlink.c
│ │ ├── mavlink.h
│ │ ├── smartport.c
│ │ ├── smartport.h
│ │ ├── telemetry.c
│ │ └── telemetry.h
│ ├── vcp
│ │ ├── hw_config.c
│ │ ├── hw_config.h
│ │ ├── platform_config.h
│ │ ├── stm32_it.c
│ │ ├── stm32_it.h
│ │ ├── usb_conf.h
│ │ ├── usb_desc.c
│ │ ├── usb_desc.h
│ │ ├── usb_endp.c
│ │ ├── usb_istr.c
│ │ ├── usb_istr.h
│ │ ├── usb_prop.c
│ │ ├── usb_prop.h
│ │ ├── usb_pwr.c
│ │ └── usb_pwr.h
│ └── vcpf4
│ │ ├── stm32f4xx_it.c
│ │ ├── stm32f4xx_it.h
│ │ ├── usb_bsp.c
│ │ ├── usb_conf.h
│ │ ├── usbd_cdc_vcp.c
│ │ ├── usbd_cdc_vcp.h
│ │ ├── usbd_conf.h
│ │ ├── usbd_desc.c
│ │ ├── usbd_desc.h
│ │ └── usbd_usr.c
└── test
│ ├── Makefile
│ ├── mock
│ ├── mock_flash.cc
│ └── mock_system.cc
│ └── unit
│ ├── alignsensor_unittest.cc
│ ├── baro_bmp085_unittest.cc
│ ├── baro_bmp280_unittest.cc
│ ├── baro_ms5611_unittest.cc
│ ├── battery_unittest.cc
│ ├── common_filter_unittest.cc
│ ├── config_eeprom_unittest.cc
│ ├── config_streamer_unittest.cc
│ ├── encoding_unittest.cc
│ ├── flight_altitudehold_unittest.cc
│ ├── flight_failsafe_unittest.cc
│ ├── flight_imu_unittest.cc
│ ├── flight_mixer_unittest.cc
│ ├── flight_pid_unittest.cc
│ ├── gps_conversion_unittest.cc
│ ├── io_serial_unittest.cc
│ ├── ledstrip_unittest.cc
│ ├── maths_unittest.cc
│ ├── msp_fc_unittest.cc
│ ├── msp_serial_unittest.cc
│ ├── parameter_group.ld
│ ├── platform.h
│ ├── rc_controls_unittest.cc
│ ├── rx_ranges_unittest.cc
│ ├── rx_rx_unittest.cc
│ ├── scheduler_unittest.cc
│ ├── sonar_unittest.cc
│ ├── target.h
│ ├── telemetry_hott_unittest.cc
│ ├── type_conversion_unittest.cc
│ ├── unittest_macros.h
│ └── ws2811_unittest.cc
└── support
├── buildserver
└── upload.php
├── flash.bat
└── stmloader
├── Makefile
├── loader.c
├── serial.c
├── serial.h
├── stmbootloader.c
└── stmbootloader.h
/.gitattributes:
--------------------------------------------------------------------------------
1 | *.md text
2 | *.c text
3 | *.h text
4 | *.cc text
5 | *.S text
6 | *.s text
7 | *.hex -crlf -diff
8 | *.elf -crlf -diff
9 | *.ld text
10 | Makefile eol=lf
11 | *.bat eol=crlf
12 | *.txt text
13 | *.sh eol=lf
14 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | *.o
2 | .DS_Store
3 | *~
4 | *.uvopt
5 | *.dep
6 | *.bak
7 | *.uvgui.*
8 | .project
9 | .settings
10 | .cproject
11 | obj/
12 | patches/
13 | startup_stm32f10x_md_gcc.s
14 | .vagrant/
15 |
16 | # script-generated files
17 | docs/Manual.pdf
18 | README.pdf
19 |
20 | /Debug/
21 |
--------------------------------------------------------------------------------
/.travis.yml:
--------------------------------------------------------------------------------
1 | # boards are ordered by priority so that when monitoring a build developers get feedback on the important ones first.
2 | env:
3 | - RUNTESTS=True
4 | - PUBLISHMETA=True
5 | - PUBLISHDOCS=True
6 | - TARGET=SPRACINGF3MINI
7 | - TARGET=SPRACINGF3EVO
8 | - TARGET=SPRACINGF3
9 | - TARGET=SPRACINGF3OSD
10 | - TARGET=SPRACINGF1OSD
11 | - TARGET=NAZE
12 | - TARGET=CC3D
13 | - TARGET=CJMCU
14 | - TARGET=SPARKY
15 | - TARGET=COLIBRI_RACE
16 | - TARGET=LUX_RACE
17 | - TARGET=MOTOLAB
18 | - TARGET=RMDO
19 | - TARGET=ALIENFLIGHTF3
20 | - TARGET=ALIENFLIGHTF1
21 | - TARGET=STM32F3DISCOVERY
22 | - TARGET=PORT103R
23 | - TARGET=EUSTM32F103RC
24 | - TARGET=CHEBUZZF3
25 | - TARGET=OLIMEXINO
26 | - TARGET=IRCFUSIONF3
27 | - TARGET=RCEXPLORERF3
28 |
29 | # use new docker environment
30 | sudo: false
31 |
32 | addons:
33 | apt:
34 | packages:
35 | - build-essential
36 | - git
37 | - libc6-i386
38 | - zlib1g-dev
39 | - libssl-dev
40 | - wkhtmltopdf
41 | - libxml2-dev
42 | - libxslt-dev
43 |
44 | # We use cpp for unit tests, and c for the main project.
45 | language: cpp
46 | compiler: clang
47 |
48 | before_install:
49 | - curl --retry 10 --retry-max-time 120 -L "https://launchpad.net/gcc-arm-embedded/4.9/4.9-2015-q2-update/+download/gcc-arm-none-eabi-4_9-2015q2-20150609-linux.tar.bz2" | tar xfj -
50 |
51 | install:
52 | - export PATH=$PATH:$PWD/gcc-arm-none-eabi-4_9-2015q2/bin
53 |
54 | before_script: arm-none-eabi-gcc --version
55 | script: ./.travis.sh
56 |
57 | cache: apt
58 |
59 | notifications:
60 | irc: "chat.freenode.net#cleanflight"
61 | use_notice: true
62 | skip_join: true
63 |
--------------------------------------------------------------------------------
/CONTRIBUTING.md:
--------------------------------------------------------------------------------
1 | # Issues and Support.
2 |
3 | Please remember the issue tracker on github is _not_ for user support. Please also do not email developers directly for support. Instead please use IRC or the forums first, then if the problem is confirmed create an issue that details how to repeat the problem so it can be investigated.
4 |
5 | Issues created without steps to repeat are likely to be closed. E-mail requests for support will go un-answered; All support needs to be public so that other people can read the problems and solutions.
6 |
7 | Remember that issues that are due to mis-configuration, wiring or failure to read documentation just takes time away from the developers and can often be solved without developer interaction by other users.
8 |
9 | Please search for existing issues *before* creating new ones.
10 |
11 | # Developers
12 |
13 | Please refer to the development section in the `docs/development` folder.
14 |
15 |
16 |
--------------------------------------------------------------------------------
/JLinkSettings.ini:
--------------------------------------------------------------------------------
1 | [BREAKPOINTS]
2 | ShowInfoWin = 1
3 | EnableFlashBP = 2
4 | BPDuringExecution = 0
5 | [CFI]
6 | CFISize = 0x00
7 | CFIAddr = 0x00
8 | [CPU]
9 | OverrideMemMap = 0
10 | AllowSimulation = 1
11 | ScriptFile=""
12 | [FLASH]
13 | MinNumBytesFlashDL = 0
14 | SkipProgOnCRCMatch = 1
15 | VerifyDownload = 1
16 | AllowCaching = 1
17 | EnableFlashDL = 2
18 | Override = 0
19 | Device="AD7160"
20 | [GENERAL]
21 | WorkRAMSize = 0x00
22 | WorkRAMAddr = 0x00
23 | [SWO]
24 | SWOLogFile=""
25 | [MEM]
26 | RdOverrideOrMask = 0x00
27 | RdOverrideAndMask = 0xFFFFFFFF
28 | RdOverrideAddr = 0xFFFFFFFF
29 | WrOverrideOrMask = 0x00
30 | WrOverrideAndMask = 0xFFFFFFFF
31 | WrOverrideAddr = 0xFFFFFFFF
32 |
--------------------------------------------------------------------------------
/Notes.md:
--------------------------------------------------------------------------------
1 | #Notes
2 |
3 | ## Expected acc/mag/gyro behavior
4 |
5 | Observations of a flight-tested flip32 board in the configurator's 'raw sensor data' tab.
6 |
7 | lift front of board (i.e. pitch back)
8 | gyro y increases (green)
9 | acc x increases (blue)
10 | acc z decreases (red)
11 | mag x decreases (blue)
12 |
13 | lift left of boar (i.e. roll right)
14 | gyro x increases (blue)
15 | acc y increases (green)
16 | mag y decreases (green)
17 | mag z increases (red)
18 |
--------------------------------------------------------------------------------
/Vagrantfile:
--------------------------------------------------------------------------------
1 | # -*- mode: ruby -*-
2 | # vi: set ft=ruby :
3 |
4 | # All Vagrant configuration is done below. The "2" in Vagrant.configure
5 | # configures the configuration version (we support older styles for
6 | # backwards compatibility). Please don't change it unless you know what
7 | # you're doing.
8 | Vagrant.configure(2) do |config|
9 | # The most common configuration options are documented and commented below.
10 | # For a complete reference, please see the online documentation at
11 | # https://docs.vagrantup.com.
12 |
13 | # Every Vagrant development environment requires a box. You can search for
14 | # boxes at https://atlas.hashicorp.com/search.
15 | config.vm.box = "ubuntu/trusty64"
16 |
17 | # Enable provisioning with a shell script. Additional provisioners such as
18 | # Puppet, Chef, Ansible, Salt, and Docker are also available. Please see the
19 | # documentation for more information about their specific syntax and use.
20 | config.vm.provision "shell", inline: <<-SHELL
21 | apt-get remove -y binutils-arm-none-eabi gcc-arm-none-eabi
22 | add-apt-repository ppa:terry.guo/gcc-arm-embedded
23 | apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 6D1D8367A3421AFB
24 | apt-get update
25 | apt-get install -y git gcc-arm-none-eabi=4.9.3.2015q3-1trusty1
26 | SHELL
27 | end
28 |
--------------------------------------------------------------------------------
/build_docs.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | filename=Manual
4 | doc_files=(
5 | 'Introduction.md'
6 | 'Getting Started.md'
7 | 'Safety.md'
8 | 'Installation.md'
9 | 'Configuration.md'
10 | 'Cli.md'
11 | 'Serial.md'
12 | 'Rx.md'
13 | 'Spektrum bind.md'
14 | 'Failsafe.md'
15 | 'Battery.md'
16 | 'Gps.md'
17 | 'Rssi.md'
18 | 'Telemetry.md'
19 | 'LedStrip.md'
20 | 'Display.md'
21 | 'Buzzer.md'
22 | 'Sonar.md'
23 | 'Profiles.md'
24 | 'Modes.md'
25 | 'Inflight Adjustments.md'
26 | 'Controls.md'
27 | 'Gtune.md'
28 | 'Blackbox.md'
29 | 'Migrating from baseflight.md'
30 | 'Boards.md'
31 | 'Board - SPRacingF3Mini.md'
32 | 'Board - SPRacingF3.md'
33 | 'Board - ColibriRace.md'
34 | 'Board - Sparky.md'
35 | 'Board - Motolab.md'
36 | 'Board - RMDO.md'
37 | 'Board - Naze32.md'
38 | 'Board - Paris Air Hero 32.md'
39 | 'Board - AlienFlight.md'
40 | 'Board - CC3D.md'
41 | 'Board - CJMCU.md'
42 | 'Board - Olimexino.md'
43 | 'Board - ChebuzzF3.md'
44 | )
45 |
46 | if which gimli >/dev/null; then
47 | echo "Building ${filename}.pdf"
48 | pushd . >/dev/null
49 | cd docs
50 |
51 | rm -f ${filename}.md
52 | for i in "${doc_files[@]}"
53 | do
54 | cat "$i" >> ${filename}.md
55 | echo >> ${filename}.md
56 | done
57 | rm -f ${filename}.pdf
58 | gimli -f ${filename}.md -stylesheet override.css \
59 | -w '--toc --title "Cleanflight Manual" --footer-right "[page]" --toc-depth 1'
60 | rm ${filename}.md
61 | popd >/dev/null
62 | else
63 | echo -e "\nFAILED"
64 | echo "Install Gimli to build the PDF documentation"
65 | echo -e "https://github.com/walle/gimli\n"
66 | exit 1
67 | fi
68 |
--------------------------------------------------------------------------------
/docs/Installation.md:
--------------------------------------------------------------------------------
1 | # Installation
2 |
3 | ## Using the configurator
4 | This is a generic procedure to flash a board using the configurator. The configurator does not yet support all boards, so please check the documentation corresponding to your board before proceeding.
5 |
6 | Make sure you have the [Cleanflight Configurator](https://github.com/cleanflight/cleanflight-configurator) installed, then:
7 |
8 | * Connect the flight controller to the PC.
9 | * Start the Cleanflight Configurator.
10 | * Click on "Disconnect" if the configurator connected to the board automatically.
11 | * Click on the "Firmware Flasher" tab.
12 | * Make sure you have internet connectivity and click on the "Load Firmware [Online]" button.
13 | * Click on the "Choose a Firmware / Board" dropdown menu, and select the latest stable version for your flight controller.
14 | * IMPORTANT: Read and understand the release notes that are displayed. When upgrading review all release notes since your current firmware.
15 | * If this is the first time Cleanflight is flashed to the board, tick the "Full Chip Erase" checkbox.
16 | * Connect the flight controller board to the PC. Ensure the correct serial port is selected.
17 | * Click on the "Flash Firmware" button and hold still (do not breathe, too).
18 | * When the progress bar becomes green and reads "Programming: SUCCESSFUL" you are done!
19 |
20 | ## Manually
21 |
22 | See the board specific flashing instructions.
23 |
24 | # Upgrading
25 |
26 | When upgrading be sure to backup / dump your existing settings. Some firmware releases are not backwards compatible and default settings are restored when the FC detects an out of date configuration.
27 |
28 | ## Backup/Restore process
29 |
30 | See the CLI section of the docs for details on how to backup and restore your configuration via the CLI.
31 |
--------------------------------------------------------------------------------
/docs/Introduction.md:
--------------------------------------------------------------------------------
1 | # Cleanflight
2 |
3 | 
4 |
5 | Welcome to CleanFlight!
6 |
7 | Cleanflight is an community project which attempts to deliver flight controller firmware and related tools.
8 |
9 | ## Primary Goals
10 |
11 | * Community driven.
12 | * Friendly project atmosphere.
13 | * Focus on the needs of users.
14 | * Great flight performance.
15 | * Understandable and maintainable code.
16 |
17 | ## Hardware
18 |
19 | See the [flight controller hardware](Boards.md) chapter for details.
20 |
21 | ## Software
22 |
23 | There are two primary components, the firmware and the configuration tool. The firmware is the code that runs on the flight controller board. The GUI configuration tool (configurator) is used to configure the flight controller, it runs on Windows, OSX and Linux.
24 |
25 | ## Feedback & Contributing
26 |
27 | We welcome all feedback. If you love it we want to hear from you, if you have problems please tell us how we could improve things so we can make it better for everyone.
28 |
29 | If you want to contribute please see the notes here:
30 |
31 | https://github.com/cleanflight/cleanflight#contributing
32 |
33 | Developers should read this:
34 |
35 | https://github.com/cleanflight/cleanflight/blob/master/CONTRIBUTING.md
36 |
--------------------------------------------------------------------------------
/docs/Safety.md:
--------------------------------------------------------------------------------
1 | # Safety
2 |
3 | As many can attest, multirotors and RC models in general can be very dangerous, particularly on the test bench. Here are some simple golden rules to save you a trip to the local ER:
4 | * **NEVER** arm your model with propellers fitted unless you intend to fly!
5 | * **Always** remove your propellers if you are setting up for the first time, flashing firmware, or if in any doubt.
6 |
7 | ## Before Installing
8 |
9 | Please consult the [Cli](Cli.md), [Controls](Controls.md), [Failsafe](Failsafe.md) and [Modes](Modes.md)
10 | pages for further important information.
11 |
12 | You are highly advised to use the Receiver tab in the CleanFlight Configurator, making sure your Rx channel
13 | values are centered at 1500 (1520 for Futaba RC) with minimum & maximums of 1000 and 2000 (respectively)
14 | are reached when controls are operated. Failure to configure these ranges properly can create
15 | problems, such as inability to arm (because you can't reach the endpoints) or immediate activation of
16 | [failsafe](Failsafe.md).
17 |
18 | You may have to adjust your channel endpoints and trims/sub-trims on your RC transmitter to achieve the
19 | expected range of 1000 to 2000.
20 |
21 | The referenced values for each channel have marked impact on the operation of the flight controller and the
22 | different flight modes.
23 |
24 | ## Props Spinning When Armed
25 | With the default configuration, when the controller is armed, the propellers *WILL* begin spinning at low speed.
26 | We recommend keeping this setting as it provides a good visual indication the craft is armed.
27 |
28 | If you wish to change this behavior, see the MOTOR_STOP feature in the Configurator and relevant documentation pages.
29 | Enabling this feature will stop the props from spinning when armed.
30 |
--------------------------------------------------------------------------------
/docs/Screenshots/adjustments-incorrect-config-1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sambas/cleanflight/6896918928507719911a34acaf13e72aa4a0553c/docs/Screenshots/adjustments-incorrect-config-1.png
--------------------------------------------------------------------------------
/docs/Screenshots/adjustments-incorrect-config-2-corrected.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sambas/cleanflight/6896918928507719911a34acaf13e72aa4a0553c/docs/Screenshots/adjustments-incorrect-config-2-corrected.png
--------------------------------------------------------------------------------
/docs/Screenshots/adjustments-incorrect-config-2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sambas/cleanflight/6896918928507719911a34acaf13e72aa4a0553c/docs/Screenshots/adjustments-incorrect-config-2.png
--------------------------------------------------------------------------------
/docs/Screenshots/adjustments-pid-via-6pos-and-3pos.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sambas/cleanflight/6896918928507719911a34acaf13e72aa4a0553c/docs/Screenshots/adjustments-pid-via-6pos-and-3pos.png
--------------------------------------------------------------------------------
/docs/Screenshots/adjustments-pid-via-two-3pos.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sambas/cleanflight/6896918928507719911a34acaf13e72aa4a0553c/docs/Screenshots/adjustments-pid-via-two-3pos.png
--------------------------------------------------------------------------------
/docs/Screenshots/adjustments-pitch-and-roll-rate-adjustment-via-3pos.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sambas/cleanflight/6896918928507719911a34acaf13e72aa4a0553c/docs/Screenshots/adjustments-pitch-and-roll-rate-adjustment-via-3pos.png
--------------------------------------------------------------------------------
/docs/Screenshots/adjustments-rate-profile-selection-via-3pos.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sambas/cleanflight/6896918928507719911a34acaf13e72aa4a0553c/docs/Screenshots/adjustments-rate-profile-selection-via-3pos.png
--------------------------------------------------------------------------------
/docs/Screenshots/adjustments-rates-via-a-2pos-and-3pos.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sambas/cleanflight/6896918928507719911a34acaf13e72aa4a0553c/docs/Screenshots/adjustments-rates-via-a-2pos-and-3pos.png
--------------------------------------------------------------------------------
/docs/Screenshots/blackbox-dataflash.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sambas/cleanflight/6896918928507719911a34acaf13e72aa4a0553c/docs/Screenshots/blackbox-dataflash.png
--------------------------------------------------------------------------------
/docs/Screenshots/blackbox-screenshot-1.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sambas/cleanflight/6896918928507719911a34acaf13e72aa4a0553c/docs/Screenshots/blackbox-screenshot-1.jpg
--------------------------------------------------------------------------------
/docs/Screenshots/cleanflight-gui.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sambas/cleanflight/6896918928507719911a34acaf13e72aa4a0553c/docs/Screenshots/cleanflight-gui.png
--------------------------------------------------------------------------------
/docs/Wiring/CC3D - buzzer circuit.pdf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sambas/cleanflight/6896918928507719911a34acaf13e72aa4a0553c/docs/Wiring/CC3D - buzzer circuit.pdf
--------------------------------------------------------------------------------
/docs/Wiring/Crius CO-16 OLED diagram.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sambas/cleanflight/6896918928507719911a34acaf13e72aa4a0553c/docs/Wiring/Crius CO-16 OLED diagram.png
--------------------------------------------------------------------------------
/docs/Wiring/Crius CO-16 OLED modifications.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sambas/cleanflight/6896918928507719911a34acaf13e72aa4a0553c/docs/Wiring/Crius CO-16 OLED modifications.jpg
--------------------------------------------------------------------------------
/docs/Wiring/PPMRSSI conditioning.pdf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sambas/cleanflight/6896918928507719911a34acaf13e72aa4a0553c/docs/Wiring/PPMRSSI conditioning.pdf
--------------------------------------------------------------------------------
/docs/Wiring/blackbox-installation-1.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sambas/cleanflight/6896918928507719911a34acaf13e72aa4a0553c/docs/Wiring/blackbox-installation-1.jpg
--------------------------------------------------------------------------------
/docs/assets/cleanflight/cleanflight-icon_128.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sambas/cleanflight/6896918928507719911a34acaf13e72aa4a0553c/docs/assets/cleanflight/cleanflight-icon_128.png
--------------------------------------------------------------------------------
/docs/assets/cleanflight/cleanflight-logo-light-wide-1-240px-transparent.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sambas/cleanflight/6896918928507719911a34acaf13e72aa4a0553c/docs/assets/cleanflight/cleanflight-logo-light-wide-1-240px-transparent.png
--------------------------------------------------------------------------------
/docs/assets/cleanflight/cleanflight-logo-light-wide-1-240px.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sambas/cleanflight/6896918928507719911a34acaf13e72aa4a0553c/docs/assets/cleanflight/cleanflight-logo-light-wide-1-240px.jpg
--------------------------------------------------------------------------------
/docs/assets/images/StickPositions.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sambas/cleanflight/6896918928507719911a34acaf13e72aa4a0553c/docs/assets/images/StickPositions.png
--------------------------------------------------------------------------------
/docs/assets/images/blheli-bootloader.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sambas/cleanflight/6896918928507719911a34acaf13e72aa4a0553c/docs/assets/images/blheli-bootloader.png
--------------------------------------------------------------------------------
/docs/assets/images/integrate_smartport.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sambas/cleanflight/6896918928507719911a34acaf13e72aa4a0553c/docs/assets/images/integrate_smartport.png
--------------------------------------------------------------------------------
/docs/assets/images/serial1wire-cc3d-wiring.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sambas/cleanflight/6896918928507719911a34acaf13e72aa4a0553c/docs/assets/images/serial1wire-cc3d-wiring.jpg
--------------------------------------------------------------------------------
/docs/assets/images/zadig-dfu.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sambas/cleanflight/6896918928507719911a34acaf13e72aa4a0553c/docs/assets/images/zadig-dfu.png
--------------------------------------------------------------------------------
/docs/development/Building Manual.md:
--------------------------------------------------------------------------------
1 | #Building Manual.
2 |
3 | The manual PDF file is generated by concatenating relevant markdown files and by transforming the result using Gimli to obtain the final PDF file. This steps are handled automatically by the ```build_docs.sh``` script located in the root of the repository next to the Makefile.
4 |
5 | ##Requirements & Installation
6 | The PDF manual generation uses the Gimli for the conversion. It can be installed via ruby gems. On Debian based systems the installation steps are:
7 | ```bash
8 | sudo apt-get install ruby1.9.1 ruby1.9.1-dev rubygems zlib1g-dev wkhtmltopdf libxml2-dev libxslt-dev
9 | sudo gem1.9.1 install gimli
10 | ```
11 |
12 | ##Configuration
13 | All markdown files need to be registered in the ```build_manual.sh``` file individually by modifying the ```doc_files``` variable / array:
14 | ```bash
15 | doc_files=( 'Configuration.md'
16 | 'Board - CC3D.md'
17 | '...'
18 | '...'
19 | )
20 | ```
21 |
--------------------------------------------------------------------------------
/docs/development/Building in Fedora.md:
--------------------------------------------------------------------------------
1 | # Building in Fedora
2 |
3 | Assuming you already have wget and git available, you should be able to build Cleanflight on a fresh install of Fedora with the following commands (tested on F18, F20 and Ubuntu 14.04):
4 |
5 | ```
6 | wget http://distribute.atmel.no/tools/opensource/Atmel-ARM-GNU-Toolchain/4.8.4/arm-gnu-toolchain-4.8.4.371-linux.any.x86_64.tar.gz
7 |
8 | tar xf arm-gnu-toolchain-4.8.4.371-linux.any.x86_64.tar.gz
9 | export PATH=$PATH:$PWD/arm-none-eabi/bin
10 |
11 | git clone https://github.com/cleanflight/cleanflight.git
12 | cd cleanflight
13 | TARGET=NAZE make
14 | ```
15 |
16 | This will create cleanflight_NAZE.hex in the obj folder.
17 |
--------------------------------------------------------------------------------
/docs/development/Travis.md:
--------------------------------------------------------------------------------
1 | #Travis
2 |
3 | Cleanflight provides Travis build and config files in the repository root.
4 |
5 | ## Pushing builds to a remote server
6 |
7 | ```.travis.sh``` script can upload build artifacts to a remote server. This feature is controlled by the
8 | ```PUBLISH_URL``` environment variable. If set, the build script will use the cURL binary and simulate
9 | a file upload post to the configured server.
10 |
11 | Pleas check the ```notifications``` section in the ```.travis.yml``` file and adjust the irc notifications if you plan on using Travis on your Cleanflight fork
12 |
--------------------------------------------------------------------------------
/docs/development/assets/001.cygwin_dl.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sambas/cleanflight/6896918928507719911a34acaf13e72aa4a0553c/docs/development/assets/001.cygwin_dl.png
--------------------------------------------------------------------------------
/docs/development/assets/002.cygwin_setup.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sambas/cleanflight/6896918928507719911a34acaf13e72aa4a0553c/docs/development/assets/002.cygwin_setup.png
--------------------------------------------------------------------------------
/docs/development/assets/003.cygwin_setup.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sambas/cleanflight/6896918928507719911a34acaf13e72aa4a0553c/docs/development/assets/003.cygwin_setup.png
--------------------------------------------------------------------------------
/docs/development/assets/004.cygwin_setup.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sambas/cleanflight/6896918928507719911a34acaf13e72aa4a0553c/docs/development/assets/004.cygwin_setup.png
--------------------------------------------------------------------------------
/docs/development/assets/005.cygwin_setup.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sambas/cleanflight/6896918928507719911a34acaf13e72aa4a0553c/docs/development/assets/005.cygwin_setup.png
--------------------------------------------------------------------------------
/docs/development/assets/006.cygwin_setup.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sambas/cleanflight/6896918928507719911a34acaf13e72aa4a0553c/docs/development/assets/006.cygwin_setup.png
--------------------------------------------------------------------------------
/docs/development/assets/007.cygwin_setup.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sambas/cleanflight/6896918928507719911a34acaf13e72aa4a0553c/docs/development/assets/007.cygwin_setup.png
--------------------------------------------------------------------------------
/docs/development/assets/008.toolchain.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sambas/cleanflight/6896918928507719911a34acaf13e72aa4a0553c/docs/development/assets/008.toolchain.png
--------------------------------------------------------------------------------
/docs/development/assets/009.toolchain_path.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sambas/cleanflight/6896918928507719911a34acaf13e72aa4a0553c/docs/development/assets/009.toolchain_path.png
--------------------------------------------------------------------------------
/docs/development/assets/010.toolchain_path.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sambas/cleanflight/6896918928507719911a34acaf13e72aa4a0553c/docs/development/assets/010.toolchain_path.png
--------------------------------------------------------------------------------
/docs/development/assets/011.git_checkout.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sambas/cleanflight/6896918928507719911a34acaf13e72aa4a0553c/docs/development/assets/011.git_checkout.png
--------------------------------------------------------------------------------
/docs/development/assets/012.git_checkout.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sambas/cleanflight/6896918928507719911a34acaf13e72aa4a0553c/docs/development/assets/012.git_checkout.png
--------------------------------------------------------------------------------
/docs/development/assets/013.compile.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sambas/cleanflight/6896918928507719911a34acaf13e72aa4a0553c/docs/development/assets/013.compile.png
--------------------------------------------------------------------------------
/docs/development/assets/hardware/OLIMEX-ARM-JTAG-ADAPTER-2144328-40.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sambas/cleanflight/6896918928507719911a34acaf13e72aa4a0553c/docs/development/assets/hardware/OLIMEX-ARM-JTAG-ADAPTER-2144328-40.jpg
--------------------------------------------------------------------------------
/docs/development/assets/hardware/THAOYU-USB-MiniJTAG.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sambas/cleanflight/6896918928507719911a34acaf13e72aa4a0553c/docs/development/assets/hardware/THAOYU-USB-MiniJTAG.jpg
--------------------------------------------------------------------------------
/docs/development/assets/hardware/cepark-stlink-v2-front.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sambas/cleanflight/6896918928507719911a34acaf13e72aa4a0553c/docs/development/assets/hardware/cepark-stlink-v2-front.jpg
--------------------------------------------------------------------------------
/docs/development/assets/hardware/cjmcu-jlink-back.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sambas/cleanflight/6896918928507719911a34acaf13e72aa4a0553c/docs/development/assets/hardware/cjmcu-jlink-back.jpg
--------------------------------------------------------------------------------
/docs/development/assets/hardware/cjmcu-jlink-front.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sambas/cleanflight/6896918928507719911a34acaf13e72aa4a0553c/docs/development/assets/hardware/cjmcu-jlink-front.jpg
--------------------------------------------------------------------------------
/docs/development/assets/hardware/j-link-edu.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sambas/cleanflight/6896918928507719911a34acaf13e72aa4a0553c/docs/development/assets/hardware/j-link-edu.jpg
--------------------------------------------------------------------------------
/docs/development/assets/mac-prompt-tools-install.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sambas/cleanflight/6896918928507719911a34acaf13e72aa4a0553c/docs/development/assets/mac-prompt-tools-install.png
--------------------------------------------------------------------------------
/docs/override.css:
--------------------------------------------------------------------------------
1 | IMG {
2 | max-width: 700px;
3 | }
4 |
5 | /* mainly for the cli reference table */
6 | TABLE TR TD, TABLE TR TH {
7 | font-size: 9px
8 | }
9 |
--------------------------------------------------------------------------------
/fake_travis_build.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | targets=("PUBLISHMETA=True" \
4 | "RUNTESTS=True" \
5 | "TARGET=SPRACINGF3MINI" \
6 | "TARGET=SPRACINGF3" \
7 | "TARGET=SPRACINGF3EVO" \
8 | "TARGET=NAZE" \
9 | "TARGET=CC3D" \
10 | "TARGET=CJMCU" \
11 | "TARGET=SPARKY" \
12 | "TARGET=COLIBRI_RACE" \
13 | "TARGET=LUX_RACE" \
14 | "TARGET=MOTOLAB" \
15 | "TARGET=RMDO" \
16 | "TARGET=ALIENFLIGHTF3" \
17 | "TARGET=ALIENFLIGHTF1" \
18 | "TARGET=STM32F3DISCOVERY" \
19 | "TARGET=PORT103R" \
20 | "TARGET=EUSTM32F103RC" \
21 | "TARGET=CHEBUZZF3" \
22 | "TARGET=OLIMEXINO" \
23 | "TARGET=IRCFUSIONF3" \
24 | "TARGET=RCEXPLORERF3" )
25 |
26 | #fake a travis build environment
27 | export TRAVIS_BUILD_NUMBER=$(date +%s)
28 | export BUILDNAME=${BUILDNAME:=fake_travis}
29 | export TRAVIS_REPO_SLUG=${TRAVIS_REPO_SLUG:=$USER/simulated}
30 |
31 | for target in "${targets[@]}"
32 | do
33 | unset RUNTESTS PUBLISHMETA TARGET
34 | eval "export $target"
35 | make clean
36 | ./.travis.sh
37 | done
38 |
--------------------------------------------------------------------------------
/lib/main/CMSIS/CM1/DeviceSupport/ST/STM32F4xx/stm32f4xx.h:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sambas/cleanflight/6896918928507719911a34acaf13e72aa4a0553c/lib/main/CMSIS/CM1/DeviceSupport/ST/STM32F4xx/stm32f4xx.h
--------------------------------------------------------------------------------
/lib/main/STM32F10x_StdPeriph_Driver/src/stm32f10x_flash.c:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sambas/cleanflight/6896918928507719911a34acaf13e72aa4a0553c/lib/main/STM32F10x_StdPeriph_Driver/src/stm32f10x_flash.c
--------------------------------------------------------------------------------
/lib/main/STM32F10x_StdPeriph_Driver/src/stm32f10x_i2c.c:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sambas/cleanflight/6896918928507719911a34acaf13e72aa4a0553c/lib/main/STM32F10x_StdPeriph_Driver/src/stm32f10x_i2c.c
--------------------------------------------------------------------------------
/lib/main/STM32F10x_StdPeriph_Driver/src/stm32f10x_usart.c:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sambas/cleanflight/6896918928507719911a34acaf13e72aa4a0553c/lib/main/STM32F10x_StdPeriph_Driver/src/stm32f10x_usart.c
--------------------------------------------------------------------------------
/lib/main/STM32F30x_StdPeriph_Driver/Release_Notes.html:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sambas/cleanflight/6896918928507719911a34acaf13e72aa4a0553c/lib/main/STM32F30x_StdPeriph_Driver/Release_Notes.html
--------------------------------------------------------------------------------
/lib/main/STM32F30x_StdPeriph_Driver/inc/stm32f30x_hrtim.h:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sambas/cleanflight/6896918928507719911a34acaf13e72aa4a0553c/lib/main/STM32F30x_StdPeriph_Driver/inc/stm32f30x_hrtim.h
--------------------------------------------------------------------------------
/lib/main/STM32F4xx_StdPeriph_Driver/Release_Notes.html:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sambas/cleanflight/6896918928507719911a34acaf13e72aa4a0553c/lib/main/STM32F4xx_StdPeriph_Driver/Release_Notes.html
--------------------------------------------------------------------------------
/src/main/blackbox/blackbox.h:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of Cleanflight.
3 | *
4 | * Cleanflight is free software: you can redistribute it and/or modify
5 | * it under the terms of the GNU General Public License as published by
6 | * the Free Software Foundation, either version 3 of the License, or
7 | * (at your option) any later version.
8 | *
9 | * Cleanflight is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | * GNU General Public License for more details.
13 | *
14 | * You should have received a copy of the GNU General Public License
15 | * along with Cleanflight. If not, see .
16 | */
17 |
18 | #pragma once
19 |
20 | #include "blackbox/blackbox_fielddefs.h"
21 |
22 | typedef struct blackboxConfig_s {
23 | uint8_t rate_num;
24 | uint8_t rate_denom;
25 | uint8_t device;
26 | } blackboxConfig_t;
27 |
28 | PG_DECLARE(blackboxConfig_t, blackboxConfig);
29 |
30 | void blackboxLogEvent(FlightLogEvent event, flightLogEventData_t *data);
31 |
32 | void initBlackbox(void);
33 | void handleBlackbox(void);
34 | void startBlackbox(void);
35 | void finishBlackbox(void);
36 |
37 | bool blackboxMayEditConfig();
38 |
--------------------------------------------------------------------------------
/src/main/build/build_config.c:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of Cleanflight.
3 | *
4 | * Cleanflight is free software: you can redistribute it and/or modify
5 | * it under the terms of the GNU General Public License as published by
6 | * the Free Software Foundation, either version 3 of the License, or
7 | * (at your option) any later version.
8 | *
9 | * Cleanflight is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | * GNU General Public License for more details.
13 | *
14 | * You should have received a copy of the GNU General Public License
15 | * along with Cleanflight. If not, see .
16 | */
17 |
18 | #include "stdbool.h"
19 | #include "stdint.h"
20 |
21 | #include
22 |
23 | #include "config/parameter_group.h"
24 |
25 | #include "drivers/gpio.h"
26 | #include "drivers/timer.h"
27 | #include "drivers/pwm_mapping.h"
28 | #include "flight/mixer.h"
29 | #include "flight/servos.h"
30 |
31 | #include "build/build_config.h"
32 |
33 | #if MAX_PWM_MOTORS != MAX_SUPPORTED_MOTORS
34 | #error Motor configuration mismatch
35 | #endif
36 |
37 | #if MAX_PWM_SERVOS != MAX_SUPPORTED_SERVOS
38 | #error Servo configuration mismatch
39 | #endif
40 |
--------------------------------------------------------------------------------
/src/main/build/build_config.h:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of Cleanflight.
3 | *
4 | * Cleanflight is free software: you can redistribute it and/or modify
5 | * it under the terms of the GNU General Public License as published by
6 | * the Free Software Foundation, either version 3 of the License, or
7 | * (at your option) any later version.
8 | *
9 | * Cleanflight is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | * GNU General Public License for more details.
13 | *
14 | * You should have received a copy of the GNU General Public License
15 | * along with Cleanflight. If not, see .
16 | */
17 |
18 | #pragma once
19 |
20 | #define UNUSED(x) (void)(x)
21 | #define BUILD_BUG_ON(condition) ((void)sizeof(char[1 - 2*!!(condition)]))
22 |
23 | #ifdef UNIT_TEST
24 | // make these visible to unit test
25 | #define STATIC_UNIT_TESTED
26 | #define STATIC_INLINE_UNIT_TESTED
27 | #define INLINE_UNIT_TESTED
28 | #define UNIT_TESTED
29 | #else
30 | #define STATIC_UNIT_TESTED static
31 | #define STATIC_INLINE_UNIT_TESTED static inline
32 | #define INLINE_UNIT_TESTED inline
33 | #define UNIT_TESTED
34 | #endif
35 |
36 | //#define SOFT_I2C // enable to test software i2c
37 |
38 | #ifndef __CC_ARM
39 | #define REQUIRE_CC_ARM_PRINTF_SUPPORT
40 | #define REQUIRE_PRINTF_LONG_SUPPORT
41 | #endif
42 |
43 |
--------------------------------------------------------------------------------
/src/main/build/debug.c:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of Cleanflight.
3 | *
4 | * Cleanflight is free software: you can redistribute it and/or modify
5 | * it under the terms of the GNU General Public License as published by
6 | * the Free Software Foundation, either version 3 of the License, or
7 | * (at your option) any later version.
8 | *
9 | * Cleanflight is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | * GNU General Public License for more details.
13 | *
14 | * You should have received a copy of the GNU General Public License
15 | * along with Cleanflight. If not, see .
16 | */
17 |
18 | #include "stdint.h"
19 |
20 |
21 | #include "build/debug.h"
22 |
23 | int16_t debug[DEBUG16_VALUE_COUNT];
24 |
25 | #ifdef DEBUG_SECTION_TIMES
26 | uint32_t sectionTimes[2][4];
27 | #endif
28 |
--------------------------------------------------------------------------------
/src/main/build/debug.h:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of Cleanflight.
3 | *
4 | * Cleanflight is free software: you can redistribute it and/or modify
5 | * it under the terms of the GNU General Public License as published by
6 | * the Free Software Foundation, either version 3 of the License, or
7 | * (at your option) any later version.
8 | *
9 | * Cleanflight is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | * GNU General Public License for more details.
13 | *
14 | * You should have received a copy of the GNU General Public License
15 | * along with Cleanflight. If not, see .
16 | */
17 |
18 | #define DEBUG16_VALUE_COUNT 4
19 | extern int16_t debug[DEBUG16_VALUE_COUNT];
20 |
21 | #define DEBUG_SECTION_TIMES
22 |
23 | #ifdef DEBUG_SECTION_TIMES
24 | extern uint32_t sectionTimes[2][4];
25 |
26 | #define TIME_SECTION_BEGIN(index) { \
27 | extern uint32_t sectionTimes[2][4]; \
28 | sectionTimes[0][index] = micros(); \
29 | }
30 |
31 | #define TIME_SECTION_END(index) { \
32 | extern uint32_t sectionTimes[2][4]; \
33 | sectionTimes[1][index] = micros(); \
34 | debug[index] = sectionTimes[1][index] - sectionTimes[0][index]; \
35 | }
36 | #else
37 |
38 | #define TIME_SECTION_BEGIN(index) {}
39 | #define TIME_SECTION_END(index) {}
40 |
41 | #endif
42 |
--------------------------------------------------------------------------------
/src/main/build/version.c:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of Cleanflight.
3 | *
4 | * Cleanflight is free software: you can redistribute it and/or modify
5 | * it under the terms of the GNU General Public License as published by
6 | * the Free Software Foundation, either version 3 of the License, or
7 | * (at your option) any later version.
8 | *
9 | * Cleanflight is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | * GNU General Public License for more details.
13 | *
14 | * You should have received a copy of the GNU General Public License
15 | * along with Cleanflight. If not, see .
16 | */
17 |
18 | #include "build/version.h"
19 |
20 | const char * const targetName = __TARGET__;
21 | const char * const shortGitRevision = __REVISION__;
22 | const char * const buildDate = __DATE__;
23 | const char * const buildTime = __TIME__;
24 |
--------------------------------------------------------------------------------
/src/main/build/version.h:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of Cleanflight.
3 | *
4 | * Cleanflight is free software: you can redistribute it and/or modify
5 | * it under the terms of the GNU General Public License as published by
6 | * the Free Software Foundation, either version 3 of the License, or
7 | * (at your option) any later version.
8 | *
9 | * Cleanflight is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | * GNU General Public License for more details.
13 | *
14 | * You should have received a copy of the GNU General Public License
15 | * along with Cleanflight. If not, see .
16 | */
17 |
18 | #define FC_VERSION_MAJOR 1 // increment when a major release is made (big new feature, etc)
19 | #define FC_VERSION_MINOR 13 // increment when a minor release is made (small new feature, change etc)
20 | #define FC_VERSION_PATCH_LEVEL 0 // increment when a bug is fixed
21 |
22 | #define STR_HELPER(x) #x
23 | #define STR(x) STR_HELPER(x)
24 | #define FC_VERSION_STRING STR(FC_VERSION_MAJOR) "." STR(FC_VERSION_MINOR) "." STR(FC_VERSION_PATCH_LEVEL)
25 |
26 | #define MW_VERSION 231
27 |
28 | extern const char* const targetName;
29 |
30 | #define GIT_SHORT_REVISION_LENGTH 7 // lower case hexadecimal digits.
31 | extern const char* const shortGitRevision;
32 |
33 | #define BUILD_DATE_LENGTH 11
34 | extern const char* const buildDate; // "MMM DD YYYY" MMM = Jan/Feb/...
35 |
36 | #define BUILD_TIME_LENGTH 8
37 | extern const char* const buildTime; // "HH:MM:SS"
38 |
--------------------------------------------------------------------------------
/src/main/common/axis.h:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of Cleanflight.
3 | *
4 | * Cleanflight is free software: you can redistribute it and/or modify
5 | * it under the terms of the GNU General Public License as published by
6 | * the Free Software Foundation, either version 3 of the License, or
7 | * (at your option) any later version.
8 | *
9 | * Cleanflight is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | * GNU General Public License for more details.
13 | *
14 | * You should have received a copy of the GNU General Public License
15 | * along with Cleanflight. If not, see .
16 | */
17 |
18 | #pragma once
19 |
20 | typedef enum {
21 | X = 0,
22 | Y,
23 | Z
24 | } axis_e;
25 |
26 | #define XYZ_AXIS_COUNT 3
27 |
28 | // See http://en.wikipedia.org/wiki/Flight_dynamics
29 | typedef enum {
30 | FD_ROLL = 0,
31 | FD_PITCH,
32 | FD_YAW,
33 | FD_INDEX_COUNT
34 | } flight_dynamics_index_t;
35 |
36 |
37 | typedef enum {
38 | AI_ROLL = 0,
39 | AI_PITCH,
40 | ANGLE_INDEX_COUNT
41 | } angle_index_t;
42 |
43 |
--------------------------------------------------------------------------------
/src/main/common/color.h:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of Cleanflight.
3 | *
4 | * Cleanflight is free software: you can redistribute it and/or modify
5 | * it under the terms of the GNU General Public License as published by
6 | * the Free Software Foundation, either version 3 of the License, or
7 | * (at your option) any later version.
8 | *
9 | * Cleanflight is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | * GNU General Public License for more details.
13 | *
14 | * You should have received a copy of the GNU General Public License
15 | * along with Cleanflight. If not, see .
16 | */
17 |
18 | #pragma once
19 |
20 |
21 | typedef enum {
22 | RGB_RED = 0,
23 | RGB_GREEN,
24 | RGB_BLUE
25 | } colorComponent_e;
26 |
27 | #define RGB_COLOR_COMPONENT_COUNT (RGB_BLUE + 1)
28 |
29 | typedef union {
30 | struct {
31 | uint8_t r;
32 | uint8_t g;
33 | uint8_t b;
34 | } rgb;
35 | uint8_t raw[RGB_COLOR_COMPONENT_COUNT];
36 | } rgbColor24bpp_t;
37 |
38 | #define HSV_HUE_MAX 359
39 | #define HSV_SATURATION_MAX 255
40 | #define HSV_VALUE_MAX 255
41 |
42 | typedef enum {
43 | HSV_HUE = 0,
44 | HSV_SATURATION,
45 | HSV_VALUE
46 | } hsvColorComponent_e;
47 |
48 | #define HSV_COLOR_COMPONENT_COUNT (HSV_VALUE + 1)
49 |
50 | typedef struct hsvColor_s {
51 | uint16_t h; // 0 - 359
52 | uint8_t s; // 0 - 255
53 | uint8_t v; // 0 - 255
54 | } hsvColor_t;
55 |
--------------------------------------------------------------------------------
/src/main/common/colorconversion.h:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of Cleanflight.
3 | *
4 | * Cleanflight is free software: you can redistribute it and/or modify
5 | * it under the terms of the GNU General Public License as published by
6 | * the Free Software Foundation, either version 3 of the License, or
7 | * (at your option) any later version.
8 | *
9 | * Cleanflight is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | * GNU General Public License for more details.
13 | *
14 | * You should have received a copy of the GNU General Public License
15 | * along with Cleanflight. If not, see .
16 | */
17 | #pragma once
18 |
19 | rgbColor24bpp_t hsvToRgb24(const hsvColor_t *c);
20 |
--------------------------------------------------------------------------------
/src/main/common/encoding.c:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of Cleanflight.
3 | *
4 | * Cleanflight is free software: you can redistribute it and/or modify
5 | * it under the terms of the GNU General Public License as published by
6 | * the Free Software Foundation, either version 3 of the License, or
7 | * (at your option) any later version.
8 | *
9 | * Cleanflight is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | * GNU General Public License for more details.
13 | *
14 | * You should have received a copy of the GNU General Public License
15 | * along with Cleanflight. If not, see .
16 | */
17 |
18 | #include "encoding.h"
19 |
20 | /**
21 | * Cast the in-memory representation of the given float directly to an int.
22 | *
23 | * This is useful for printing the hex representation of a float number (which is considerably cheaper
24 | * than a full decimal float formatter, in both code size and output length).
25 | */
26 | uint32_t castFloatBytesToInt(float f)
27 | {
28 | union floatConvert_t {
29 | float f;
30 | uint32_t u;
31 | } floatConvert;
32 |
33 | floatConvert.f = f;
34 |
35 | return floatConvert.u;
36 | }
37 |
38 | /**
39 | * ZigZag encoding maps all values of a signed integer into those of an unsigned integer in such
40 | * a way that numbers of small absolute value correspond to small integers in the result.
41 | *
42 | * (Compared to just casting a signed to an unsigned which creates huge resulting numbers for
43 | * small negative integers).
44 | */
45 | uint32_t zigzagEncode(int32_t value)
46 | {
47 | return (uint32_t)((value << 1) ^ (value >> 31));
48 | }
49 |
--------------------------------------------------------------------------------
/src/main/common/encoding.h:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of Cleanflight.
3 | *
4 | * Cleanflight is free software: you can redistribute it and/or modify
5 | * it under the terms of the GNU General Public License as published by
6 | * the Free Software Foundation, either version 3 of the License, or
7 | * (at your option) any later version.
8 | *
9 | * Cleanflight is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | * GNU General Public License for more details.
13 | *
14 | * You should have received a copy of the GNU General Public License
15 | * along with Cleanflight. If not, see .
16 | */
17 |
18 | #pragma once
19 |
20 | #include
21 |
22 | uint32_t castFloatBytesToInt(float f);
23 | uint32_t zigzagEncode(int32_t value);
24 |
--------------------------------------------------------------------------------
/src/main/common/filter.h:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of Cleanflight.
3 | *
4 | * Cleanflight is free software: you can redistribute it and/or modify
5 | * it under the terms of the GNU General Public License as published by
6 | * the Free Software Foundation, either version 3 of the License, or
7 | * (at your option) any later version.
8 | *
9 | * Cleanflight is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | * GNU General Public License for more details.
13 | *
14 | * You should have received a copy of the GNU General Public License
15 | * along with Cleanflight. If not, see .
16 | */
17 |
18 | typedef struct pt1Filter_s {
19 | float state;
20 | float RC;
21 | float dT;
22 | } pt1Filter_t;
23 |
24 | /* this holds the data required to update samples thru a filter */
25 | typedef struct biquad_s {
26 | float b0, b1, b2, a1, a2;
27 | float x1, x2, y1, y2;
28 | } biquad_t;
29 |
30 | float applyBiQuadFilter(float sample, biquad_t *state);
31 | void BiQuadNewLpf(float filterCutFreq, biquad_t *newState, uint32_t refreshRate);
32 |
33 | void pt1FilterInit(pt1Filter_t *filter, uint8_t f_cut, float dT);
34 | float pt1FilterApply(pt1Filter_t *filter, float input);
35 | float pt1FilterApply4(pt1Filter_t *filter, float input, uint8_t f_cut, float dT);
36 |
37 | int32_t filterApplyAverage(int32_t input, uint8_t count, int32_t averageState[]);
38 | float filterApplyAveragef(float input, uint8_t count, float averageState[]);
39 |
--------------------------------------------------------------------------------
/src/main/common/streambuf.h:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of Cleanflight.
3 | *
4 | * Cleanflight is free software: you can redistribute it and/or modify
5 | * it under the terms of the GNU General Public License as published by
6 | * the Free Software Foundation, either version 3 of the License, or
7 | * (at your option) any later version.
8 | *
9 | * Cleanflight is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | * GNU General Public License for more details.
13 | *
14 | * You should have received a copy of the GNU General Public License
15 | * along with Cleanflight. If not, see .
16 | */
17 |
18 | #pragma once
19 |
20 | #include
21 |
22 | // simple buffer-based serializer/deserializer without implicit size check
23 | // little-endian encoding implemneted now
24 |
25 | typedef struct sbuf_s {
26 | uint8_t *ptr; // data pointer must be first (sbuff_t* is equivalent to uint8_t **)
27 | uint8_t *end;
28 | } sbuf_t;
29 |
30 | void sbufWriteU8(sbuf_t *dst, uint8_t val);
31 | void sbufWriteU16(sbuf_t *dst, uint16_t val);
32 | void sbufWriteU32(sbuf_t *dst, uint32_t val);
33 | void sbufWriteData(sbuf_t *dst, const void *data, int len);
34 | void sbufWriteString(sbuf_t *dst, const char *string);
35 |
36 | uint8_t sbufReadU8(sbuf_t *src);
37 | uint16_t sbufReadU16(sbuf_t *src);
38 | uint32_t sbufReadU32(sbuf_t *src);
39 | void sbufReadData(sbuf_t *dst, void *data, int len);
40 |
41 | int sbufBytesRemaining(sbuf_t *buf);
42 | uint8_t* sbufPtr(sbuf_t *buf);
43 | void sbufAdvance(sbuf_t *buf, int size);
44 |
45 | void sbufSwitchToReader(sbuf_t *buf, uint8_t * base);
46 |
--------------------------------------------------------------------------------
/src/main/common/typeconversion.h:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of Cleanflight.
3 | *
4 | * Cleanflight is free software: you can redistribute it and/or modify
5 | * it under the terms of the GNU General Public License as published by
6 | * the Free Software Foundation, either version 3 of the License, or
7 | * (at your option) any later version.
8 | *
9 | * Cleanflight is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | * GNU General Public License for more details.
13 | *
14 | * You should have received a copy of the GNU General Public License
15 | * along with Cleanflight. If not, see .
16 | */
17 | #pragma once
18 |
19 | void uli2a(unsigned long int num, unsigned int base, int uc, char *bf);
20 | void li2a(long num, char *bf);
21 | void ui2a(unsigned int num, unsigned int base, int uc, char *bf);
22 | void i2a(int num, char *bf);
23 | char a2i(char ch, const char **src, int base, int *nump);
24 |
25 | #define FTOA_BUFFER_SIZE 13
26 |
27 | char *ftoa(float x, char *floatString);
28 | float fastA2F(const char *p);
29 |
30 | #ifndef HAVE_ITOA_FUNCTION
31 | char *itoa(int i, char *a, int r);
32 | #endif
33 |
--------------------------------------------------------------------------------
/src/main/config/config_eeprom.h:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of Cleanflight.
3 | *
4 | * Cleanflight is free software: you can redistribute it and/or modify
5 | * it under the terms of the GNU General Public License as published by
6 | * the Free Software Foundation, either version 3 of the License, or
7 | * (at your option) any later version.
8 | *
9 | * Cleanflight is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | * GNU General Public License for more details.
13 | *
14 | * You should have received a copy of the GNU General Public License
15 | * along with Cleanflight. If not, see .
16 | */
17 |
18 | #pragma once
19 |
20 | bool isEEPROMContentValid(void);
21 | bool scanEEPROM(bool andLoad);
22 | void writeConfigToEEPROM(void);
23 | void activateProfile(uint8_t profileIndexToActivate);
24 |
--------------------------------------------------------------------------------
/src/main/config/config_streamer.h:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of Cleanflight.
3 | *
4 | * Cleanflight is free software: you can redistribute it and/or modify
5 | * it under the terms of the GNU General Public License as published by
6 | * the Free Software Foundation, either version 3 of the License, or
7 | * (at your option) any later version.
8 | *
9 | * Cleanflight is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | * GNU General Public License for more details.
13 | *
14 | * You should have received a copy of the GNU General Public License
15 | * along with Cleanflight. If not, see .
16 | */
17 |
18 | #pragma once
19 |
20 | #include
21 | #include
22 |
23 | // Streams data out to the EEPROM, padding to the write size as
24 | // needed, and updating the checksum as it goes.
25 |
26 | typedef struct config_streamer_s {
27 | uintptr_t address;
28 | int size;
29 | union {
30 | uint8_t b[4];
31 | uint32_t w;
32 | } buffer;
33 | int at;
34 | int err;
35 | bool unlocked;
36 | } config_streamer_t;
37 |
38 | void config_streamer_init(config_streamer_t *c);
39 |
40 | void config_streamer_start(config_streamer_t *c, uintptr_t base, int size);
41 | int config_streamer_write(config_streamer_t *c, const uint8_t *p, uint32_t size);
42 | int config_streamer_flush(config_streamer_t *c);
43 |
44 | int config_streamer_finish(config_streamer_t *c);
45 | int config_streamer_status(config_streamer_t *c);
46 |
--------------------------------------------------------------------------------
/src/main/config/config_system.h:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of Cleanflight.
3 | *
4 | * Cleanflight is free software: you can redistribute it and/or modify
5 | * it under the terms of the GNU General Public License as published by
6 | * the Free Software Foundation, either version 3 of the License, or
7 | * (at your option) any later version.
8 | *
9 | * Cleanflight is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | * GNU General Public License for more details.
13 | *
14 | * You should have received a copy of the GNU General Public License
15 | * along with Cleanflight. If not, see .
16 | */
17 |
18 | #pragma once
19 |
20 | typedef struct systemConfig_s {
21 | uint8_t emf_avoidance; // change pll settings to avoid noise in the uhf band
22 | uint8_t i2c_highspeed; // Overclock i2c Bus for faster IMU readings
23 | } systemConfig_t;
24 |
25 | PG_DECLARE(systemConfig_t, systemConfig);
26 |
--------------------------------------------------------------------------------
/src/main/config/feature.c:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of Cleanflight.
3 | *
4 | * Cleanflight is free software: you can redistribute it and/or modify
5 | * it under the terms of the GNU General Public License as published by
6 | * the Free Software Foundation, either version 3 of the License, or
7 | * (at your option) any later version.
8 | *
9 | * Cleanflight is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | * GNU General Public License for more details.
13 | *
14 | * You should have received a copy of the GNU General Public License
15 | * along with Cleanflight. If not, see .
16 | */
17 |
18 | #include
19 | #include
20 |
21 | #include
22 |
23 | #include "config/parameter_group.h"
24 | #include "config/parameter_group_ids.h"
25 |
26 | #include "config/feature.h"
27 |
28 | static uint32_t activeFeaturesLatch = 0;
29 |
30 | PG_REGISTER(featureConfig_t, featureConfig, PG_FEATURE_CONFIG, 0);
31 |
32 | void latchActiveFeatures()
33 | {
34 | activeFeaturesLatch = featureConfig()->enabledFeatures;
35 | }
36 |
37 | bool featureConfigured(uint32_t mask)
38 | {
39 | return featureConfig()->enabledFeatures & mask;
40 | }
41 |
42 | bool feature(uint32_t mask)
43 | {
44 | return activeFeaturesLatch & mask;
45 | }
46 |
47 | void featureSet(uint32_t mask)
48 | {
49 | featureConfig()->enabledFeatures |= mask;
50 | }
51 |
52 | void featureClear(uint32_t mask)
53 | {
54 | featureConfig()->enabledFeatures &= ~(mask);
55 | }
56 |
57 | void featureClearAll()
58 | {
59 | featureConfig()->enabledFeatures = 0;
60 | }
61 |
62 | uint32_t featureMask(void)
63 | {
64 | return featureConfig()->enabledFeatures;
65 | }
66 |
--------------------------------------------------------------------------------
/src/main/config/feature.h:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of Cleanflight.
3 | *
4 | * Cleanflight is free software: you can redistribute it and/or modify
5 | * it under the terms of the GNU General Public License as published by
6 | * the Free Software Foundation, either version 3 of the License, or
7 | * (at your option) any later version.
8 | *
9 | * Cleanflight is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | * GNU General Public License for more details.
13 | *
14 | * You should have received a copy of the GNU General Public License
15 | * along with Cleanflight. If not, see .
16 | */
17 |
18 | #pragma once
19 |
20 | typedef struct featureConfig_s {
21 | uint32_t enabledFeatures;
22 | } featureConfig_t;
23 |
24 | PG_DECLARE(featureConfig_t, featureConfig);
25 |
26 | void latchActiveFeatures(void);
27 | bool featureConfigured(uint32_t mask);
28 | bool feature(uint32_t mask);
29 | void featureSet(uint32_t mask);
30 | void featureClear(uint32_t mask);
31 | void featureClearAll(void);
32 | uint32_t featureMask(void);
33 |
--------------------------------------------------------------------------------
/src/main/config/profile.c:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of Cleanflight.
3 | *
4 | * Cleanflight is free software: you can redistribute it and/or modify
5 | * it under the terms of the GNU General Public License as published by
6 | * the Free Software Foundation, either version 3 of the License, or
7 | * (at your option) any later version.
8 | *
9 | * Cleanflight is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | * GNU General Public License for more details.
13 | *
14 | * You should have received a copy of the GNU General Public License
15 | * along with Cleanflight. If not, see .
16 | */
17 |
18 | #include
19 | #include
20 |
21 | #include
22 |
23 | #include "build/build_config.h"
24 |
25 | #include "config/parameter_group.h"
26 | #include "config/parameter_group_ids.h"
27 |
28 | #include "config/profile.h"
29 |
30 | PG_REGISTER(profileSelection_t, profileSelection, PG_PROFILE_SELECTION, 0);
31 |
32 | uint8_t getCurrentProfile(void)
33 | {
34 | return profileSelection()->current_profile_index;
35 | }
36 |
37 | void setProfile(uint8_t profileIndex)
38 | {
39 | if (profileIndex >= MAX_PROFILE_COUNT) // sanity check
40 | profileIndex = 0;
41 |
42 | profileSelection()->current_profile_index = profileIndex;
43 | }
44 |
45 |
--------------------------------------------------------------------------------
/src/main/config/profile.h:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of Cleanflight.
3 | *
4 | * Cleanflight is free software: you can redistribute it and/or modify
5 | * it under the terms of the GNU General Public License as published by
6 | * the Free Software Foundation, either version 3 of the License, or
7 | * (at your option) any later version.
8 | *
9 | * Cleanflight is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | * GNU General Public License for more details.
13 | *
14 | * You should have received a copy of the GNU General Public License
15 | * along with Cleanflight. If not, see .
16 | */
17 |
18 | #pragma once
19 |
20 | #define MAX_PROFILE_COUNT 3 // do not use more than 3 due to some legacy code (e.g. profile selection, msp) and more recent code (config storage)
21 |
22 | typedef struct profileSelection_s {
23 | uint8_t current_profile_index;
24 | } profileSelection_t;
25 |
26 | PG_DECLARE(profileSelection_t, profileSelection);
27 |
28 | uint8_t getCurrentProfile(void);
29 | void setProfile(uint8_t profileIndex);
30 |
--------------------------------------------------------------------------------
/src/main/drivers/accgyro.h:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of Cleanflight.
3 | *
4 | * Cleanflight is free software: you can redistribute it and/or modify
5 | * it under the terms of the GNU General Public License as published by
6 | * the Free Software Foundation, either version 3 of the License, or
7 | * (at your option) any later version.
8 | *
9 | * Cleanflight is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | * GNU General Public License for more details.
13 | *
14 | * You should have received a copy of the GNU General Public License
15 | * along with Cleanflight. If not, see .
16 | */
17 |
18 | #pragma once
19 |
20 | typedef struct gyro_s {
21 | sensorGyroInitFuncPtr init; // initialize function
22 | sensorReadFuncPtr read; // read 3 axis data function
23 | sensorReadFuncPtr temperature; // read temperature if available
24 | sensorIsDataReadyFuncPtr isDataReady; // check if sensor has new readings
25 | float scale; // scalefactor
26 | } gyro_t;
27 |
28 | typedef struct acc_s {
29 | sensorAccInitFuncPtr init; // initialize function
30 | sensorReadFuncPtr read; // read 3 axis data function
31 | uint16_t acc_1G;
32 | char revisionCode; // a revision code for the sensor, if known
33 | } acc_t;
34 |
35 |
--------------------------------------------------------------------------------
/src/main/drivers/accgyro_adxl345.h:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of Cleanflight.
3 | *
4 | * Cleanflight is free software: you can redistribute it and/or modify
5 | * it under the terms of the GNU General Public License as published by
6 | * the Free Software Foundation, either version 3 of the License, or
7 | * (at your option) any later version.
8 | *
9 | * Cleanflight is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | * GNU General Public License for more details.
13 | *
14 | * You should have received a copy of the GNU General Public License
15 | * along with Cleanflight. If not, see .
16 | */
17 |
18 | #pragma once
19 |
20 | typedef struct drv_adxl345_config_s {
21 | bool useFifo;
22 | uint16_t dataRate;
23 | } drv_adxl345_config_t;
24 |
25 | bool adxl345Detect(drv_adxl345_config_t *init, acc_t *acc);
26 |
--------------------------------------------------------------------------------
/src/main/drivers/accgyro_bma280.h:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of Cleanflight.
3 | *
4 | * Cleanflight is free software: you can redistribute it and/or modify
5 | * it under the terms of the GNU General Public License as published by
6 | * the Free Software Foundation, either version 3 of the License, or
7 | * (at your option) any later version.
8 | *
9 | * Cleanflight is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | * GNU General Public License for more details.
13 | *
14 | * You should have received a copy of the GNU General Public License
15 | * along with Cleanflight. If not, see .
16 | */
17 |
18 | #pragma once
19 |
20 | bool bma280Detect(acc_t *acc);
21 |
--------------------------------------------------------------------------------
/src/main/drivers/accgyro_l3g4200d.h:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of Cleanflight.
3 | *
4 | * Cleanflight is free software: you can redistribute it and/or modify
5 | * it under the terms of the GNU General Public License as published by
6 | * the Free Software Foundation, either version 3 of the License, or
7 | * (at your option) any later version.
8 | *
9 | * Cleanflight is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | * GNU General Public License for more details.
13 | *
14 | * You should have received a copy of the GNU General Public License
15 | * along with Cleanflight. If not, see .
16 | */
17 |
18 | #pragma once
19 |
20 | bool l3g4200dDetect(gyro_t *gyro);
21 |
--------------------------------------------------------------------------------
/src/main/drivers/accgyro_l3gd20.h:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of Cleanflight.
3 | *
4 | * Cleanflight is free software: you can redistribute it and/or modify
5 | * it under the terms of the GNU General Public License as published by
6 | * the Free Software Foundation, either version 3 of the License, or
7 | * (at your option) any later version.
8 | *
9 | * Cleanflight is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | * GNU General Public License for more details.
13 | *
14 | * You should have received a copy of the GNU General Public License
15 | * along with Cleanflight. If not, see .
16 | */
17 |
18 | #pragma once
19 |
20 | bool l3gd20Detect(gyro_t *gyro);
21 |
--------------------------------------------------------------------------------
/src/main/drivers/accgyro_lsm303dlhc.h:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sambas/cleanflight/6896918928507719911a34acaf13e72aa4a0553c/src/main/drivers/accgyro_lsm303dlhc.h
--------------------------------------------------------------------------------
/src/main/drivers/accgyro_mma845x.h:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of Cleanflight.
3 | *
4 | * Cleanflight is free software: you can redistribute it and/or modify
5 | * it under the terms of the GNU General Public License as published by
6 | * the Free Software Foundation, either version 3 of the License, or
7 | * (at your option) any later version.
8 | *
9 | * Cleanflight is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | * GNU General Public License for more details.
13 | *
14 | * You should have received a copy of the GNU General Public License
15 | * along with Cleanflight. If not, see .
16 | */
17 |
18 | #pragma once
19 |
20 | bool mma8452Detect(acc_t *acc);
21 |
--------------------------------------------------------------------------------
/src/main/drivers/accgyro_mpu3050.h:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of Cleanflight.
3 | *
4 | * Cleanflight is free software: you can redistribute it and/or modify
5 | * it under the terms of the GNU General Public License as published by
6 | * the Free Software Foundation, either version 3 of the License, or
7 | * (at your option) any later version.
8 | *
9 | * Cleanflight is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | * GNU General Public License for more details.
13 | *
14 | * You should have received a copy of the GNU General Public License
15 | * along with Cleanflight. If not, see .
16 | */
17 |
18 | #pragma once
19 |
20 | // Registers
21 | #define MPU3050_SMPLRT_DIV 0x15
22 | #define MPU3050_DLPF_FS_SYNC 0x16
23 | #define MPU3050_INT_CFG 0x17
24 | #define MPU3050_TEMP_OUT 0x1B
25 | #define MPU3050_GYRO_OUT 0x1D
26 | #define MPU3050_USER_CTRL 0x3D
27 | #define MPU3050_PWR_MGM 0x3E
28 |
29 | bool mpu3050Detect(gyro_t *gyro);
30 |
--------------------------------------------------------------------------------
/src/main/drivers/accgyro_mpu6050.h:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of Cleanflight.
3 | *
4 | * Cleanflight is free software: you can redistribute it and/or modify
5 | * it under the terms of the GNU General Public License as published by
6 | * the Free Software Foundation, either version 3 of the License, or
7 | * (at your option) any later version.
8 | *
9 | * Cleanflight is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | * GNU General Public License for more details.
13 | *
14 | * You should have received a copy of the GNU General Public License
15 | * along with Cleanflight. If not, see .
16 | */
17 |
18 | #pragma once
19 |
20 | bool mpu6050AccDetect(acc_t *acc);
21 | bool mpu6050GyroDetect(gyro_t *gyro);
22 |
--------------------------------------------------------------------------------
/src/main/drivers/accgyro_mpu6500.h:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of Cleanflight.
3 | *
4 | * Cleanflight is free software: you can redistribute it and/or modify
5 | * it under the terms of the GNU General Public License as published by
6 | * the Free Software Foundation, either version 3 of the License, or
7 | * (at your option) any later version.
8 | *
9 | * Cleanflight is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | * GNU General Public License for more details.
13 | *
14 | * You should have received a copy of the GNU General Public License
15 | * along with Cleanflight. If not, see .
16 | */
17 |
18 | #define MPU6500_WHO_AM_I_CONST (0x70)
19 | #define MPU9250_WHO_AM_I_CONST (0x71)
20 |
21 | #define MPU6500_BIT_RESET (0x80)
22 |
23 | #pragma once
24 |
25 | bool mpu6500AccDetect(acc_t *acc);
26 | bool mpu6500GyroDetect(gyro_t *gyro);
27 |
28 | void mpu6500AccInit(acc_t *acc);
29 | void mpu6500GyroInit(uint8_t lpf);
30 |
--------------------------------------------------------------------------------
/src/main/drivers/accgyro_spi_mpu6000.h:
--------------------------------------------------------------------------------
1 |
2 | #pragma once
3 |
4 | #define MPU6000_CONFIG 0x1A
5 |
6 | #define BITS_DLPF_CFG_256HZ 0x00
7 | #define BITS_DLPF_CFG_188HZ 0x01
8 | #define BITS_DLPF_CFG_98HZ 0x02
9 | #define BITS_DLPF_CFG_42HZ 0x03
10 |
11 | #define GYRO_SCALE_FACTOR 0.00053292f // (4/131) * pi/180 (32.75 LSB = 1 DPS)
12 |
13 | #define MPU6000_WHO_AM_I_CONST (0x68)
14 |
15 | bool mpu6000SpiDetect(void);
16 |
17 | bool mpu6000SpiAccDetect(acc_t *acc);
18 | bool mpu6000SpiGyroDetect(gyro_t *gyro);
19 |
20 | bool mpu6000WriteRegister(uint8_t reg, uint8_t data);
21 | bool mpu6000ReadRegister(uint8_t reg, uint8_t length, uint8_t *data);
22 |
--------------------------------------------------------------------------------
/src/main/drivers/accgyro_spi_mpu6500.h:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of Cleanflight.
3 | *
4 | * Cleanflight is free software: you can redistribute it and/or modify
5 | * it under the terms of the GNU General Public License as published by
6 | * the Free Software Foundation, either version 3 of the License, or
7 | * (at your option) any later version.
8 | *
9 | * Cleanflight is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | * GNU General Public License for more details.
13 | *
14 | * You should have received a copy of the GNU General Public License
15 | * along with Cleanflight. If not, see .
16 | */
17 |
18 | #pragma once
19 |
20 | bool mpu6500SpiDetect(void);
21 |
22 | bool mpu6500SpiAccDetect(acc_t *acc);
23 | bool mpu6500SpiGyroDetect(gyro_t *gyro);
24 |
25 | bool mpu6500WriteRegister(uint8_t reg, uint8_t data);
26 | bool mpu6500ReadRegister(uint8_t reg, uint8_t length, uint8_t *data);
27 |
--------------------------------------------------------------------------------
/src/main/drivers/adc_impl.h:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of Cleanflight.
3 | *
4 | * Cleanflight is free software: you can redistribute it and/or modify
5 | * it under the terms of the GNU General Public License as published by
6 | * the Free Software Foundation, either version 3 of the License, or
7 | * (at your option) any later version.
8 | *
9 | * Cleanflight is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | * GNU General Public License for more details.
13 | *
14 | * You should have received a copy of the GNU General Public License
15 | * along with Cleanflight. If not, see .
16 | */
17 |
18 | #pragma once
19 |
20 | extern adc_config_t adcConfig[ADC_CHANNEL_COUNT];
21 | extern volatile uint16_t adcValues[ADC_CHANNEL_COUNT];
22 |
--------------------------------------------------------------------------------
/src/main/drivers/barometer.h:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of Cleanflight.
3 | *
4 | * Cleanflight is free software: you can redistribute it and/or modify
5 | * it under the terms of the GNU General Public License as published by
6 | * the Free Software Foundation, either version 3 of the License, or
7 | * (at your option) any later version.
8 | *
9 | * Cleanflight is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | * GNU General Public License for more details.
13 | *
14 | * You should have received a copy of the GNU General Public License
15 | * along with Cleanflight. If not, see .
16 | */
17 |
18 | #pragma once
19 |
20 | typedef void (*baroOpFuncPtr)(void); // baro start operation
21 | typedef void (*baroCalculateFuncPtr)(int32_t *pressure, int32_t *temperature); // baro calculation (filled params are pressure and temperature)
22 |
23 | typedef struct baro_s {
24 | uint16_t ut_delay;
25 | uint16_t up_delay;
26 | baroOpFuncPtr start_ut;
27 | baroOpFuncPtr get_ut;
28 | baroOpFuncPtr start_up;
29 | baroOpFuncPtr get_up;
30 | baroCalculateFuncPtr calculate;
31 | } baro_t;
32 |
--------------------------------------------------------------------------------
/src/main/drivers/barometer_bmp085.h:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of Cleanflight.
3 | *
4 | * Cleanflight is free software: you can redistribute it and/or modify
5 | * it under the terms of the GNU General Public License as published by
6 | * the Free Software Foundation, either version 3 of the License, or
7 | * (at your option) any later version.
8 | *
9 | * Cleanflight is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | * GNU General Public License for more details.
13 | *
14 | * You should have received a copy of the GNU General Public License
15 | * along with Cleanflight. If not, see .
16 | */
17 |
18 | #pragma once
19 |
20 | typedef struct bmp085Config_s {
21 | uint32_t gpioAPB2Peripherals;
22 | uint16_t xclrGpioPin;
23 | GPIO_TypeDef *xclrGpioPort;
24 | uint16_t eocGpioPin;
25 | GPIO_TypeDef *eocGpioPort;
26 | } bmp085Config_t;
27 |
28 | bool bmp085Detect(const bmp085Config_t *config, baro_t *baro);
29 | void bmp085Disable(const bmp085Config_t *config);
30 |
31 | #if defined(BARO_EOC_GPIO)
32 | bool bmp085TestEOCConnected(const bmp085Config_t *config);
33 | #endif
34 |
35 | #ifdef UNIT_TEST
36 | void RCC_APB2PeriphClockCmd(uint32_t RCC_APB2Periph, FunctionalState NewState);
37 | #endif
38 |
--------------------------------------------------------------------------------
/src/main/drivers/barometer_bmp280.h:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of Cleanflight.
3 | *
4 | * Cleanflight is free software: you can redistribute it and/or modify
5 | * it under the terms of the GNU General Public License as published by
6 | * the Free Software Foundation, either version 3 of the License, or
7 | * (at your option) any later version.
8 | *
9 | * Cleanflight is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | * GNU General Public License for more details.
13 | *
14 | * You should have received a copy of the GNU General Public License
15 | * along with Cleanflight. If not, see .
16 | */
17 |
18 | #pragma once
19 |
20 | bool bmp280Detect(baro_t *baro);
21 |
22 |
--------------------------------------------------------------------------------
/src/main/drivers/barometer_ms5611.h:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of Cleanflight.
3 | *
4 | * Cleanflight is free software: you can redistribute it and/or modify
5 | * it under the terms of the GNU General Public License as published by
6 | * the Free Software Foundation, either version 3 of the License, or
7 | * (at your option) any later version.
8 | *
9 | * Cleanflight is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | * GNU General Public License for more details.
13 | *
14 | * You should have received a copy of the GNU General Public License
15 | * along with Cleanflight. If not, see .
16 | */
17 |
18 | #pragma once
19 |
20 | bool ms5611Detect(baro_t *baro);
21 |
--------------------------------------------------------------------------------
/src/main/drivers/buf_writer.c:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of Cleanflight.
3 | *
4 | * Cleanflight is free software: you can redistribute it and/or modify
5 | * it under the terms of the GNU General Public License as published by
6 | * the Free Software Foundation, either version 3 of the License, or
7 | * (at your option) any later version.
8 | *
9 | * Cleanflight is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | * GNU General Public License for more details.
13 | *
14 | * You should have received a copy of the GNU General Public License
15 | * along with Cleanflight. If not, see .
16 | */
17 |
18 | #include
19 |
20 | #include "buf_writer.h"
21 |
22 | bufWriter_t *bufWriterInit(uint8_t *b, int total_size, bufWrite_t writer, void *arg)
23 | {
24 | bufWriter_t *buf = (bufWriter_t *)b;
25 | buf->writer = writer;
26 | buf->arg = arg;
27 | buf->at = 0;
28 | buf->capacity = total_size - sizeof(*buf);
29 |
30 | return buf;
31 | }
32 |
33 | void bufWriterAppend(bufWriter_t *b, uint8_t ch)
34 | {
35 | b->data[b->at++] = ch;
36 | if (b->at >= b->capacity) {
37 | bufWriterFlush(b);
38 | }
39 | }
40 |
41 | void bufWriterFlush(bufWriter_t *b)
42 | {
43 | if (b->at != 0) {
44 | b->writer(b->arg, b->data, b->at);
45 | b->at = 0;
46 | }
47 | }
48 |
--------------------------------------------------------------------------------
/src/main/drivers/buf_writer.h:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of Cleanflight.
3 | *
4 | * Cleanflight is free software: you can redistribute it and/or modify
5 | * it under the terms of the GNU General Public License as published by
6 | * the Free Software Foundation, either version 3 of the License, or
7 | * (at your option) any later version.
8 | *
9 | * Cleanflight is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | * GNU General Public License for more details.
13 | *
14 | * You should have received a copy of the GNU General Public License
15 | * along with Cleanflight. If not, see .
16 | */
17 |
18 | #pragma once
19 |
20 | // Called to flush the buffer.
21 | typedef void (*bufWrite_t)(void *arg, void *data, int count);
22 |
23 | typedef struct bufWriter_s {
24 | bufWrite_t writer;
25 | void *arg;
26 | uint8_t capacity;
27 | uint8_t at;
28 | uint8_t data[];
29 | } bufWriter_t;
30 |
31 | // Initialise a block of memory as a buffered writer.
32 | //
33 | // b should be sizeof(bufWriter_t) + the number of bytes to buffer.
34 | // total_size should be the total size of b.
35 | //
36 | bufWriter_t *bufWriterInit(uint8_t *b, int total_size, bufWrite_t writer, void *p);
37 | void bufWriterAppend(bufWriter_t *b, uint8_t ch);
38 | void bufWriterFlush(bufWriter_t *b);
39 |
--------------------------------------------------------------------------------
/src/main/drivers/bus_i2c.h:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of Cleanflight.
3 | *
4 | * Cleanflight is free software: you can redistribute it and/or modify
5 | * it under the terms of the GNU General Public License as published by
6 | * the Free Software Foundation, either version 3 of the License, or
7 | * (at your option) any later version.
8 | *
9 | * Cleanflight is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | * GNU General Public License for more details.
13 | *
14 | * You should have received a copy of the GNU General Public License
15 | * along with Cleanflight. If not, see .
16 | */
17 |
18 | #pragma once
19 |
20 | #define I2C_SHORT_TIMEOUT ((uint32_t)0x1000)
21 | #define I2C_LONG_TIMEOUT ((uint32_t)(10 * I2C_SHORT_TIMEOUT))
22 | #define I2C_DEFAULT_TIMEOUT I2C_SHORT_TIMEOUT
23 |
24 | typedef enum I2CDevice {
25 | I2CDEV_1,
26 | I2CDEV_2,
27 | I2CDEV_3,
28 | I2CDEV_MAX = I2CDEV_3,
29 | } I2CDevice;
30 |
31 | void i2cInit(I2CDevice bus);
32 | bool i2cWriteBuffer(uint8_t addr_, uint8_t reg_, uint8_t len_, uint8_t *data, I2CDevice bus);
33 | bool i2cWrite(uint8_t addr_, uint8_t reg, uint8_t data, I2CDevice bus);
34 | bool i2cRead(uint8_t addr_, uint8_t reg, uint8_t len, uint8_t* buf, I2CDevice bus);
35 | uint16_t i2cGetErrorCounter(void);
36 | void i2cSetOverclock(uint8_t OverClock);
37 |
--------------------------------------------------------------------------------
/src/main/drivers/bus_spi.h:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of Cleanflight.
3 | *
4 | * Cleanflight is free software: you can redistribute it and/or modify
5 | * it under the terms of the GNU General Public License as published by
6 | * the Free Software Foundation, either version 3 of the License, or
7 | * (at your option) any later version.
8 | *
9 | * Cleanflight is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | * GNU General Public License for more details.
13 | *
14 | * You should have received a copy of the GNU General Public License
15 | * along with Cleanflight. If not, see .
16 | */
17 |
18 | #pragma once
19 |
20 | #if defined(STM32F40_41xxx)
21 | #define ULTRALOW_SPEED_SPI 256 // 0.328125 MHz
22 | #define LOW_SPEED_SPI 128 // 0.65625 MHz
23 | #define MEDIUM_SPEED_SPI 8 // 11.5 MHz
24 | #define HIGH_SPEED_SPI 4 // 21 MHz
25 | #else
26 | #define ULTRALOW_SPEED_SPI 256 // 0.28125 MHz
27 | #define LOW_SPEED_SPI 128 // 0.5625 MHz
28 | #define MEDIUM_SPEED_SPI 4 // 9 MHz
29 | #define HIGH_SPEED_SPI 2 // 18 MHz
30 | #endif
31 |
32 | bool spiInit(SPI_TypeDef *instance);
33 | void spiSetDivisor(SPI_TypeDef *instance, uint16_t divisor);
34 | uint8_t spiTransferByte(SPI_TypeDef *instance, uint8_t in);
35 | bool spiIsBusBusy(SPI_TypeDef *instance);
36 |
37 | void spiTransfer(SPI_TypeDef *instance, uint8_t *out, const uint8_t *in, int len);
38 |
--------------------------------------------------------------------------------
/src/main/drivers/compass.h:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of Cleanflight.
3 | *
4 | * Cleanflight is free software: you can redistribute it and/or modify
5 | * it under the terms of the GNU General Public License as published by
6 | * the Free Software Foundation, either version 3 of the License, or
7 | * (at your option) any later version.
8 | *
9 | * Cleanflight is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | * GNU General Public License for more details.
13 | *
14 | * You should have received a copy of the GNU General Public License
15 | * along with Cleanflight. If not, see .
16 | */
17 |
18 | #pragma once
19 |
20 | typedef struct mag_s {
21 | sensorInitFuncPtr init; // initialize function
22 | sensorReadFuncPtr read; // read 3 axis data function
23 | } mag_t;
24 |
--------------------------------------------------------------------------------
/src/main/drivers/compass_ak8963.h:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of Cleanflight.
3 | *
4 | * Cleanflight is free software: you can redistribute it and/or modify
5 | * it under the terms of the GNU General Public License as published by
6 | * the Free Software Foundation, either version 3 of the License, or
7 | * (at your option) any later version.
8 | *
9 | * Cleanflight is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | * GNU General Public License for more details.
13 | *
14 | * You should have received a copy of the GNU General Public License
15 | * along with Cleanflight. If not, see .
16 | */
17 |
18 | #pragma once
19 |
20 | bool ak8963Detect(mag_t *mag);
21 | void ak8963Init(void);
22 | bool ak8963Read(int16_t *magData);
23 |
--------------------------------------------------------------------------------
/src/main/drivers/compass_ak8975.h:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of Cleanflight.
3 | *
4 | * Cleanflight is free software: you can redistribute it and/or modify
5 | * it under the terms of the GNU General Public License as published by
6 | * the Free Software Foundation, either version 3 of the License, or
7 | * (at your option) any later version.
8 | *
9 | * Cleanflight is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | * GNU General Public License for more details.
13 | *
14 | * You should have received a copy of the GNU General Public License
15 | * along with Cleanflight. If not, see .
16 | */
17 |
18 | #pragma once
19 |
20 | bool ak8975Detect(mag_t *mag);
21 | void ak8975Init(void);
22 | bool ak8975Read(int16_t *magData);
23 |
--------------------------------------------------------------------------------
/src/main/drivers/compass_hmc5883l.h:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of Cleanflight.
3 | *
4 | * Cleanflight is free software: you can redistribute it and/or modify
5 | * it under the terms of the GNU General Public License as published by
6 | * the Free Software Foundation, either version 3 of the License, or
7 | * (at your option) any later version.
8 | *
9 | * Cleanflight is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | * GNU General Public License for more details.
13 | *
14 | * You should have received a copy of the GNU General Public License
15 | * along with Cleanflight. If not, see .
16 | */
17 |
18 | #pragma once
19 |
20 | typedef struct hmc5883Config_s {
21 | #ifdef STM32F303
22 | uint32_t gpioAHBPeripherals;
23 | #endif
24 | #ifdef STM32F10X
25 | uint32_t gpioAPB2Peripherals;
26 | #endif
27 | uint32_t gpioAHB1Peripherals;
28 | uint16_t gpioPin;
29 | GPIO_TypeDef *gpioPort;
30 |
31 | uint8_t exti_port_source;
32 | uint32_t exti_line;
33 | uint8_t exti_pin_source;
34 | IRQn_Type exti_irqn;
35 | } hmc5883Config_t;
36 |
37 | bool hmc5883lDetect(mag_t* mag, const hmc5883Config_t *hmc5883ConfigToUse);
38 | void hmc5883lInit(void);
39 | bool hmc5883lRead(int16_t *magData);
40 |
--------------------------------------------------------------------------------
/src/main/drivers/display_ug2864hsweg01.h:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of Cleanflight.
3 | *
4 | * Cleanflight is free software: you can redistribute it and/or modify
5 | * it under the terms of the GNU General Public License as published by
6 | * the Free Software Foundation, either version 3 of the License, or
7 | * (at your option) any later version.
8 | *
9 | * Cleanflight is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | * GNU General Public License for more details.
13 | *
14 | * You should have received a copy of the GNU General Public License
15 | * along with Cleanflight. If not, see .
16 | */
17 |
18 | #pragma once
19 |
20 | #define SCREEN_WIDTH 128
21 | #define SCREEN_HEIGHT 64
22 |
23 | #define FONT_WIDTH 5
24 | #define FONT_HEIGHT 7
25 | #define HORIZONTAL_PADDING 1
26 | #define VERTICAL_PADDING 1
27 |
28 | #define CHARACTER_WIDTH_TOTAL (FONT_WIDTH + HORIZONTAL_PADDING)
29 | #define CHARACTER_HEIGHT_TOTAL (FONT_HEIGHT + VERTICAL_PADDING)
30 |
31 | #define SCREEN_CHARACTER_COLUMN_COUNT (SCREEN_WIDTH / CHARACTER_WIDTH_TOTAL)
32 | #define SCREEN_CHARACTER_ROW_COUNT (SCREEN_HEIGHT / CHARACTER_HEIGHT_TOTAL)
33 |
34 | #define VERTICAL_BARGRAPH_ZERO_CHARACTER (128 + 32)
35 | #define VERTICAL_BARGRAPH_CHARACTER_COUNT 7
36 |
37 | bool ug2864hsweg01InitI2C(void);
38 |
39 | void i2c_OLED_set_xy(uint8_t col, uint8_t row);
40 | void i2c_OLED_set_line(uint8_t row);
41 | void i2c_OLED_send_char(unsigned char ascii);
42 | void i2c_OLED_send_string(const char *string);
43 | void i2c_OLED_clear_display(void);
44 | void i2c_OLED_clear_display_quick(void);
45 |
46 |
--------------------------------------------------------------------------------
/src/main/drivers/exti.h:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of Cleanflight.
3 | *
4 | * Cleanflight is free software: you can redistribute it and/or modify
5 | * it under the terms of the GNU General Public License as published by
6 | * the Free Software Foundation, either version 3 of the License, or
7 | * (at your option) any later version.
8 | *
9 | * Cleanflight is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | * GNU General Public License for more details.
13 | *
14 | * You should have received a copy of the GNU General Public License
15 | * along with Cleanflight. If not, see .
16 | */
17 |
18 |
19 | #pragma once
20 |
21 | typedef struct extiConfig_s {
22 | #ifdef STM32F40_41xxx
23 | uint32_t gpioAHB1Peripherals;
24 | #endif
25 | #ifdef STM32F303
26 | uint32_t gpioAHBPeripherals;
27 | #endif
28 | #ifdef STM32F10X
29 | uint32_t gpioAPB2Peripherals;
30 | #endif
31 | uint16_t gpioPin;
32 | GPIO_TypeDef *gpioPort;
33 |
34 | uint8_t exti_port_source;
35 | uint32_t exti_line;
36 | uint8_t exti_pin_source;
37 | IRQn_Type exti_irqn;
38 | } extiConfig_t;
39 |
--------------------------------------------------------------------------------
/src/main/drivers/flash.h:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of Cleanflight.
3 | *
4 | * Cleanflight is free software: you can redistribute it and/or modify
5 | * it under the terms of the GNU General Public License as published by
6 | * the Free Software Foundation, either version 3 of the License, or
7 | * (at your option) any later version.
8 | *
9 | * Cleanflight is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | * GNU General Public License for more details.
13 | *
14 | * You should have received a copy of the GNU General Public License
15 | * along with Cleanflight. If not, see .
16 | */
17 |
18 | #pragma once
19 |
20 | #include
21 |
22 | typedef struct flashGeometry_s {
23 | uint16_t sectors; // Count of the number of erasable blocks on the device
24 |
25 | uint16_t pagesPerSector;
26 | const uint16_t pageSize; // In bytes
27 |
28 | uint32_t sectorSize; // This is just pagesPerSector * pageSize
29 |
30 | uint32_t totalSize; // This is just sectorSize * sectors
31 | } flashGeometry_t;
32 |
--------------------------------------------------------------------------------
/src/main/drivers/flash_m25p16.h:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of Cleanflight.
3 | *
4 | * Cleanflight is free software: you can redistribute it and/or modify
5 | * it under the terms of the GNU General Public License as published by
6 | * the Free Software Foundation, either version 3 of the License, or
7 | * (at your option) any later version.
8 | *
9 | * Cleanflight is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | * GNU General Public License for more details.
13 | *
14 | * You should have received a copy of the GNU General Public License
15 | * along with Cleanflight. If not, see .
16 | */
17 |
18 | #pragma once
19 |
20 | #include
21 | #include "flash.h"
22 |
23 | #define M25P16_PAGESIZE 256
24 |
25 | bool m25p16_init();
26 |
27 | void m25p16_eraseSector(uint32_t address);
28 | void m25p16_eraseCompletely();
29 |
30 | void m25p16_pageProgram(uint32_t address, const uint8_t *data, int length);
31 |
32 | void m25p16_pageProgramBegin(uint32_t address);
33 | void m25p16_pageProgramContinue(const uint8_t *data, int length);
34 | void m25p16_pageProgramFinish();
35 |
36 | int m25p16_readBytes(uint32_t address, uint8_t *buffer, int length);
37 |
38 | bool m25p16_isReady();
39 | bool m25p16_waitForReady(uint32_t timeoutMillis);
40 |
41 | const flashGeometry_t* m25p16_getGeometry();
42 |
--------------------------------------------------------------------------------
/src/main/drivers/gyro_sync.h:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of Cleanflight.
3 | *
4 | * Cleanflight is free software: you can redistribute it and/or modify
5 | * it under the terms of the GNU General Public License as published by
6 | * the Free Software Foundation, either version 3 of the License, or
7 | * (at your option) any later version.
8 | *
9 | * Cleanflight is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | * GNU General Public License for more details.
13 | *
14 | * You should have received a copy of the GNU General Public License
15 | * along with Cleanflight. If not, see .
16 | */
17 |
18 | #define INTERRUPT_WAIT_TIME 10
19 |
20 | extern uint32_t targetLooptime;
21 |
22 | bool gyroSyncCheckUpdate(void);
23 | uint8_t gyroMPU6xxxCalculateDivider(void);
24 | void gyroSetSampleRate(uint32_t looptime, uint8_t lpf, uint8_t gyroSync, uint8_t gyroSyncDenominator);
25 |
--------------------------------------------------------------------------------
/src/main/drivers/inverter.c:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of Cleanflight.
3 | *
4 | * Cleanflight is free software: you can redistribute it and/or modify
5 | * it under the terms of the GNU General Public License as published by
6 | * the Free Software Foundation, either version 3 of the License, or
7 | * (at your option) any later version.
8 | *
9 | * Cleanflight is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | * GNU General Public License for more details.
13 | *
14 | * You should have received a copy of the GNU General Public License
15 | * along with Cleanflight. If not, see .
16 | */
17 |
18 | #include
19 | #include
20 |
21 | #include
22 |
23 | #ifdef INVERTER
24 |
25 | #include "gpio.h"
26 |
27 | #include "inverter.h"
28 |
29 | void initInverter(void)
30 | {
31 | struct {
32 | GPIO_TypeDef *gpio;
33 | gpio_config_t cfg;
34 | } gpio_setup = {
35 | .gpio = INVERTER_GPIO,
36 | // configure for Push-Pull
37 | .cfg = { INVERTER_PIN, Mode_Out_PP, Speed_2MHz }
38 | };
39 |
40 | #if defined(ANYFC) || defined(COLIBRI) || defined(REVO)
41 | RCC_AHB1PeriphClockCmd(INVERTER_PERIPHERAL, ENABLE);
42 | #else
43 | RCC_APB2PeriphClockCmd(INVERTER_PERIPHERAL, ENABLE);
44 | #endif
45 | gpioInit(gpio_setup.gpio, &gpio_setup.cfg);
46 | }
47 |
48 | #endif
49 |
--------------------------------------------------------------------------------
/src/main/drivers/inverter.h:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of Cleanflight.
3 | *
4 | * Cleanflight is free software: you can redistribute it and/or modify
5 | * it under the terms of the GNU General Public License as published by
6 | * the Free Software Foundation, either version 3 of the License, or
7 | * (at your option) any later version.
8 | *
9 | * Cleanflight is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | * GNU General Public License for more details.
13 | *
14 | * You should have received a copy of the GNU General Public License
15 | * along with Cleanflight. If not, see .
16 | */
17 |
18 | #pragma once
19 |
20 | #ifdef INVERTER
21 | #define INVERTER_OFF digitalLo(INVERTER_GPIO, INVERTER_PIN)
22 | #define INVERTER_ON digitalHi(INVERTER_GPIO, INVERTER_PIN)
23 | #else
24 | #define INVERTER_OFF do {} while(0)
25 | #define INVERTER_ON do {} while(0)
26 | #endif
27 |
28 | void initInverter(void);
29 |
30 |
--------------------------------------------------------------------------------
/src/main/drivers/pitotmeter.h:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of Cleanflight.
3 | *
4 | * Cleanflight is free software: you can redistribute it and/or modify
5 | * it under the terms of the GNU General Public License as published by
6 | * the Free Software Foundation, either version 3 of the License, or
7 | * (at your option) any later version.
8 | *
9 | * Cleanflight is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | * GNU General Public License for more details.
13 | *
14 | * You should have received a copy of the GNU General Public License
15 | * along with Cleanflight. If not, see .
16 | */
17 |
18 | #pragma once
19 |
20 | typedef void (*pitotOpFuncPtr)(void); // baro start operation
21 | typedef void (*pitotCalculateFuncPtr)(float *pressure, float *temperature); // baro calculation (filled params are pressure and temperature)
22 |
23 | typedef struct pitot_t {
24 | uint16_t delay;
25 | pitotOpFuncPtr start;
26 | pitotOpFuncPtr get;
27 | pitotCalculateFuncPtr calculate;
28 | } pitot_t;
29 |
--------------------------------------------------------------------------------
/src/main/drivers/pitotmeter_ms4525.h:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of Cleanflight.
3 | *
4 | * Cleanflight is free software: you can redistribute it and/or modify
5 | * it under the terms of the GNU General Public License as published by
6 | * the Free Software Foundation, either version 3 of the License, or
7 | * (at your option) any later version.
8 | *
9 | * Cleanflight is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | * GNU General Public License for more details.
13 | *
14 | * You should have received a copy of the GNU General Public License
15 | * along with Cleanflight. If not, see .
16 | */
17 |
18 | #pragma once
19 |
20 | bool ms4525Detect(pitot_t *pitot);
21 |
--------------------------------------------------------------------------------
/src/main/drivers/pwm_output.h:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of Cleanflight.
3 | *
4 | * Cleanflight is free software: you can redistribute it and/or modify
5 | * it under the terms of the GNU General Public License as published by
6 | * the Free Software Foundation, either version 3 of the License, or
7 | * (at your option) any later version.
8 | *
9 | * Cleanflight is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | * GNU General Public License for more details.
13 | *
14 | * You should have received a copy of the GNU General Public License
15 | * along with Cleanflight. If not, see .
16 | */
17 |
18 | #pragma once
19 |
20 | void pwmWriteMotor(uint8_t index, uint16_t value);
21 | void pwmShutdownPulsesForAllMotors(uint8_t motorCount);
22 | void pwmCompleteOneshotMotorUpdate(uint8_t motorCount);
23 |
24 | void pwmWriteServo(uint8_t index, uint16_t value);
25 |
26 | bool isMotorBrushed(uint16_t motorPwmRate);
27 |
28 | void pwmDisableMotors(void);
29 | void pwmEnableMotors(void);
30 |
--------------------------------------------------------------------------------
/src/main/drivers/pwm_rx.h:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of Cleanflight.
3 | *
4 | * Cleanflight is free software: you can redistribute it and/or modify
5 | * it under the terms of the GNU General Public License as published by
6 | * the Free Software Foundation, either version 3 of the License, or
7 | * (at your option) any later version.
8 | *
9 | * Cleanflight is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | * GNU General Public License for more details.
13 | *
14 | * You should have received a copy of the GNU General Public License
15 | * along with Cleanflight. If not, see .
16 | */
17 |
18 | #pragma once
19 |
20 | typedef enum {
21 | INPUT_FILTERING_DISABLED = 0,
22 | INPUT_FILTERING_ENABLED
23 | } inputFilteringMode_e;
24 |
25 | typedef struct pwmRxConfig_s {
26 | inputFilteringMode_e inputFilteringMode; // Use hardware input filtering, e.g. for OrangeRX PPM/PWM receivers.
27 | } pwmRxConfig_t;
28 |
29 | PG_DECLARE(pwmRxConfig_t, pwmRxConfig);
30 |
31 | #define PPM_RCVR_TIMEOUT 0
32 |
33 |
34 | void ppmInConfig(const timerHardware_t *timerHardwarePtr);
35 | void ppmAvoidPWMTimerClash(const timerHardware_t *timerHardwarePtr, TIM_TypeDef *sharedPwmTimer);
36 |
37 | void pwmInConfig(const timerHardware_t *timerHardwarePtr, uint8_t channel);
38 | uint16_t pwmRead(uint8_t channel);
39 | uint16_t ppmRead(uint8_t channel);
40 |
41 | bool isPPMDataBeingReceived(void);
42 | void resetPPMDataReceivedState(void);
43 |
44 | void pwmRxInit(void);
45 |
46 | bool isPWMDataBeingReceived(void);
47 |
--------------------------------------------------------------------------------
/src/main/drivers/sdcard_standard.c:
--------------------------------------------------------------------------------
1 | #include
2 |
3 | #include "sdcard_standard.h"
4 |
5 | #define MIN(a, b) ((a) < (b) ? (a) : (b))
6 |
7 | /**
8 | * Read a bitfield from an array of bits (the bit at index 0 being the most-significant bit of the first byte in
9 | * the buffer).
10 | */
11 | uint32_t readBitfield(uint8_t *buffer, unsigned bitIndex, unsigned bitLen)
12 | {
13 | uint32_t result = 0;
14 | unsigned bitInByteOffset = bitIndex % 8;
15 | uint8_t bufferByte;
16 |
17 | buffer += bitIndex / 8;
18 |
19 | // Align the bitfield to be read to the top of the buffer
20 | bufferByte = *buffer << bitInByteOffset;
21 |
22 | while (bitLen > 0) {
23 | unsigned bitsThisLoop = MIN(8 - bitInByteOffset, bitLen);
24 |
25 | result = (result << bitsThisLoop) | (bufferByte >> (8 - bitsThisLoop));
26 |
27 | buffer++;
28 | bufferByte = *buffer;
29 |
30 | bitLen -= bitsThisLoop;
31 | bitInByteOffset = 0;
32 | }
33 |
34 | return result;
35 | }
36 |
--------------------------------------------------------------------------------
/src/main/drivers/sensor.h:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of Cleanflight.
3 | *
4 | * Cleanflight is free software: you can redistribute it and/or modify
5 | * it under the terms of the GNU General Public License as published by
6 | * the Free Software Foundation, either version 3 of the License, or
7 | * (at your option) any later version.
8 | *
9 | * Cleanflight is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | * GNU General Public License for more details.
13 | *
14 | * You should have received a copy of the GNU General Public License
15 | * along with Cleanflight. If not, see .
16 | */
17 |
18 | #pragma once
19 |
20 | typedef void (*sensorInitFuncPtr)(void); // sensor init prototype
21 | typedef bool (*sensorReadFuncPtr)(int16_t *data); // sensor read prototype
22 |
23 | struct acc_s;
24 | typedef void (*sensorAccInitFuncPtr)(struct acc_s *acc); // sensor init prototype
25 | typedef void (*sensorGyroInitFuncPtr)(uint8_t lpf); // gyro sensor init prototype
26 | typedef bool (*sensorIsDataReadyFuncPtr)(void); // sensor data ready prototype
27 |
28 |
--------------------------------------------------------------------------------
/src/main/drivers/serial_escserial.h:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of Cleanflight.
3 | *
4 | * Cleanflight is free software: you can redistribute it and/or modify
5 | * it under the terms of the GNU General Public License as published by
6 | * the Free Software Foundation, either version 3 of the License, or
7 | * (at your option) any later version.
8 | *
9 | * Cleanflight is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | * GNU General Public License for more details.
13 | *
14 | * You should have received a copy of the GNU General Public License
15 | * along with Cleanflight. If not, see .
16 | */
17 |
18 | #pragma once
19 |
20 | #define ESCSERIAL_BUFFER_SIZE 1024
21 |
22 | typedef enum {
23 | ESCSERIAL1 = 0,
24 | ESCSERIAL2
25 | } escSerialPortIndex_e;
26 |
27 | serialPort_t *openEscSerial(escSerialPortIndex_e portIndex, serialReceiveCallbackPtr callback, uint16_t output, uint32_t baud, portOptions_t options, uint8_t mode);
28 |
29 | // serialPort API
30 | void escSerialWriteByte(serialPort_t *instance, uint8_t ch);
31 | uint8_t escSerialTotalBytesWaiting(serialPort_t *instance);
32 | uint8_t escSerialReadByte(serialPort_t *instance);
33 | void escSerialSetBaudRate(serialPort_t *s, uint32_t baudRate);
34 | bool isEscSerialTransmitBufferEmpty(serialPort_t *s);
35 | void escSerialInitialize();
36 | void escEnablePassthrough(serialPort_t *escPassthroughPort, uint16_t output, uint8_t mode);
37 |
--------------------------------------------------------------------------------
/src/main/drivers/serial_softserial.h:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of Cleanflight.
3 | *
4 | * Cleanflight is free software: you can redistribute it and/or modify
5 | * it under the terms of the GNU General Public License as published by
6 | * the Free Software Foundation, either version 3 of the License, or
7 | * (at your option) any later version.
8 | *
9 | * Cleanflight is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | * GNU General Public License for more details.
13 | *
14 | * You should have received a copy of the GNU General Public License
15 | * along with Cleanflight. If not, see .
16 | */
17 |
18 | #pragma once
19 |
20 | #define SOFTSERIAL_BUFFER_SIZE 256
21 |
22 | typedef enum {
23 | SOFTSERIAL1 = 0,
24 | SOFTSERIAL2
25 | } softSerialPortIndex_e;
26 |
27 | serialPort_t *openSoftSerial(softSerialPortIndex_e portIndex, serialReceiveCallbackPtr callback, uint32_t baud, portOptions_t options);
28 |
29 | // serialPort API
30 | void softSerialWriteByte(serialPort_t *instance, uint8_t ch);
31 | uint8_t softSerialRxBytesWaiting(serialPort_t *instance);
32 | uint8_t softSerialTxBytesFree(serialPort_t *instance);
33 | uint8_t softSerialReadByte(serialPort_t *instance);
34 | void softSerialSetBaudRate(serialPort_t *s, uint32_t baudRate);
35 | bool isSoftSerialTransmitBufferEmpty(serialPort_t *s);
36 |
37 |
--------------------------------------------------------------------------------
/src/main/drivers/serial_uart_impl.h:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of Cleanflight.
3 | *
4 | * Cleanflight is free software: you can redistribute it and/or modify
5 | * it under the terms of the GNU General Public License as published by
6 | * the Free Software Foundation, either version 3 of the License, or
7 | * (at your option) any later version.
8 | *
9 | * Cleanflight is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | * GNU General Public License for more details.
13 | *
14 | * You should have received a copy of the GNU General Public License
15 | * along with Cleanflight. If not, see .
16 | */
17 |
18 | #pragma once
19 |
20 | // device specific uart implementation is defined here
21 |
22 | extern const struct serialPortVTable uartVTable[];
23 |
24 | void uartStartTxDMA(uartPort_t *s);
25 |
26 | uartPort_t *serialUART1(uint32_t baudRate, portMode_t mode, portOptions_t options);
27 | uartPort_t *serialUART2(uint32_t baudRate, portMode_t mode, portOptions_t options);
28 | uartPort_t *serialUART3(uint32_t baudRate, portMode_t mode, portOptions_t options);
29 | uartPort_t *serialUART4(uint32_t baudRate, portMode_t mode, portOptions_t options);
30 | uartPort_t *serialUART5(uint32_t baudRate, portMode_t mode, portOptions_t options);
31 | uartPort_t *serialUART6(uint32_t baudRate, portMode_t mode, portOptions_t options);
32 |
33 |
--------------------------------------------------------------------------------
/src/main/drivers/serial_uart_stm32f4xx.h:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of Cleanflight.
3 | *
4 | * Cleanflight is free software: you can redistribute it and/or modify
5 | * it under the terms of the GNU General Public License as published by
6 | * the Free Software Foundation, either version 3 of the License, or
7 | * (at your option) any later version.
8 | *
9 | * Cleanflight is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | * GNU General Public License for more details.
13 | *
14 | * You should have received a copy of the GNU General Public License
15 | * along with Cleanflight. If not, see .
16 | */
17 |
18 | #pragma once
19 |
--------------------------------------------------------------------------------
/src/main/drivers/serial_usb_vcp.h:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of Cleanflight.
3 | *
4 | * Cleanflight is free software: you can redistribute it and/or modify
5 | * it under the terms of the GNU General Public License as published by
6 | * the Free Software Foundation, either version 3 of the License, or
7 | * (at your option) any later version.
8 | *
9 | * Cleanflight is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | * GNU General Public License for more details.
13 | *
14 | * You should have received a copy of the GNU General Public License
15 | * along with Cleanflight. If not, see .
16 | */
17 |
18 | #pragma once
19 |
20 | #include "serial.h"
21 |
22 | typedef struct {
23 | serialPort_t port;
24 |
25 | // Buffer used during bulk writes.
26 | uint8_t txBuf[20];
27 | uint8_t txAt;
28 | // Set if the port is in bulk write mode and can buffer.
29 | bool buffering;
30 | } vcpPort_t;
31 |
32 | serialPort_t *usbVcpOpen(void);
33 | uint32_t usbVcpGetBaudRate(serialPort_t *instance);
34 |
--------------------------------------------------------------------------------
/src/main/drivers/sound_beeper.h:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of Cleanflight.
3 | *
4 | * Cleanflight is free software: you can redistribute it and/or modify
5 | * it under the terms of the GNU General Public License as published by
6 | * the Free Software Foundation, either version 3 of the License, or
7 | * (at your option) any later version.
8 | *
9 | * Cleanflight is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | * GNU General Public License for more details.
13 | *
14 | * You should have received a copy of the GNU General Public License
15 | * along with Cleanflight. If not, see .
16 | */
17 |
18 | #pragma once
19 |
20 | #ifdef BEEPER
21 | #define BEEP_TOGGLE digitalToggle(BEEP_GPIO, BEEP_PIN)
22 | #define BEEP_OFF systemBeep(false)
23 | #define BEEP_ON systemBeep(true)
24 | #else
25 | #define BEEP_TOGGLE
26 | #define BEEP_OFF
27 | #define BEEP_ON
28 | #endif
29 |
30 | typedef struct beeperConfig_s {
31 | uint32_t gpioPeripheral;
32 | uint16_t gpioPin;
33 | GPIO_TypeDef *gpioPort;
34 | GPIO_Mode gpioMode;
35 | bool isInverted;
36 | } beeperConfig_t;
37 |
38 | void systemBeep(bool onoff);
39 | void beeperInit(beeperConfig_t *beeperConfig);
40 |
41 | void initBeeperHardware(beeperConfig_t *config);
42 |
--------------------------------------------------------------------------------
/src/main/drivers/sound_beeper_stm32f10x.c:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of Cleanflight.
3 | *
4 | * Cleanflight is free software: you can redistribute it and/or modify
5 | * it under the terms of the GNU General Public License as published by
6 | * the Free Software Foundation, either version 3 of the License, or
7 | * (at your option) any later version.
8 | *
9 | * Cleanflight is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | * GNU General Public License for more details.
13 | *
14 | * You should have received a copy of the GNU General Public License
15 | * along with Cleanflight. If not, see .
16 | */
17 |
18 | #include
19 | #include
20 | #include
21 |
22 | #include
23 |
24 | #include "build/build_config.h"
25 |
26 | #include "system.h"
27 | #include "gpio.h"
28 |
29 | #include "sound_beeper.h"
30 |
31 | void initBeeperHardware(beeperConfig_t *config)
32 | {
33 | #ifndef BEEPER
34 | UNUSED(config);
35 | #else
36 | gpio_config_t gpioConfig = {
37 | config->gpioPin,
38 | config->gpioMode,
39 | Speed_2MHz
40 | };
41 |
42 | RCC_APB2PeriphClockCmd(config->gpioPeripheral, ENABLE);
43 |
44 | gpioInit(config->gpioPort, &gpioConfig);
45 | #endif
46 | }
47 |
--------------------------------------------------------------------------------
/src/main/drivers/sound_beeper_stm32f30x.c:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of Cleanflight.
3 | *
4 | * Cleanflight is free software: you can redistribute it and/or modify
5 | * it under the terms of the GNU General Public License as published by
6 | * the Free Software Foundation, either version 3 of the License, or
7 | * (at your option) any later version.
8 | *
9 | * Cleanflight is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | * GNU General Public License for more details.
13 | *
14 | * You should have received a copy of the GNU General Public License
15 | * along with Cleanflight. If not, see .
16 | */
17 |
18 | #include
19 | #include
20 | #include
21 |
22 | #include
23 |
24 | #include "build/build_config.h"
25 |
26 | #include "gpio.h"
27 |
28 | #include "sound_beeper.h"
29 |
30 | void initBeeperHardware(beeperConfig_t *config)
31 | {
32 | #ifndef BEEPER
33 | UNUSED(config);
34 | #else
35 | gpio_config_t gpioConfig = {
36 | config->gpioPin,
37 | config->gpioMode,
38 | Speed_2MHz
39 | };
40 |
41 | RCC_AHBPeriphClockCmd(config->gpioPeripheral, ENABLE);
42 |
43 | gpioInit(config->gpioPort, &gpioConfig);
44 | #endif
45 | }
46 |
--------------------------------------------------------------------------------
/src/main/drivers/sound_beeper_stm32f4xx.c:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of Cleanflight.
3 | *
4 | * Cleanflight is free software: you can redistribute it and/or modify
5 | * it under the terms of the GNU General Public License as published by
6 | * the Free Software Foundation, either version 3 of the License, or
7 | * (at your option) any later version.
8 | *
9 | * Cleanflight is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | * GNU General Public License for more details.
13 | *
14 | * You should have received a copy of the GNU General Public License
15 | * along with Cleanflight. If not, see .
16 | */
17 |
18 | #include
19 | #include
20 | #include
21 |
22 | #include
23 |
24 | #include "gpio.h"
25 |
26 | #include "sound_beeper.h"
27 |
28 | void initBeeperHardware(beeperConfig_t *config)
29 | {
30 | #ifdef BEEPER
31 | gpio_config_t gpioConfig = {
32 | config->gpioPin,
33 | config->gpioMode,
34 | Speed_2MHz
35 | };
36 |
37 | RCC_AHB1PeriphClockCmd(config->gpioPeripheral, ENABLE);
38 |
39 | gpioInit(config->gpioPort, &gpioConfig);
40 | #endif
41 | }
42 |
--------------------------------------------------------------------------------
/src/main/drivers/system.h:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of Cleanflight.
3 | *
4 | * Cleanflight is free software: you can redistribute it and/or modify
5 | * it under the terms of the GNU General Public License as published by
6 | * the Free Software Foundation, either version 3 of the License, or
7 | * (at your option) any later version.
8 | *
9 | * Cleanflight is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | * GNU General Public License for more details.
13 | *
14 | * You should have received a copy of the GNU General Public License
15 | * along with Cleanflight. If not, see .
16 | */
17 |
18 | #pragma once
19 |
20 | void systemInit(void);
21 | void delayMicroseconds(uint32_t us);
22 | void delay(uint32_t ms);
23 |
24 | uint32_t micros(void);
25 | uint32_t millis(void);
26 |
27 | // failure
28 | void failureMode(uint8_t mode);
29 |
30 | // bootloader/IAP
31 | void systemReset(void);
32 | void systemResetToBootloader(void);
33 | bool isMPUSoftReset(void);
34 |
35 | void enableGPIOPowerUsageAndNoiseReductions(void);
36 | // current crystal frequency - 8 or 12MHz
37 | extern uint32_t hse_value;
38 |
39 | typedef void extiCallbackHandlerFunc(void);
40 |
41 | void registerExtiCallbackHandler(IRQn_Type irqn, extiCallbackHandlerFunc *fn);
42 | void unregisterExtiCallbackHandler(IRQn_Type irqn, extiCallbackHandlerFunc *fn);
43 |
44 | extern uint32_t cachedRccCsrValue;
45 |
46 | typedef enum {
47 | FAILURE_DEVELOPER = 0,
48 | FAILURE_MISSING_ACC,
49 | FAILURE_ACC_INIT,
50 | FAILURE_ACC_INCOMPATIBLE,
51 | FAILURE_INVALID_EEPROM_CONTENTS,
52 | FAILURE_FLASH_WRITE_FAILED,
53 | FAILURE_GYRO_INIT_FAILED
54 | } failureMode_e;
55 |
56 |
--------------------------------------------------------------------------------
/src/main/drivers/timer_impl.h:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of Cleanflight.
3 | *
4 | * Cleanflight is free software: you can redistribute it and/or modify
5 | * it under the terms of the GNU General Public License as published by
6 | * the Free Software Foundation, either version 3 of the License, or
7 | * (at your option) any later version.
8 | *
9 | * Cleanflight is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | * GNU General Public License for more details.
13 | *
14 | * You should have received a copy of the GNU General Public License
15 | * along with Cleanflight. If not, see .
16 | */
17 |
18 | #pragma once
19 |
20 | void timerInitTarget(void);
21 |
--------------------------------------------------------------------------------
/src/main/drivers/timer_stm32f10x.h:
--------------------------------------------------------------------------------
1 |
2 | #pragma once
3 |
4 | #include "stm32f10x.h"
5 |
6 | void TIM_SelectOCxM_NoDisable(TIM_TypeDef* TIMx, uint16_t TIM_Channel, uint16_t TIM_OCMode);
7 |
--------------------------------------------------------------------------------
/src/main/drivers/timer_stm32f30x.h:
--------------------------------------------------------------------------------
1 |
2 | #pragma once
3 |
4 | #include "stm32f30x.h"
5 |
6 | void TIM_SelectOCxM_NoDisable(TIM_TypeDef* TIMx, uint16_t TIM_Channel, uint16_t TIM_OCMode);
7 |
--------------------------------------------------------------------------------
/src/main/drivers/timer_stm32f4xx.h:
--------------------------------------------------------------------------------
1 |
2 | #pragma once
3 |
4 | #include "stm32f4xx.h"
5 |
6 | void TIM_SelectOCxM_NoDisable(TIM_TypeDef* TIMx, uint16_t TIM_Channel, uint16_t TIM_OCMode);
7 |
--------------------------------------------------------------------------------
/src/main/drivers/transponder_ir.h:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of Cleanflight.
3 | *
4 | * Cleanflight is free software: you can redistribute it and/or modify
5 | * it under the terms of the GNU General Public License as published by
6 | * the Free Software Foundation, either version 3 of the License, or
7 | * (at your option) any later version.
8 | *
9 | * Cleanflight is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | * GNU General Public License for more details.
13 | *
14 | * You should have received a copy of the GNU General Public License
15 | * along with Cleanflight. If not, see .
16 | */
17 |
18 | #pragma once
19 |
20 | #define TRANSPONDER_BITS_PER_BYTE 10 // start + 8 data + stop
21 | #define TRANSPONDER_DATA_LENGTH 6
22 | #define TRANSPONDER_TOGGLES_PER_BIT 11
23 | #define TRANSPONDER_GAP_TOGGLES 1
24 | #define TRANSPONDER_TOGGLES (TRANSPONDER_TOGGLES_PER_BIT + TRANSPONDER_GAP_TOGGLES)
25 |
26 | #define TRANSPONDER_DMA_BUFFER_SIZE ((TRANSPONDER_TOGGLES_PER_BIT + 1) * TRANSPONDER_BITS_PER_BYTE * TRANSPONDER_DATA_LENGTH)
27 |
28 | #define BIT_TOGGLE_1 78 // (156 / 2)
29 | #define BIT_TOGGLE_0 0
30 |
31 | void transponderIrInit(void);
32 | void transponderIrDisable(void);
33 |
34 | void transponderIrHardwareInit(void);
35 | void transponderIrDMAEnable(void);
36 |
37 | void transponderIrWaitForTransmitComplete(void);
38 |
39 | void transponderIrUpdateData(const uint8_t* transponderData);
40 | void transponderIrTransmit(void);
41 |
42 | bool isTransponderIrReady(void);
43 |
44 | extern uint8_t transponderIrDMABuffer[TRANSPONDER_DMA_BUFFER_SIZE];
45 | extern volatile uint8_t transponderIrDataTransferInProgress;
46 |
--------------------------------------------------------------------------------
/src/main/drivers/usb_io.h:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of Cleanflight.
3 | *
4 | * Cleanflight is free software: you can redistribute it and/or modify
5 | * it under the terms of the GNU General Public License as published by
6 | * the Free Software Foundation, either version 3 of the License, or
7 | * (at your option) any later version.
8 | *
9 | * Cleanflight is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | * GNU General Public License for more details.
13 | *
14 | * You should have received a copy of the GNU General Public License
15 | * along with Cleanflight. If not, see .
16 | */
17 |
18 | #pragma once
19 |
20 | void usbGenerateDisconnectPulse(void);
21 |
22 | void usbCableDetectDeinit(void);
23 | void usbCableDetectInit(void);
24 | bool usbCableIsInserted(void);
25 |
26 |
--------------------------------------------------------------------------------
/src/main/drivers/video.h:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of Cleanflight.
3 | *
4 | * Cleanflight is free software: you can redistribute it and/or modify
5 | * it under the terms of the GNU General Public License as published by
6 | * the Free Software Foundation, either version 3 of the License, or
7 | * (at your option) any later version.
8 | *
9 | * Cleanflight is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | * GNU General Public License for more details.
13 | *
14 | * You should have received a copy of the GNU General Public License
15 | * along with Cleanflight. If not, see .
16 | */
17 |
18 | #pragma once
19 |
20 | typedef enum {
21 | VIDEO_NTSC = 0,
22 | VIDEO_PAL = 1
23 | } videoMode_e;
24 |
--------------------------------------------------------------------------------
/src/main/drivers/video_textscreen.h:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of Cleanflight.
3 | *
4 | * Cleanflight is free software: you can redistribute it and/or modify
5 | * it under the terms of the GNU General Public License as published by
6 | * the Free Software Foundation, either version 3 of the License, or
7 | * (at your option) any later version.
8 | *
9 | * Cleanflight is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | * GNU General Public License for more details.
13 | *
14 | * You should have received a copy of the GNU General Public License
15 | * along with Cleanflight. If not, see .
16 | */
17 |
18 | #pragma once
19 |
20 | typedef struct textScreen_s {
21 | uint8_t width;
22 | uint8_t height;
23 | } textScreen_t;
24 |
--------------------------------------------------------------------------------
/src/main/fc/cleanflight_fc.h:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of Cleanflight.
3 | *
4 | * Cleanflight is free software: you can redistribute it and/or modify
5 | * it under the terms of the GNU General Public License as published by
6 | * the Free Software Foundation, either version 3 of the License, or
7 | * (at your option) any later version.
8 | *
9 | * Cleanflight is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | * GNU General Public License for more details.
13 | *
14 | * You should have received a copy of the GNU General Public License
15 | * along with Cleanflight. If not, see .
16 | */
17 |
18 | #pragma once
19 |
20 | extern int16_t magHold;
21 |
22 | void applyAndSaveAccelerometerTrimsDelta(rollAndPitchTrims_t *rollAndPitchTrimsDelta);
23 | void handleInflightCalibrationStickPosition();
24 |
25 | void mwDisarm(void);
26 | void mwArm(void);
27 |
28 | bool isCalibrating(void);
--------------------------------------------------------------------------------
/src/main/fc/fc_serial.h:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of Cleanflight.
3 | *
4 | * Cleanflight is free software: you can redistribute it and/or modify
5 | * it under the terms of the GNU General Public License as published by
6 | * the Free Software Foundation, either version 3 of the License, or
7 | * (at your option) any later version.
8 | *
9 | * Cleanflight is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | * GNU General Public License for more details.
13 | *
14 | * You should have received a copy of the GNU General Public License
15 | * along with Cleanflight. If not, see .
16 | */
17 |
18 | #pragma once
19 |
20 | typedef enum {
21 | BAUDRATE_MSP_SERVER = 0,
22 | BAUDRATE_GPS,
23 | BAUDRATE_BLACKBOX,
24 | BAUDRATE_TELEMETRY
25 | } functionBaudRate_e;
26 |
--------------------------------------------------------------------------------
/src/main/fc/msp_server_fc.h:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of Cleanflight.
3 | *
4 | * Cleanflight is free software: you can redistribute it and/or modify
5 | * it under the terms of the GNU General Public License as published by
6 | * the Free Software Foundation, either version 3 of the License, or
7 | * (at your option) any later version.
8 | *
9 | * Cleanflight is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | * GNU General Public License for more details.
13 | *
14 | * You should have received a copy of the GNU General Public License
15 | * along with Cleanflight. If not, see .
16 | */
17 |
18 | #pragma once
19 |
--------------------------------------------------------------------------------
/src/main/fc/rc_curves.h:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of Cleanflight.
3 | *
4 | * Cleanflight is free software: you can redistribute it and/or modify
5 | * it under the terms of the GNU General Public License as published by
6 | * the Free Software Foundation, either version 3 of the License, or
7 | * (at your option) any later version.
8 | *
9 | * Cleanflight is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | * GNU General Public License for more details.
13 | *
14 | * You should have received a copy of the GNU General Public License
15 | * along with Cleanflight. If not, see .
16 | */
17 |
18 | #pragma once
19 |
20 | int16_t rcLookupPitchRoll(int rcVal);
21 | int16_t rcLookupYaw(int rcYaw);
22 | int16_t rcLookupThrottle(int rcThrottle);
23 |
24 | void generatePitchRollCurve(void);
25 | void generateYawCurve(void);
26 | void generateThrottleCurve(void);
27 |
28 |
--------------------------------------------------------------------------------
/src/main/flight/altitudehold.h:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of Cleanflight.
3 | *
4 | * Cleanflight is free software: you can redistribute it and/or modify
5 | * it under the terms of the GNU General Public License as published by
6 | * the Free Software Foundation, either version 3 of the License, or
7 | * (at your option) any later version.
8 | *
9 | * Cleanflight is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | * GNU General Public License for more details.
13 | *
14 | * You should have received a copy of the GNU General Public License
15 | * along with Cleanflight. If not, see .
16 | */
17 |
18 | #include "io/motor_and_servo.h"
19 |
20 | #include "fc/rc_controls.h"
21 |
22 | #include "flight/pid.h"
23 |
24 | #include "sensors/barometer.h"
25 |
26 | extern int32_t AltHold;
27 | extern int32_t vario;
28 |
29 | typedef struct airplaneConfig_s {
30 | int8_t fixedwing_althold_dir; // +1 or -1 for pitch/althold gain. later check if need more than just sign
31 | } airplaneConfig_t;
32 |
33 | PG_DECLARE(airplaneConfig_t, airplaneConfig);
34 |
35 | void calculateEstimatedAltitude(uint32_t currentTime);
36 |
37 | void applyAltHold(void);
38 | void updateAltHoldState(void);
39 | void updateSonarAltHoldState(void);
40 |
41 | int32_t altitudeHoldGetEstimatedAltitude(void);
42 |
--------------------------------------------------------------------------------
/src/main/flight/gps_conversion.h:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of Cleanflight.
3 | *
4 | * Cleanflight is free software: you can redistribute it and/or modify
5 | * it under the terms of the GNU General Public License as published by
6 | * the Free Software Foundation, either version 3 of the License, or
7 | * (at your option) any later version.
8 | *
9 | * Cleanflight is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | * GNU General Public License for more details.
13 | *
14 | * You should have received a copy of the GNU General Public License
15 | * along with Cleanflight. If not, see .
16 | */
17 |
18 | uint32_t GPS_coord_to_degrees(const char* coordinateString);
19 |
--------------------------------------------------------------------------------
/src/main/flight/gtune.h:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of Cleanflight.
3 | *
4 | * Cleanflight is free software: you can redistribute it and/or modify
5 | * it under the terms of the GNU General Public License as published by
6 | * the Free Software Foundation, either version 3 of the License, or
7 | * (at your option) any later version.
8 | *
9 | * Cleanflight is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | * GNU General Public License for more details.
13 | *
14 | * You should have received a copy of the GNU General Public License
15 | * along with Cleanflight. If not, see .
16 | */
17 |
18 | #pragma once
19 |
20 | #ifdef GTUNE
21 | typedef struct gtuneConfig_s {
22 | uint8_t gtune_lolimP[FD_INDEX_COUNT]; // [0..200] Lower limit of P during G tune
23 | uint8_t gtune_hilimP[FD_INDEX_COUNT]; // [0..200] Higher limit of P during G tune. 0 Disables tuning for that axis.
24 | uint8_t gtune_pwr; // [0..10] Strength of adjustment
25 | uint16_t gtune_settle_time; // [200..1000] Settle time in ms
26 | uint8_t gtune_average_cycles; // [8..128] Number of looptime cycles used for gyro average calculation
27 | } gtuneConfig_t;
28 |
29 | PG_DECLARE_PROFILE(gtuneConfig_t, gtuneConfig);
30 |
31 | void init_Gtune(void);
32 | void calculate_Gtune(uint8_t axis);
33 |
34 | #endif
35 |
--------------------------------------------------------------------------------
/src/main/io/display.h:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of Cleanflight.
3 | *
4 | * Cleanflight is free software: you can redistribute it and/or modify
5 | * it under the terms of the GNU General Public License as published by
6 | * the Free Software Foundation, either version 3 of the License, or
7 | * (at your option) any later version.
8 | *
9 | * Cleanflight is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | * GNU General Public License for more details.
13 | *
14 | * You should have received a copy of the GNU General Public License
15 | * along with Cleanflight. If not, see .
16 | */
17 |
18 | //#define ENABLE_DEBUG_OLED_PAGE
19 |
20 | typedef enum {
21 | PAGE_WELCOME,
22 | PAGE_ARMED,
23 | PAGE_BATTERY,
24 | PAGE_SENSORS,
25 | PAGE_RX,
26 | PAGE_PROFILE,
27 | #ifndef SKIP_TASK_STATISTICS
28 | PAGE_TASKS,
29 | #endif
30 | #ifdef GPS
31 | PAGE_GPS,
32 | #endif
33 | #ifdef ENABLE_DEBUG_OLED_PAGE
34 | PAGE_DEBUG,
35 | #endif
36 | } pageId_e;
37 |
38 | void displayInit(void);
39 |
40 | void updateDisplay(void);
41 |
42 | void displayShowFixedPage(pageId_e pageId);
43 |
44 | void displayEnablePageCycling(void);
45 | void displayDisablePageCycling(void);
46 | void displayResetPageCycling(void);
47 | void displaySetNextPageChangeAt(uint32_t futureMicros);
48 |
--------------------------------------------------------------------------------
/src/main/io/gimbal.c:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of Cleanflight.
3 | *
4 | * Cleanflight is free software: you can redistribute it and/or modify
5 | * it under the terms of the GNU General Public License as published by
6 | * the Free Software Foundation, either version 3 of the License, or
7 | * (at your option) any later version.
8 | *
9 | * Cleanflight is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | * GNU General Public License for more details.
13 | *
14 | * You should have received a copy of the GNU General Public License
15 | * along with Cleanflight. If not, see .
16 | */
17 |
18 | #include
19 | #include
20 |
21 | #include
22 | #include "build/build_config.h"
23 |
24 | #include "build/debug.h"
25 |
26 | #include "config/parameter_group.h"
27 | #include "config/parameter_group_ids.h"
28 | #include "config/profile.h"
29 |
30 | #include "io/gimbal.h"
31 |
32 | #ifdef USE_SERVOS
33 |
34 | PG_REGISTER_PROFILE(gimbalConfig_t, gimbalConfig, PG_GIMBAL_CONFIG, 0);
35 |
36 | #endif
37 |
--------------------------------------------------------------------------------
/src/main/io/gimbal.h:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of Cleanflight.
3 | *
4 | * Cleanflight is free software: you can redistribute it and/or modify
5 | * it under the terms of the GNU General Public License as published by
6 | * the Free Software Foundation, either version 3 of the License, or
7 | * (at your option) any later version.
8 | *
9 | * Cleanflight is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | * GNU General Public License for more details.
13 | *
14 | * You should have received a copy of the GNU General Public License
15 | * along with Cleanflight. If not, see .
16 | */
17 |
18 | #pragma once
19 |
20 | typedef enum {
21 | GIMBAL_MODE_NORMAL = 0,
22 | GIMBAL_MODE_MIXTILT = 1
23 | } gimbalMode_e;
24 |
25 | #define GIMBAL_MODE_MAX (GIMBAL_MODE_MIXTILT)
26 |
27 | typedef struct gimbalConfig_s {
28 | uint8_t mode;
29 | } gimbalConfig_t;
30 |
31 | PG_DECLARE_PROFILE(gimbalConfig_t, gimbalConfig);
32 |
--------------------------------------------------------------------------------
/src/main/io/motor_and_servo.c:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of Cleanflight.
3 | *
4 | * Cleanflight is free software: you can redistribute it and/or modify
5 | * it under the terms of the GNU General Public License as published by
6 | * the Free Software Foundation, either version 3 of the License, or
7 | * (at your option) any later version.
8 | *
9 | * Cleanflight is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | * GNU General Public License for more details.
13 | *
14 | * You should have received a copy of the GNU General Public License
15 | * along with Cleanflight. If not, see .
16 | */
17 |
18 | #include
19 | #include
20 | #include
21 |
22 | #include
23 |
24 | #include "build/debug.h"
25 |
26 | #include "config/parameter_group.h"
27 | #include "config/parameter_group_ids.h"
28 | #include "config/config_reset.h"
29 |
30 | #include "motor_and_servo.h"
31 |
32 | #define BRUSHED_MOTORS_PWM_RATE 16000
33 | #define BRUSHLESS_MOTORS_PWM_RATE 400
34 |
35 | #ifdef BRUSHED_MOTORS
36 | #define DEFAULT_PWM_RATE BRUSHED_MOTORS_PWM_RATE
37 | #else
38 | #define DEFAULT_PWM_RATE BRUSHLESS_MOTORS_PWM_RATE
39 | #endif
40 |
41 | PG_REGISTER_WITH_RESET_TEMPLATE(motorAndServoConfig_t, motorAndServoConfig, PG_MOTOR_AND_SERVO_CONFIG, 0);
42 |
43 | PG_RESET_TEMPLATE(motorAndServoConfig_t, motorAndServoConfig,
44 | .minthrottle = 1150,
45 | .maxthrottle = 1850,
46 | .mincommand = 1000,
47 | .servoCenterPulse = 1500,
48 | .motor_pwm_rate = DEFAULT_PWM_RATE,
49 | .servo_pwm_rate = 50,
50 | );
51 |
--------------------------------------------------------------------------------
/src/main/io/motor_and_servo.h:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of Cleanflight.
3 | *
4 | * Cleanflight is free software: you can redistribute it and/or modify
5 | * it under the terms of the GNU General Public License as published by
6 | * the Free Software Foundation, either version 3 of the License, or
7 | * (at your option) any later version.
8 | *
9 | * Cleanflight is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | * GNU General Public License for more details.
13 | *
14 | * You should have received a copy of the GNU General Public License
15 | * along with Cleanflight. If not, see .
16 | */
17 |
18 | #pragma once
19 |
20 | typedef struct motorAndServoConfig_s {
21 |
22 | // PWM values, in milliseconds, common range is 1000-2000 (1 to 2ms)
23 | uint16_t minthrottle; // Set the minimum throttle command sent to the ESC (Electronic Speed Controller). This is the minimum value that allow motors to run at a idle speed.
24 | uint16_t maxthrottle; // This is the maximum value for the ESCs at full power this value can be increased up to 2000
25 | uint16_t mincommand; // This is the value for the ESCs when they are not armed. In some cases, this value must be lowered down to 900 for some specific ESCs
26 | uint16_t servoCenterPulse; // This is the value for servos when they should be in the middle. e.g. 1500.
27 |
28 | uint16_t motor_pwm_rate; // The update rate of motor outputs (50-498Hz)
29 | uint16_t servo_pwm_rate; // The update rate of servo outputs (50-498Hz)
30 | } motorAndServoConfig_t;
31 |
32 | PG_DECLARE(motorAndServoConfig_t, motorAndServoConfig);
33 |
--------------------------------------------------------------------------------
/src/main/io/serial_4way_avrootloader.h:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of Cleanflight.
3 | *
4 | * Cleanflight is free software: you can redistribute it and/or modify
5 | * it under the terms of the GNU General Public License as published by
6 | * the Free Software Foundation, either version 3 of the License, or
7 | * (at your option) any later version.
8 | *
9 | * Cleanflight is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | * GNU General Public License for more details.
13 | *
14 | * You should have received a copy of the GNU General Public License
15 | * along with Cleanflight. If not, see .
16 | * Author: 4712
17 | * for info about Hagens AVRootloader:
18 | * http://www.mikrocontroller.net/topic/avr-bootloader-mit-verschluesselung
19 | */
20 |
21 | #pragma once
22 |
23 | #ifdef USE_SERIAL_4WAY_BLHELI_BOOTLOADER
24 |
25 | void BL_SendBootInit(void);
26 | uint8_t BL_ConnectEx(escDeviceInfo_t *pDeviceInfo);
27 | uint8_t BL_SendCMDKeepAlive(void);
28 | uint8_t BL_WriteEEprom(ioMem_t *pMem);
29 | uint8_t BL_ReadEEprom(ioMem_t *pMem);
30 | uint8_t BL_PageErase(ioMem_t *pMem);
31 | uint8_t BL_WriteFlash(ioMem_t *pMem);
32 | uint8_t BL_ReadFlashATM(ioMem_t *pMem);
33 | uint8_t BL_ReadFlashSIL(ioMem_t *pMem);
34 | void BL_SendCMDRunRestartBootloader(void);
35 |
36 | #endif
37 |
--------------------------------------------------------------------------------
/src/main/io/serial_4way_impl.h:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of Cleanflight.
3 | *
4 | * Cleanflight is free software: you can redistribute it and/or modify
5 | * it under the terms of the GNU General Public License as published by
6 | * the Free Software Foundation, either version 3 of the License, or
7 | * (at your option) any later version.
8 | *
9 | * Cleanflight is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | * GNU General Public License for more details.
13 | *
14 | * You should have received a copy of the GNU General Public License
15 | * along with Cleanflight. If not, see .
16 | * Author: 4712
17 | */
18 |
19 | typedef struct {
20 | GPIO_TypeDef* gpio;
21 | uint16_t pinpos;
22 | uint16_t pin;
23 | gpio_config_t gpio_config_INPUT;
24 | gpio_config_t gpio_config_OUTPUT;
25 | } escHardware_t;
26 |
27 | extern uint8_t escSelected;
28 |
29 | bool isEscHi(uint8_t selEsc);
30 | bool isEscLo(uint8_t selEsc);
31 | void setEscHi(uint8_t selEsc);
32 | void setEscLo(uint8_t selEsc);
33 | void setEscInput(uint8_t selEsc);
34 | void setEscOutput(uint8_t selEsc);
35 |
36 | #define ESC_IS_HI isEscHi(escSelected)
37 | #define ESC_IS_LO isEscLo(escSelected)
38 | #define ESC_SET_HI setEscHi(escSelected)
39 | #define ESC_SET_LO setEscLo(escSelected)
40 | #define ESC_INPUT setEscInput(escSelected)
41 | #define ESC_OUTPUT setEscOutput(escSelected)
42 |
43 | typedef struct ioMem_s {
44 | uint16_t len;
45 | uint16_t addr;
46 | uint8_t *data;
47 | } ioMem_t;
48 |
--------------------------------------------------------------------------------
/src/main/io/serial_4way_stk500v2.h:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of Cleanflight.
3 | *
4 | * Cleanflight is free software: you can redistribute it and/or modify
5 | * it under the terms of the GNU General Public License as published by
6 | * the Free Software Foundation, either version 3 of the License, or
7 | * (at your option) any later version.
8 | *
9 | * Cleanflight is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | * GNU General Public License for more details.
13 | *
14 | * You should have received a copy of the GNU General Public License
15 | * along with Cleanflight. If not, see .
16 | * Author: 4712
17 | */
18 | #pragma once
19 |
20 | #ifdef USE_SERIAL_4WAY_SK_BOOTLOADER
21 |
22 | uint8_t Stk_SignOn(void);
23 | uint8_t Stk_ConnectEx(escDeviceInfo_t *pDeviceInfo);
24 | uint8_t Stk_ReadEEprom(ioMem_t *pMem);
25 | uint8_t Stk_WriteEEprom(ioMem_t *pMem);
26 | uint8_t Stk_ReadFlash(ioMem_t *pMem);
27 | uint8_t Stk_WriteFlash(ioMem_t *pMem);
28 | uint8_t Stk_Chip_Erase(void);
29 |
30 | #endif
31 |
--------------------------------------------------------------------------------
/src/main/io/serial_cli.h:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of Cleanflight.
3 | *
4 | * Cleanflight is free software: you can redistribute it and/or modify
5 | * it under the terms of the GNU General Public License as published by
6 | * the Free Software Foundation, either version 3 of the License, or
7 | * (at your option) any later version.
8 | *
9 | * Cleanflight is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | * GNU General Public License for more details.
13 | *
14 | * You should have received a copy of the GNU General Public License
15 | * along with Cleanflight. If not, see .
16 | */
17 |
18 | #pragma once
19 |
20 | extern uint8_t cliMode;
21 |
22 | void cliInit(void);
23 | void cliEnter(serialPort_t *serialPort);
24 | void cliProcess(void);
25 | bool cliIsActiveOnPort(serialPort_t *serialPort);
26 |
--------------------------------------------------------------------------------
/src/main/io/statusindicator.h:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of Cleanflight.
3 | *
4 | * Cleanflight is free software: you can redistribute it and/or modify
5 | * it under the terms of the GNU General Public License as published by
6 | * the Free Software Foundation, either version 3 of the License, or
7 | * (at your option) any later version.
8 | *
9 | * Cleanflight is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | * GNU General Public License for more details.
13 | *
14 | * You should have received a copy of the GNU General Public License
15 | * along with Cleanflight. If not, see .
16 | */
17 |
18 | #pragma once
19 |
20 | #define WARNING_LED_BLINK_BIT_DELAY 200000
21 |
22 | void warningLedBeeper(bool on);
23 | void warningLedPulse(void);
24 |
25 | void warningLedSetBlinkMask(uint32_t newBlinkMask);
26 |
27 | void warningLedUpdate(void);
28 | void warningLedCode(uint8_t code);
29 |
--------------------------------------------------------------------------------
/src/main/io/transponder_ir.h:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of Cleanflight.
3 | *
4 | * Cleanflight is free software: you can redistribute it and/or modify
5 | * it under the terms of the GNU General Public License as published by
6 | * the Free Software Foundation, either version 3 of the License, or
7 | * (at your option) any later version.
8 | *
9 | * Cleanflight is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | * GNU General Public License for more details.
13 | *
14 | * You should have received a copy of the GNU General Public License
15 | * along with Cleanflight. If not, see .
16 | */
17 |
18 | #pragma once
19 |
20 | typedef struct transponderConfig_s {
21 | uint8_t data[6];
22 | } transponderConfig_t;
23 |
24 | PG_DECLARE(transponderConfig_t, transponderConfig);
25 |
26 | void transponderInit(uint8_t* transponderCode);
27 |
28 | void transponderEnable(void);
29 | void transponderDisable(void);
30 | void updateTransponder(void);
31 | void transponderUpdateData(uint8_t* transponderData);
32 | void transponderTransmitOnce(void);
33 | void transponderStartRepeating(void);
34 | void transponderStopRepeating(void);
35 |
--------------------------------------------------------------------------------
/src/main/mavlink/ASLUAV/mavlink.h:
--------------------------------------------------------------------------------
1 | /** @file
2 | * @brief MAVLink comm protocol built from ASLUAV.xml
3 | * @see http://mavlink.org
4 | */
5 | #ifndef MAVLINK_H
6 | #define MAVLINK_H
7 |
8 | #ifndef MAVLINK_STX
9 | #define MAVLINK_STX 254
10 | #endif
11 |
12 | #ifndef MAVLINK_ENDIAN
13 | #define MAVLINK_ENDIAN MAVLINK_LITTLE_ENDIAN
14 | #endif
15 |
16 | #ifndef MAVLINK_ALIGNED_FIELDS
17 | #define MAVLINK_ALIGNED_FIELDS 1
18 | #endif
19 |
20 | #ifndef MAVLINK_CRC_EXTRA
21 | #define MAVLINK_CRC_EXTRA 1
22 | #endif
23 |
24 | #include "version.h"
25 | #include "ASLUAV.h"
26 |
27 | #endif // MAVLINK_H
28 |
--------------------------------------------------------------------------------
/src/main/mavlink/ASLUAV/version.h:
--------------------------------------------------------------------------------
1 | /** @file
2 | * @brief MAVLink comm protocol built from ASLUAV.xml
3 | * @see http://mavlink.org
4 | */
5 | #ifndef MAVLINK_VERSION_H
6 | #define MAVLINK_VERSION_H
7 |
8 | #define MAVLINK_BUILD_DATE "Wed Apr 15 16:53:49 2015"
9 | #define MAVLINK_WIRE_PROTOCOL_VERSION "1.0"
10 | #define MAVLINK_MAX_DIALECT_PAYLOAD_SIZE 255
11 |
12 | #endif // MAVLINK_VERSION_H
13 |
--------------------------------------------------------------------------------
/src/main/mavlink/ardupilotmega/mavlink.h:
--------------------------------------------------------------------------------
1 | /** @file
2 | * @brief MAVLink comm protocol built from ardupilotmega.xml
3 | * @see http://mavlink.org
4 | */
5 | #ifndef MAVLINK_H
6 | #define MAVLINK_H
7 |
8 | #ifndef MAVLINK_STX
9 | #define MAVLINK_STX 254
10 | #endif
11 |
12 | #ifndef MAVLINK_ENDIAN
13 | #define MAVLINK_ENDIAN MAVLINK_LITTLE_ENDIAN
14 | #endif
15 |
16 | #ifndef MAVLINK_ALIGNED_FIELDS
17 | #define MAVLINK_ALIGNED_FIELDS 1
18 | #endif
19 |
20 | #ifndef MAVLINK_CRC_EXTRA
21 | #define MAVLINK_CRC_EXTRA 1
22 | #endif
23 |
24 | #include "version.h"
25 | #include "ardupilotmega.h"
26 |
27 | #endif // MAVLINK_H
28 |
--------------------------------------------------------------------------------
/src/main/mavlink/ardupilotmega/version.h:
--------------------------------------------------------------------------------
1 | /** @file
2 | * @brief MAVLink comm protocol built from ardupilotmega.xml
3 | * @see http://mavlink.org
4 | */
5 | #ifndef MAVLINK_VERSION_H
6 | #define MAVLINK_VERSION_H
7 |
8 | #define MAVLINK_BUILD_DATE "Wed Apr 15 16:52:35 2015"
9 | #define MAVLINK_WIRE_PROTOCOL_VERSION "1.0"
10 | #define MAVLINK_MAX_DIALECT_PAYLOAD_SIZE 255
11 |
12 | #endif // MAVLINK_VERSION_H
13 |
--------------------------------------------------------------------------------
/src/main/mavlink/autoquad/mavlink.h:
--------------------------------------------------------------------------------
1 | /** @file
2 | * @brief MAVLink comm protocol built from autoquad.xml
3 | * @see http://mavlink.org
4 | */
5 | #ifndef MAVLINK_H
6 | #define MAVLINK_H
7 |
8 | #ifndef MAVLINK_STX
9 | #define MAVLINK_STX 254
10 | #endif
11 |
12 | #ifndef MAVLINK_ENDIAN
13 | #define MAVLINK_ENDIAN MAVLINK_LITTLE_ENDIAN
14 | #endif
15 |
16 | #ifndef MAVLINK_ALIGNED_FIELDS
17 | #define MAVLINK_ALIGNED_FIELDS 1
18 | #endif
19 |
20 | #ifndef MAVLINK_CRC_EXTRA
21 | #define MAVLINK_CRC_EXTRA 1
22 | #endif
23 |
24 | #include "version.h"
25 | #include "autoquad.h"
26 |
27 | #endif // MAVLINK_H
28 |
--------------------------------------------------------------------------------
/src/main/mavlink/autoquad/version.h:
--------------------------------------------------------------------------------
1 | /** @file
2 | * @brief MAVLink comm protocol built from autoquad.xml
3 | * @see http://mavlink.org
4 | */
5 | #ifndef MAVLINK_VERSION_H
6 | #define MAVLINK_VERSION_H
7 |
8 | #define MAVLINK_BUILD_DATE "Wed Apr 15 16:52:47 2015"
9 | #define MAVLINK_WIRE_PROTOCOL_VERSION "1.0"
10 | #define MAVLINK_MAX_DIALECT_PAYLOAD_SIZE 255
11 |
12 | #endif // MAVLINK_VERSION_H
13 |
--------------------------------------------------------------------------------
/src/main/mavlink/common/mavlink.h:
--------------------------------------------------------------------------------
1 | /** @file
2 | * @brief MAVLink comm protocol built from common.xml
3 | * @see http://mavlink.org
4 | */
5 | #ifndef MAVLINK_H
6 | #define MAVLINK_H
7 |
8 | #ifndef MAVLINK_STX
9 | #define MAVLINK_STX 254
10 | #endif
11 |
12 | #ifndef MAVLINK_ENDIAN
13 | #define MAVLINK_ENDIAN MAVLINK_LITTLE_ENDIAN
14 | #endif
15 |
16 | #ifndef MAVLINK_ALIGNED_FIELDS
17 | #define MAVLINK_ALIGNED_FIELDS 1
18 | #endif
19 |
20 | #ifndef MAVLINK_CRC_EXTRA
21 | #define MAVLINK_CRC_EXTRA 1
22 | #endif
23 |
24 | #include "version.h"
25 | #include "common.h"
26 |
27 | #endif // MAVLINK_H
28 |
--------------------------------------------------------------------------------
/src/main/mavlink/common/version.h:
--------------------------------------------------------------------------------
1 | /** @file
2 | * @brief MAVLink comm protocol built from common.xml
3 | * @see http://mavlink.org
4 | */
5 | #ifndef MAVLINK_VERSION_H
6 | #define MAVLINK_VERSION_H
7 |
8 | #define MAVLINK_BUILD_DATE "Wed Apr 15 16:53:56 2015"
9 | #define MAVLINK_WIRE_PROTOCOL_VERSION "1.0"
10 | #define MAVLINK_MAX_DIALECT_PAYLOAD_SIZE 255
11 |
12 | #endif // MAVLINK_VERSION_H
13 |
--------------------------------------------------------------------------------
/src/main/mavlink/matrixpilot/mavlink.h:
--------------------------------------------------------------------------------
1 | /** @file
2 | * @brief MAVLink comm protocol built from matrixpilot.xml
3 | * @see http://mavlink.org
4 | */
5 | #ifndef MAVLINK_H
6 | #define MAVLINK_H
7 |
8 | #ifndef MAVLINK_STX
9 | #define MAVLINK_STX 254
10 | #endif
11 |
12 | #ifndef MAVLINK_ENDIAN
13 | #define MAVLINK_ENDIAN MAVLINK_LITTLE_ENDIAN
14 | #endif
15 |
16 | #ifndef MAVLINK_ALIGNED_FIELDS
17 | #define MAVLINK_ALIGNED_FIELDS 1
18 | #endif
19 |
20 | #ifndef MAVLINK_CRC_EXTRA
21 | #define MAVLINK_CRC_EXTRA 1
22 | #endif
23 |
24 | #include "version.h"
25 | #include "matrixpilot.h"
26 |
27 | #endif // MAVLINK_H
28 |
--------------------------------------------------------------------------------
/src/main/mavlink/matrixpilot/version.h:
--------------------------------------------------------------------------------
1 | /** @file
2 | * @brief MAVLink comm protocol built from matrixpilot.xml
3 | * @see http://mavlink.org
4 | */
5 | #ifndef MAVLINK_VERSION_H
6 | #define MAVLINK_VERSION_H
7 |
8 | #define MAVLINK_BUILD_DATE "Wed Apr 15 16:52:57 2015"
9 | #define MAVLINK_WIRE_PROTOCOL_VERSION "1.0"
10 | #define MAVLINK_MAX_DIALECT_PAYLOAD_SIZE 255
11 |
12 | #endif // MAVLINK_VERSION_H
13 |
--------------------------------------------------------------------------------
/src/main/mavlink/minimal/mavlink.h:
--------------------------------------------------------------------------------
1 | /** @file
2 | * @brief MAVLink comm protocol built from minimal.xml
3 | * @see http://mavlink.org
4 | */
5 | #ifndef MAVLINK_H
6 | #define MAVLINK_H
7 |
8 | #ifndef MAVLINK_STX
9 | #define MAVLINK_STX 254
10 | #endif
11 |
12 | #ifndef MAVLINK_ENDIAN
13 | #define MAVLINK_ENDIAN MAVLINK_LITTLE_ENDIAN
14 | #endif
15 |
16 | #ifndef MAVLINK_ALIGNED_FIELDS
17 | #define MAVLINK_ALIGNED_FIELDS 1
18 | #endif
19 |
20 | #ifndef MAVLINK_CRC_EXTRA
21 | #define MAVLINK_CRC_EXTRA 1
22 | #endif
23 |
24 | #include "version.h"
25 | #include "minimal.h"
26 |
27 | #endif // MAVLINK_H
28 |
--------------------------------------------------------------------------------
/src/main/mavlink/minimal/version.h:
--------------------------------------------------------------------------------
1 | /** @file
2 | * @brief MAVLink comm protocol built from minimal.xml
3 | * @see http://mavlink.org
4 | */
5 | #ifndef MAVLINK_VERSION_H
6 | #define MAVLINK_VERSION_H
7 |
8 | #define MAVLINK_BUILD_DATE "Wed Apr 15 16:53:07 2015"
9 | #define MAVLINK_WIRE_PROTOCOL_VERSION "1.0"
10 | #define MAVLINK_MAX_DIALECT_PAYLOAD_SIZE 9
11 |
12 | #endif // MAVLINK_VERSION_H
13 |
--------------------------------------------------------------------------------
/src/main/mavlink/pixhawk/mavlink.h:
--------------------------------------------------------------------------------
1 | /** @file
2 | * @brief MAVLink comm protocol built from pixhawk.xml
3 | * @see http://mavlink.org
4 | */
5 | #ifndef MAVLINK_H
6 | #define MAVLINK_H
7 |
8 | #ifndef MAVLINK_STX
9 | #define MAVLINK_STX 254
10 | #endif
11 |
12 | #ifndef MAVLINK_ENDIAN
13 | #define MAVLINK_ENDIAN MAVLINK_LITTLE_ENDIAN
14 | #endif
15 |
16 | #ifndef MAVLINK_ALIGNED_FIELDS
17 | #define MAVLINK_ALIGNED_FIELDS 1
18 | #endif
19 |
20 | #ifndef MAVLINK_CRC_EXTRA
21 | #define MAVLINK_CRC_EXTRA 1
22 | #endif
23 |
24 | #include "version.h"
25 | #include "pixhawk.h"
26 |
27 | #endif // MAVLINK_H
28 |
--------------------------------------------------------------------------------
/src/main/mavlink/pixhawk/version.h:
--------------------------------------------------------------------------------
1 | /** @file
2 | * @brief MAVLink comm protocol built from pixhawk.xml
3 | * @see http://mavlink.org
4 | */
5 | #ifndef MAVLINK_VERSION_H
6 | #define MAVLINK_VERSION_H
7 |
8 | #define MAVLINK_BUILD_DATE "Wed Apr 15 16:53:09 2015"
9 | #define MAVLINK_WIRE_PROTOCOL_VERSION "1.0"
10 | #define MAVLINK_MAX_DIALECT_PAYLOAD_SIZE 255
11 |
12 | #endif // MAVLINK_VERSION_H
13 |
--------------------------------------------------------------------------------
/src/main/mavlink/slugs/mavlink.h:
--------------------------------------------------------------------------------
1 | /** @file
2 | * @brief MAVLink comm protocol built from slugs.xml
3 | * @see http://mavlink.org
4 | */
5 | #ifndef MAVLINK_H
6 | #define MAVLINK_H
7 |
8 | #ifndef MAVLINK_STX
9 | #define MAVLINK_STX 254
10 | #endif
11 |
12 | #ifndef MAVLINK_ENDIAN
13 | #define MAVLINK_ENDIAN MAVLINK_LITTLE_ENDIAN
14 | #endif
15 |
16 | #ifndef MAVLINK_ALIGNED_FIELDS
17 | #define MAVLINK_ALIGNED_FIELDS 1
18 | #endif
19 |
20 | #ifndef MAVLINK_CRC_EXTRA
21 | #define MAVLINK_CRC_EXTRA 1
22 | #endif
23 |
24 | #include "version.h"
25 | #include "slugs.h"
26 |
27 | #endif // MAVLINK_H
28 |
--------------------------------------------------------------------------------
/src/main/mavlink/slugs/version.h:
--------------------------------------------------------------------------------
1 | /** @file
2 | * @brief MAVLink comm protocol built from slugs.xml
3 | * @see http://mavlink.org
4 | */
5 | #ifndef MAVLINK_VERSION_H
6 | #define MAVLINK_VERSION_H
7 |
8 | #define MAVLINK_BUILD_DATE "Wed Apr 15 16:53:19 2015"
9 | #define MAVLINK_WIRE_PROTOCOL_VERSION "1.0"
10 | #define MAVLINK_MAX_DIALECT_PAYLOAD_SIZE 255
11 |
12 | #endif // MAVLINK_VERSION_H
13 |
--------------------------------------------------------------------------------
/src/main/mavlink/test/mavlink.h:
--------------------------------------------------------------------------------
1 | /** @file
2 | * @brief MAVLink comm protocol built from test.xml
3 | * @see http://mavlink.org
4 | */
5 | #ifndef MAVLINK_H
6 | #define MAVLINK_H
7 |
8 | #ifndef MAVLINK_STX
9 | #define MAVLINK_STX 254
10 | #endif
11 |
12 | #ifndef MAVLINK_ENDIAN
13 | #define MAVLINK_ENDIAN MAVLINK_LITTLE_ENDIAN
14 | #endif
15 |
16 | #ifndef MAVLINK_ALIGNED_FIELDS
17 | #define MAVLINK_ALIGNED_FIELDS 1
18 | #endif
19 |
20 | #ifndef MAVLINK_CRC_EXTRA
21 | #define MAVLINK_CRC_EXTRA 1
22 | #endif
23 |
24 | #include "version.h"
25 | #include "test.h"
26 |
27 | #endif // MAVLINK_H
28 |
--------------------------------------------------------------------------------
/src/main/mavlink/test/version.h:
--------------------------------------------------------------------------------
1 | /** @file
2 | * @brief MAVLink comm protocol built from test.xml
3 | * @see http://mavlink.org
4 | */
5 | #ifndef MAVLINK_VERSION_H
6 | #define MAVLINK_VERSION_H
7 |
8 | #define MAVLINK_BUILD_DATE "Wed Apr 15 16:53:28 2015"
9 | #define MAVLINK_WIRE_PROTOCOL_VERSION "1.0"
10 | #define MAVLINK_MAX_DIALECT_PAYLOAD_SIZE 179
11 |
12 | #endif // MAVLINK_VERSION_H
13 |
--------------------------------------------------------------------------------
/src/main/mavlink/ualberta/mavlink.h:
--------------------------------------------------------------------------------
1 | /** @file
2 | * @brief MAVLink comm protocol built from ualberta.xml
3 | * @see http://mavlink.org
4 | */
5 | #ifndef MAVLINK_H
6 | #define MAVLINK_H
7 |
8 | #ifndef MAVLINK_STX
9 | #define MAVLINK_STX 254
10 | #endif
11 |
12 | #ifndef MAVLINK_ENDIAN
13 | #define MAVLINK_ENDIAN MAVLINK_LITTLE_ENDIAN
14 | #endif
15 |
16 | #ifndef MAVLINK_ALIGNED_FIELDS
17 | #define MAVLINK_ALIGNED_FIELDS 1
18 | #endif
19 |
20 | #ifndef MAVLINK_CRC_EXTRA
21 | #define MAVLINK_CRC_EXTRA 1
22 | #endif
23 |
24 | #include "version.h"
25 | #include "ualberta.h"
26 |
27 | #endif // MAVLINK_H
28 |
--------------------------------------------------------------------------------
/src/main/mavlink/ualberta/version.h:
--------------------------------------------------------------------------------
1 | /** @file
2 | * @brief MAVLink comm protocol built from ualberta.xml
3 | * @see http://mavlink.org
4 | */
5 | #ifndef MAVLINK_VERSION_H
6 | #define MAVLINK_VERSION_H
7 |
8 | #define MAVLINK_BUILD_DATE "Wed Apr 15 16:53:30 2015"
9 | #define MAVLINK_WIRE_PROTOCOL_VERSION "1.0"
10 | #define MAVLINK_MAX_DIALECT_PAYLOAD_SIZE 255
11 |
12 | #endif // MAVLINK_VERSION_H
13 |
--------------------------------------------------------------------------------
/src/main/msp/msp.h:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of Cleanflight.
3 | *
4 | * Cleanflight is free software: you can redistribute it and/or modify
5 | * it under the terms of the GNU General Public License as published by
6 | * the Free Software Foundation, either version 3 of the License, or
7 | * (at your option) any later version.
8 | *
9 | * Cleanflight is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | * GNU General Public License for more details.
13 | *
14 | * You should have received a copy of the GNU General Public License
15 | * along with Cleanflight. If not, see .
16 | */
17 |
18 | #pragma once
19 |
20 | typedef struct mspPacket_s {
21 | sbuf_t buf;
22 | int16_t cmd;
23 | int16_t result;
24 | } mspPacket_t;
25 |
26 | void mspInit(void);
27 |
28 | //
29 | // server
30 | //
31 | int mspProcessCommand(mspPacket_t *command, mspPacket_t *reply);
32 |
33 | // return positive for ACK, negative on error, zero for no reply
34 | int mspServerCommandHandler(mspPacket_t *cmd, mspPacket_t *reply);
35 |
36 | //
37 | // client
38 | //
39 | void mspProcessReply(mspPacket_t *reply);
40 |
41 | // return positive for ACK, negative on error
42 | int mspClientReplyHandler(mspPacket_t *reply);
43 |
--------------------------------------------------------------------------------
/src/main/osd/cleanflight_osd.h:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of Cleanflight.
3 | *
4 | * Cleanflight is free software: you can redistribute it and/or modify
5 | * it under the terms of the GNU General Public License as published by
6 | * the Free Software Foundation, either version 3 of the License, or
7 | * (at your option) any later version.
8 | *
9 | * Cleanflight is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | * GNU General Public License for more details.
13 | *
14 | * You should have received a copy of the GNU General Public License
15 | * along with Cleanflight. If not, see .
16 | */
17 |
18 | #pragma once
19 |
--------------------------------------------------------------------------------
/src/main/osd/config.h:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of Cleanflight.
3 | *
4 | * Cleanflight is free software: you can redistribute it and/or modify
5 | * it under the terms of the GNU General Public License as published by
6 | * the Free Software Foundation, either version 3 of the License, or
7 | * (at your option) any later version.
8 | *
9 | * Cleanflight is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | * GNU General Public License for more details.
13 | *
14 | * You should have received a copy of the GNU General Public License
15 | * along with Cleanflight. If not, see .
16 | */
17 |
18 | #pragma once
19 |
20 | void initEEPROM(void);
21 | void resetEEPROM(void);
22 | void readEEPROM(void);
23 | void writeEEPROM();
24 | void ensureEEPROMContainsValidData(void);
25 |
--------------------------------------------------------------------------------
/src/main/osd/fc_state.c:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of Cleanflight.
3 | *
4 | * Cleanflight is free software: you can redistribute it and/or modify
5 | * it under the terms of the GNU General Public License as published by
6 | * the Free Software Foundation, either version 3 of the License, or
7 | * (at your option) any later version.
8 | *
9 | * Cleanflight is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | * GNU General Public License for more details.
13 | *
14 | * You should have received a copy of the GNU General Public License
15 | * along with Cleanflight. If not, see .
16 | */
17 |
18 | #include
19 | #include
20 | #include
21 |
22 | #include
23 | #include "build/debug.h"
24 |
25 | #include "osd/fc_state.h"
26 |
27 | fcStatus_t fcStatus;
28 |
29 | uint16_t fcMotors[OSD_MAX_MOTORS];
30 |
--------------------------------------------------------------------------------
/src/main/osd/msp_client_osd.h:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of Cleanflight.
3 | *
4 | * Cleanflight is free software: you can redistribute it and/or modify
5 | * it under the terms of the GNU General Public License as published by
6 | * the Free Software Foundation, either version 3 of the License, or
7 | * (at your option) any later version.
8 | *
9 | * Cleanflight is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | * GNU General Public License for more details.
13 | *
14 | * You should have received a copy of the GNU General Public License
15 | * along with Cleanflight. If not, see .
16 | */
17 |
18 |
19 | typedef struct mspClientStatus_s {
20 | uint32_t lastReplyAt; // in micro-seconds.
21 | bool timeoutOccured;
22 | } mspClientStatus_t;
23 |
24 | extern mspClientStatus_t mspClientStatus;
25 |
26 | void mspClientProcess(void);
27 |
--------------------------------------------------------------------------------
/src/main/osd/msp_server_osd.h:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of Cleanflight.
3 | *
4 | * Cleanflight is free software: you can redistribute it and/or modify
5 | * it under the terms of the GNU General Public License as published by
6 | * the Free Software Foundation, either version 3 of the License, or
7 | * (at your option) any later version.
8 | *
9 | * Cleanflight is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | * GNU General Public License for more details.
13 | *
14 | * You should have received a copy of the GNU General Public License
15 | * along with Cleanflight. If not, see .
16 | */
17 |
18 | #pragma once
19 |
20 |
--------------------------------------------------------------------------------
/src/main/osd/osd_serial.h:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of Cleanflight.
3 | *
4 | * Cleanflight is free software: you can redistribute it and/or modify
5 | * it under the terms of the GNU General Public License as published by
6 | * the Free Software Foundation, either version 3 of the License, or
7 | * (at your option) any later version.
8 | *
9 | * Cleanflight is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | * GNU General Public License for more details.
13 | *
14 | * You should have received a copy of the GNU General Public License
15 | * along with Cleanflight. If not, see .
16 | */
17 |
18 | #pragma once
19 |
20 | typedef enum {
21 | BAUDRATE_MSP_SERVER = 0,
22 | BAUDRATE_MSP_CLIENT,
23 | BAUDRATE_RESERVED1,
24 | BAUDRATE_RESERVED2
25 | } functionBaudRate_e;
26 |
--------------------------------------------------------------------------------
/src/main/osd/osd_tasks.h:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of Cleanflight.
3 | *
4 | * Cleanflight is free software: you can redistribute it and/or modify
5 | * it under the terms of the GNU General Public License as published by
6 | * the Free Software Foundation, either version 3 of the License, or
7 | * (at your option) any later version.
8 | *
9 | * Cleanflight is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | * GNU General Public License for more details.
13 | *
14 | * You should have received a copy of the GNU General Public License
15 | * along with Cleanflight. If not, see .
16 | */
17 |
18 | #pragma once
19 |
20 | typedef enum {
21 | /* Actual tasks */
22 | TASK_SYSTEM = 0,
23 | TASK_CYCLE_TIME,
24 | TASK_BATTERY,
25 | TASK_STATUS_LED,
26 | TASK_HARDWARE_WATCHDOG,
27 | TASK_MSP_SERVER,
28 | TASK_DRAW_SCREEN,
29 | TASK_UPDATE_FC_STATE,
30 | TASK_TEST,
31 |
32 | /* Count of real tasks */
33 | TASK_COUNT
34 | } cfTaskId_e;
35 |
36 | void taskUpdateCycleTime(void);
37 | void taskMSP(void);
38 | void taskUpdateBattery(void);
39 | void taskStatusLed(void);
40 | void taskHardwareWatchdog(void);
41 | void taskSystem(void);
42 | void taskDrawScreen(void);
43 | void taskUpdateFCState(void);
44 | void taskTest(void);
45 |
--------------------------------------------------------------------------------
/src/main/platform.h:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of Cleanflight.
3 | *
4 | * Cleanflight is free software: you can redistribute it and/or modify
5 | * it under the terms of the GNU General Public License as published by
6 | * the Free Software Foundation, either version 3 of the License, or
7 | * (at your option) any later version.
8 | *
9 | * Cleanflight is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | * GNU General Public License for more details.
13 | *
14 | * You should have received a copy of the GNU General Public License
15 | * along with Cleanflight. If not, see .
16 | */
17 |
18 | #pragma once
19 |
20 | #ifdef STM32F40_41xxx
21 | #include "stm32f4xx_conf.h"
22 | #include "stm32f4xx_rcc.h"
23 | #include "stm32f4xx_gpio.h"
24 | #include "core_cm4.h"
25 |
26 | // Chip Unique ID on F405
27 | #define U_ID_0 (*(uint32_t*)0x1fff7a10)
28 | #define U_ID_1 (*(uint32_t*)0x1fff7a14)
29 | #define U_ID_2 (*(uint32_t*)0x1fff7a18)
30 |
31 | #endif
32 |
33 |
34 | #ifdef STM32F303xC
35 | #include "stm32f30x_conf.h"
36 | #include "stm32f30x_rcc.h"
37 | #include "stm32f30x_gpio.h"
38 | #include "core_cm4.h"
39 |
40 | // Chip Unique ID on F303
41 | #define U_ID_0 (*(uint32_t*)0x1FFFF7AC)
42 | #define U_ID_1 (*(uint32_t*)0x1FFFF7B0)
43 | #define U_ID_2 (*(uint32_t*)0x1FFFF7B4)
44 |
45 | #endif
46 |
47 | #ifdef STM32F10X
48 |
49 | #include "stm32f10x_conf.h"
50 | #include "stm32f10x_gpio.h"
51 | #include "core_cm3.h"
52 |
53 | // Chip Unique ID on F103
54 | #define U_ID_0 (*(uint32_t*)0x1FFFF7E8)
55 | #define U_ID_1 (*(uint32_t*)0x1FFFF7EC)
56 | #define U_ID_2 (*(uint32_t*)0x1FFFF7F0)
57 |
58 | #endif // STM32F10X
59 |
60 | #include "target.h"
61 |
62 |
--------------------------------------------------------------------------------
/src/main/rx/ibus.h:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of Cleanflight.
3 | *
4 | * Cleanflight is free software: you can redistribute it and/or modify
5 | * it under the terms of the GNU General Public License as published by
6 | * the Free Software Foundation, either version 3 of the License, or
7 | * (at your option) any later version.
8 | *
9 | * Cleanflight is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | * GNU General Public License for more details.
13 | *
14 | * You should have received a copy of the GNU General Public License
15 | * along with Cleanflight. If not, see .
16 | */
17 |
18 | #pragma once
19 |
20 | uint8_t ibusFrameStatus(void);
21 | bool ibusInit(rxRuntimeConfig_t *rxRuntimeConfig, rcReadRawDataPtr *callback);
22 |
--------------------------------------------------------------------------------
/src/main/rx/msp.h:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of Cleanflight.
3 | *
4 | * Cleanflight is free software: you can redistribute it and/or modify
5 | * it under the terms of the GNU General Public License as published by
6 | * the Free Software Foundation, either version 3 of the License, or
7 | * (at your option) any later version.
8 | *
9 | * Cleanflight is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | * GNU General Public License for more details.
13 | *
14 | * You should have received a copy of the GNU General Public License
15 | * along with Cleanflight. If not, see .
16 | */
17 |
18 | #pragma once
19 |
20 | bool rxMspFrameComplete(void);
21 | void rxMspFrameReceive(uint16_t *frame, int channelCount);
22 | void rxMspInit(rxRuntimeConfig_t *rxRuntimeConfig, rcReadRawDataPtr *callback);
23 |
--------------------------------------------------------------------------------
/src/main/rx/pwm.h:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of Cleanflight.
3 | *
4 | * Cleanflight is free software: you can redistribute it and/or modify
5 | * it under the terms of the GNU General Public License as published by
6 | * the Free Software Foundation, either version 3 of the License, or
7 | * (at your option) any later version.
8 | *
9 | * Cleanflight is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | * GNU General Public License for more details.
13 | *
14 | * You should have received a copy of the GNU General Public License
15 | * along with Cleanflight. If not, see .
16 | */
17 |
18 | #pragma once
19 |
20 | void rxPwmInit(rxRuntimeConfig_t *rxRuntimeConfig, rcReadRawDataPtr *callback);
21 |
--------------------------------------------------------------------------------
/src/main/rx/sbus.h:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of Cleanflight.
3 | *
4 | * Cleanflight is free software: you can redistribute it and/or modify
5 | * it under the terms of the GNU General Public License as published by
6 | * the Free Software Foundation, either version 3 of the License, or
7 | * (at your option) any later version.
8 | *
9 | * Cleanflight is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | * GNU General Public License for more details.
13 | *
14 | * You should have received a copy of the GNU General Public License
15 | * along with Cleanflight. If not, see .
16 | */
17 |
18 | #pragma once
19 |
20 | uint8_t sbusFrameStatus(void);
21 | bool sbusInit(rxRuntimeConfig_t *rxRuntimeConfig, rcReadRawDataPtr *callback);
22 |
--------------------------------------------------------------------------------
/src/main/rx/spektrum.h:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of Cleanflight.
3 | *
4 | * Cleanflight is free software: you can redistribute it and/or modify
5 | * it under the terms of the GNU General Public License as published by
6 | * the Free Software Foundation, either version 3 of the License, or
7 | * (at your option) any later version.
8 | *
9 | * Cleanflight is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | * GNU General Public License for more details.
13 | *
14 | * You should have received a copy of the GNU General Public License
15 | * along with Cleanflight. If not, see .
16 | */
17 |
18 | #pragma once
19 |
20 | #define SPEKTRUM_SAT_BIND_DISABLED 0
21 | #define SPEKTRUM_SAT_BIND_MAX 10
22 |
23 | uint8_t spektrumFrameStatus(void);
24 | bool spektrumInit(rxRuntimeConfig_t *rxRuntimeConfig, rcReadRawDataPtr *callback);
25 |
26 | void spektrumBind(rxConfig_t *rxConfig);
27 |
--------------------------------------------------------------------------------
/src/main/rx/sumd.h:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of Cleanflight.
3 | *
4 | * Cleanflight is free software: you can redistribute it and/or modify
5 | * it under the terms of the GNU General Public License as published by
6 | * the Free Software Foundation, either version 3 of the License, or
7 | * (at your option) any later version.
8 | *
9 | * Cleanflight is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | * GNU General Public License for more details.
13 | *
14 | * You should have received a copy of the GNU General Public License
15 | * along with Cleanflight. If not, see .
16 | */
17 |
18 | #pragma once
19 |
20 | uint8_t sumdFrameStatus(void);
21 | bool sumdInit(rxRuntimeConfig_t *rxRuntimeConfig, rcReadRawDataPtr *callback);
22 |
--------------------------------------------------------------------------------
/src/main/rx/sumh.h:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of Cleanflight.
3 | *
4 | * Cleanflight is free software: you can redistribute it and/or modify
5 | * it under the terms of the GNU General Public License as published by
6 | * the Free Software Foundation, either version 3 of the License, or
7 | * (at your option) any later version.
8 | *
9 | * Cleanflight is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | * GNU General Public License for more details.
13 | *
14 | * You should have received a copy of the GNU General Public License
15 | * along with Cleanflight. If not, see .
16 | */
17 |
18 | #pragma once
19 |
20 | uint8_t sumhFrameStatus(void);
21 | bool sumhInit(rxRuntimeConfig_t *rxRuntimeConfig, rcReadRawDataPtr *callback);
22 |
--------------------------------------------------------------------------------
/src/main/rx/xbus.h:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of Cleanflight.
3 | *
4 | * Cleanflight is free software: you can redistribute it and/or modify
5 | * it under the terms of the GNU General Public License as published by
6 | * the Free Software Foundation, either version 3 of the License, or
7 | * (at your option) any later version.
8 | *
9 | * Cleanflight is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | * GNU General Public License for more details.
13 | *
14 | * You should have received a copy of the GNU General Public License
15 | * along with Cleanflight. If not, see .
16 | */
17 |
18 | #pragma once
19 |
20 | #include "rx/rx.h"
21 |
22 | bool xBusInit(rxRuntimeConfig_t *rxRuntimeConfig, rcReadRawDataPtr *callback);
23 | uint8_t xBusFrameStatus(void);
24 |
--------------------------------------------------------------------------------
/src/main/sensors/boardalignment.h:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of Cleanflight.
3 | *
4 | * Cleanflight is free software: you can redistribute it and/or modify
5 | * it under the terms of the GNU General Public License as published by
6 | * the Free Software Foundation, either version 3 of the License, or
7 | * (at your option) any later version.
8 | *
9 | * Cleanflight is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | * GNU General Public License for more details.
13 | *
14 | * You should have received a copy of the GNU General Public License
15 | * along with Cleanflight. If not, see .
16 | */
17 |
18 | #pragma once
19 |
20 | typedef struct boardAlignment_s {
21 | int16_t rollDegrees;
22 | int16_t pitchDegrees;
23 | int16_t yawDegrees;
24 | } PG_PACKED boardAlignment_t;
25 |
26 | PG_DECLARE(boardAlignment_t, boardAlignment);
27 |
28 | void alignSensors(int32_t *src, int32_t *dest, uint8_t rotation);
29 | void initBoardAlignment(void);
30 |
--------------------------------------------------------------------------------
/src/main/sensors/compass.h:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of Cleanflight.
3 | *
4 | * Cleanflight is free software: you can redistribute it and/or modify
5 | * it under the terms of the GNU General Public License as published by
6 | * the Free Software Foundation, either version 3 of the License, or
7 | * (at your option) any later version.
8 | *
9 | * Cleanflight is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | * GNU General Public License for more details.
13 | *
14 | * You should have received a copy of the GNU General Public License
15 | * along with Cleanflight. If not, see .
16 | */
17 |
18 | #pragma once
19 |
20 | // Type of magnetometer used/detected
21 | typedef enum {
22 | MAG_DEFAULT = 0,
23 | MAG_NONE = 1,
24 | MAG_HMC5883 = 2,
25 | MAG_AK8975 = 3,
26 | MAG_NAZA = 4,
27 | MAG_AK8963 = 5
28 | } magSensor_e;
29 |
30 | #define MAG_MAX MAG_AK8963
31 |
32 | typedef struct compassConfig_s {
33 | int16_t mag_declination; // Get your magnetic decliniation from here : http://magnetic-declination.com/
34 | // For example, -6deg 37min, = -637 Japan, format is [sign]dddmm (degreesminutes) default is zero.
35 | } compassConfig_t;
36 |
37 | PG_DECLARE_PROFILE(compassConfig_t, compassConfig);
38 |
39 |
40 | #ifdef MAG
41 | void compassInit(void);
42 | void updateCompass(flightDynamicsTrims_t *magZero);
43 | #endif
44 |
45 | void recalculateMagneticDeclination(void);
46 |
47 | extern int32_t magADC[XYZ_AXIS_COUNT];
48 |
49 | extern sensor_align_e magAlign;
50 | extern mag_t mag;
51 | extern float magneticDeclination;
52 |
--------------------------------------------------------------------------------
/src/main/sensors/initialisation.h:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of Cleanflight.
3 | *
4 | * Cleanflight is free software: you can redistribute it and/or modify
5 | * it under the terms of the GNU General Public License as published by
6 | * the Free Software Foundation, either version 3 of the License, or
7 | * (at your option) any later version.
8 | *
9 | * Cleanflight is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | * GNU General Public License for more details.
13 | *
14 | * You should have received a copy of the GNU General Public License
15 | * along with Cleanflight. If not, see .
16 | */
17 |
18 | #pragma once
19 |
20 | bool sensorsAutodetect(void);
21 |
--------------------------------------------------------------------------------
/src/main/sensors/pitotmeter.h:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of Cleanflight.
3 | *
4 | * Cleanflight is free software: you can redistribute it and/or modify
5 | * it under the terms of the GNU General Public License as published by
6 | * the Free Software Foundation, either version 3 of the License, or
7 | * (at your option) any later version.
8 | *
9 | * Cleanflight is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | * GNU General Public License for more details.
13 | *
14 | * You should have received a copy of the GNU General Public License
15 | * along with Cleanflight. If not, see .
16 | */
17 |
18 | #pragma once
19 |
20 | #define PITOT_SAMPLE_COUNT_MAX 48
21 |
22 | typedef struct pitotmeterConfig_s {
23 | uint8_t pitot_sample_count; // size of baro filter array
24 | float pitot_noise_lpf; // additional LPF to reduce baro noise
25 | float pitot_scale; // scale value
26 | } pitotmeterConfig_t;
27 |
28 | #ifdef PITOT
29 | void usePitotmeterConfig(pitotmeterConfig_t *pitotmeterConfigToUse);
30 | bool isPitotCalibrationComplete(void);
31 | void pitotSetCalibrationCycles(uint16_t calibrationCyclesRequired);
32 | void pitotUpdate(uint32_t currentTime);
33 | bool isPitotReady(void);
34 | int32_t pitotCalculateAirSpeed(void);
35 | void performPitotCalibrationCycle(void);
36 | #endif
37 |
--------------------------------------------------------------------------------
/src/main/sensors/sensors.c:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of Cleanflight.
3 | *
4 | * Cleanflight is free software: you can redistribute it and/or modify
5 | * it under the terms of the GNU General Public License as published by
6 | * the Free Software Foundation, either version 3 of the License, or
7 | * (at your option) any later version.
8 | *
9 | * Cleanflight is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | * GNU General Public License for more details.
13 | *
14 | * You should have received a copy of the GNU General Public License
15 | * along with Cleanflight. If not, see .
16 | */
17 |
18 | #include
19 | #include
20 |
21 | #include
22 |
23 | #include "build/debug.h"
24 |
25 | #include "config/parameter_group.h"
26 | #include "config/parameter_group_ids.h"
27 |
28 | #include "sensors/sensors.h"
29 |
30 | PG_REGISTER(sensorSelectionConfig_t, sensorSelectionConfig, PG_SENSOR_SELECTION_CONFIG, 0);
31 | PG_REGISTER(sensorAlignmentConfig_t, sensorAlignmentConfig, PG_SENSOR_ALIGNMENT_CONFIG, 0);
32 | PG_REGISTER(sensorTrims_t, sensorTrims, PG_SENSOR_TRIMS, 0);
33 |
--------------------------------------------------------------------------------
/src/main/sensors/sonar.h:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of Cleanflight.
3 | *
4 | * Cleanflight is free software: you can redistribute it and/or modify
5 | * it under the terms of the GNU General Public License as published by
6 | * the Free Software Foundation, either version 3 of the License, or
7 | * (at your option) any later version.
8 | *
9 | * Cleanflight is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | * GNU General Public License for more details.
13 | *
14 | * You should have received a copy of the GNU General Public License
15 | * along with Cleanflight. If not, see .
16 | */
17 |
18 | #pragma once
19 |
20 | #define SONAR_OUT_OF_RANGE (-1)
21 |
22 | extern int16_t sonarMaxRangeCm;
23 | extern int16_t sonarCfAltCm;
24 | extern int16_t sonarMaxAltWithTiltCm;
25 |
26 | void sonarUpdate(void);
27 | int32_t sonarRead(void);
28 | int32_t sonarCalculateAltitude(int32_t sonarDistance, float cosTiltAngle);
29 | int32_t sonarGetLatestAltitude(void);
30 |
31 |
--------------------------------------------------------------------------------
/src/main/target/ALIENFLIGHTF3/hardware_revision.c:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of Cleanflight.
3 | *
4 | * Cleanflight is free software: you can redistribute it and/or modify
5 | * it under the terms of the GNU General Public License as published by
6 | * the Free Software Foundation, either version 3 of the License, or
7 | * (at your option) any later version.
8 | *
9 | * Cleanflight is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | * GNU General Public License for more details.
13 | *
14 | * You should have received a copy of the GNU General Public License
15 | * along with Cleanflight. If not, see .
16 | */
17 |
18 | #include
19 | #include
20 | #include
21 |
22 | #include "platform.h"
23 |
24 | #include "build/build_config.h"
25 |
26 | #include "drivers/system.h"
27 | #include "drivers/gpio.h"
28 |
29 | #include "hardware_revision.h"
30 |
31 | static const char * const hardwareRevisionNames[] = {
32 | "Unknown",
33 | "AlienFlight V1",
34 | "AlienFlight V2"
35 | };
36 |
37 | uint8_t hardwareRevision = UNKNOWN;
38 |
39 | void detectHardwareRevision(void)
40 | {
41 | gpio_config_t cfg = {HW_PIN, Mode_IPU, Speed_2MHz};
42 | RCC_AHBPeriphClockCmd(HW_PERIPHERAL, ENABLE);
43 | gpioInit(HW_GPIO, &cfg);
44 |
45 | // Check hardware revision
46 | delayMicroseconds(10); // allow configuration to settle
47 | if (digitalIn(HW_GPIO, HW_PIN)) {
48 | hardwareRevision = AFF3_REV_1;
49 | } else {
50 | hardwareRevision = AFF3_REV_2;
51 | }
52 | }
53 |
54 | void updateHardwareRevision(void)
55 | {
56 | }
57 |
--------------------------------------------------------------------------------
/src/main/target/ALIENFLIGHTF3/hardware_revision.h:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of Cleanflight.
3 | *
4 | * Cleanflight is free software: you can redistribute it and/or modify
5 | * it under the terms of the GNU General Public License as published by
6 | * the Free Software Foundation, either version 3 of the License, or
7 | * (at your option) any later version.
8 | *
9 | * Cleanflight is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | * GNU General Public License for more details.
13 | *
14 | * You should have received a copy of the GNU General Public License
15 | * along with Cleanflight. If not, see .
16 | */
17 |
18 | typedef enum awf3HardwareRevision_t {
19 | UNKNOWN = 0,
20 | AFF3_REV_1, // MPU6050 / MPU9150 (I2C)
21 | AFF3_REV_2 // MPU6500 / MPU9250 (SPI)
22 | } awf3HardwareRevision_e;
23 |
24 | extern uint8_t hardwareRevision;
25 |
26 | void updateHardwareRevision(void);
27 | void detectHardwareRevision(void);
28 |
--------------------------------------------------------------------------------
/src/main/target/CJMCU/hardware_revision.c:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of Cleanflight.
3 | *
4 | * Cleanflight is free software: you can redistribute it and/or modify
5 | * it under the terms of the GNU General Public License as published by
6 | * the Free Software Foundation, either version 3 of the License, or
7 | * (at your option) any later version.
8 | *
9 | * Cleanflight is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | * GNU General Public License for more details.
13 | *
14 | * You should have received a copy of the GNU General Public License
15 | * along with Cleanflight. If not, see .
16 | */
17 |
18 | #include
19 | #include
20 | #include
21 |
22 | #include
23 |
24 | #include "build/build_config.h"
25 |
26 | #include "drivers/system.h"
27 | #include "drivers/bus_spi.h"
28 | #include "drivers/sensor.h"
29 | #include "drivers/accgyro.h"
30 | #include "drivers/accgyro_spi_mpu6500.h"
31 |
32 | #include "hardware_revision.h"
33 |
34 | static const char * const hardwareRevisionNames[] = {
35 | "Unknown",
36 | "R1",
37 | "R2"
38 | };
39 |
40 | uint8_t hardwareRevision = UNKNOWN;
41 |
42 | void detectHardwareRevision(void)
43 | {
44 | if (GPIOC->IDR & GPIO_Pin_15) {
45 | hardwareRevision = REV_2;
46 | } else {
47 | hardwareRevision = REV_1;
48 | }
49 | }
50 |
51 | void updateHardwareRevision(void)
52 | {
53 | }
54 |
--------------------------------------------------------------------------------
/src/main/target/CJMCU/hardware_revision.h:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of Cleanflight.
3 | *
4 | * Cleanflight is free software: you can redistribute it and/or modify
5 | * it under the terms of the GNU General Public License as published by
6 | * the Free Software Foundation, either version 3 of the License, or
7 | * (at your option) any later version.
8 | *
9 | * Cleanflight is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | * GNU General Public License for more details.
13 | *
14 | * You should have received a copy of the GNU General Public License
15 | * along with Cleanflight. If not, see .
16 | */
17 |
18 | typedef enum cjmcuHardwareRevision_t {
19 | UNKNOWN = 0,
20 | REV_1, // Blue LED3
21 | REV_2 // Green LED3
22 | } cjmcuHardwareRevision_e;
23 |
24 | extern uint8_t hardwareRevision;
25 |
26 | void updateHardwareRevision(void);
27 | void detectHardwareRevision(void);
28 |
29 | void spiBusInit(void);
30 |
--------------------------------------------------------------------------------
/src/main/target/NAZE/hardware_revision.h:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of Cleanflight.
3 | *
4 | * Cleanflight is free software: you can redistribute it and/or modify
5 | * it under the terms of the GNU General Public License as published by
6 | * the Free Software Foundation, either version 3 of the License, or
7 | * (at your option) any later version.
8 | *
9 | * Cleanflight is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | * GNU General Public License for more details.
13 | *
14 | * You should have received a copy of the GNU General Public License
15 | * along with Cleanflight. If not, see .
16 | */
17 |
18 | typedef enum nazeHardwareRevision_t {
19 | UNKNOWN = 0,
20 | NAZE32, // Naze32 and compatible with 8MHz HSE
21 | NAZE32_REV5, // Naze32 and compatible with 12MHz HSE
22 | NAZE32_SP // Naze32 w/Sensor Platforms
23 | } nazeHardwareRevision_e;
24 |
25 | extern uint8_t hardwareRevision;
26 |
27 | void updateHardwareRevision(void);
28 | void detectHardwareRevision(void);
29 |
30 | void spiBusInit(void);
31 |
--------------------------------------------------------------------------------
/src/main/target/stm32_flash_f103_128k.ld:
--------------------------------------------------------------------------------
1 | /*
2 | *****************************************************************************
3 | **
4 | ** File : stm32_flash.ld
5 | **
6 | ** Abstract : Linker script for STM32F103CB Device with
7 | ** 128KByte FLASH, 20KByte RAM
8 | **
9 | *****************************************************************************
10 | */
11 |
12 | /* Specify the memory areas. */
13 | MEMORY
14 | {
15 | FLASH (rx) : ORIGIN = 0x08000000, LENGTH = 124K
16 | FLASH_CONFIG (r) : ORIGIN = 0x0801F000, LENGTH = 4K
17 |
18 | RAM (xrw) : ORIGIN = 0x20000000, LENGTH = 20K
19 | MEMORY_B1 (rx) : ORIGIN = 0x60000000, LENGTH = 0K
20 | }
21 |
22 | INCLUDE "stm32_flash.ld"
23 |
--------------------------------------------------------------------------------
/src/main/target/stm32_flash_f103_256k.ld:
--------------------------------------------------------------------------------
1 | /*
2 | *****************************************************************************
3 | **
4 | ** File : stm32_flash.ld
5 | **
6 | ** Abstract : Linker script for STM32F103RC Device with
7 | ** 256KByte FLASH, 48KByte RAM
8 | **
9 | *****************************************************************************
10 | */
11 |
12 | /* Specify the memory areas. */
13 | MEMORY
14 | {
15 | FLASH (rx) : ORIGIN = 0x08000000, LENGTH = 252K
16 | FLASH_CONFIG (r) : ORIGIN = 0x0803F000, LENGTH = 4K
17 |
18 | RAM (xrw) : ORIGIN = 0x20000000, LENGTH = 48K
19 | MEMORY_B1 (rx) : ORIGIN = 0x60000000, LENGTH = 0K
20 | }
21 |
22 | INCLUDE "stm32_flash.ld"
23 |
--------------------------------------------------------------------------------
/src/main/target/stm32_flash_f103_64k.ld:
--------------------------------------------------------------------------------
1 | /*
2 | *****************************************************************************
3 | **
4 | ** File : stm32_flash.ld
5 | **
6 | ** Abstract : Linker script for STM32F103C8 Device with
7 | ** 64KByte FLASH, 20KByte RAM
8 | **
9 | *****************************************************************************
10 | */
11 |
12 | /* Specify the memory areas. */
13 | MEMORY
14 | {
15 | FLASH (rx) : ORIGIN = 0x08000000, LENGTH = 62K
16 | FLASH_CONFIG (r) : ORIGIN = 0x0800F800, LENGTH = 2K
17 |
18 | RAM (xrw) : ORIGIN = 0x20000000, LENGTH = 20K
19 | MEMORY_B1 (rx) : ORIGIN = 0x60000000, LENGTH = 0K
20 | }
21 |
22 | INCLUDE "stm32_flash.ld"
23 |
--------------------------------------------------------------------------------
/src/main/target/stm32_flash_f303_128k.ld:
--------------------------------------------------------------------------------
1 | /*
2 | *****************************************************************************
3 | **
4 | ** File : stm32_flash.ld
5 | **
6 | ** Abstract : Linker script for STM32F30x Device with
7 | ** 128KByte FLASH and 40KByte RAM
8 | **
9 | *****************************************************************************
10 | */
11 |
12 | /* Specify the memory areas. */
13 | MEMORY
14 | {
15 | FLASH (rx) : ORIGIN = 0x08000000, LENGTH = 124K
16 | FLASH_CONFIG (r) : ORIGIN = 0x0801F000, LENGTH = 4K
17 |
18 | RAM (xrw) : ORIGIN = 0x20000000, LENGTH = 40K
19 | MEMORY_B1 (rx) : ORIGIN = 0x60000000, LENGTH = 0K
20 | }
21 |
22 | INCLUDE "stm32_flash.ld"
23 |
--------------------------------------------------------------------------------
/src/main/target/stm32_flash_f303_256k.ld:
--------------------------------------------------------------------------------
1 | /*
2 | *****************************************************************************
3 | **
4 | ** File : stm32_flash.ld
5 | **
6 | ** Abstract : Linker script for STM32F30x Device with
7 | ** 256KByte FLASH and 40KByte RAM
8 | **
9 | *****************************************************************************
10 | */
11 |
12 | /* Specify the memory areas. */
13 | MEMORY
14 | {
15 | FLASH (rx) : ORIGIN = 0x08000000, LENGTH = 252K
16 | FLASH_CONFIG (r) : ORIGIN = 0x0803F000, LENGTH = 4K
17 |
18 | RAM (xrw) : ORIGIN = 0x20000000, LENGTH = 40K
19 | MEMORY_B1 (rx) : ORIGIN = 0x60000000, LENGTH = 0K
20 | }
21 |
22 | INCLUDE "stm32_flash.ld"
23 |
--------------------------------------------------------------------------------
/src/main/target/stm32_flash_f405.ld:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sambas/cleanflight/6896918928507719911a34acaf13e72aa4a0553c/src/main/target/stm32_flash_f405.ld
--------------------------------------------------------------------------------
/src/main/target/stm32_flash_f405_bl.ld:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sambas/cleanflight/6896918928507719911a34acaf13e72aa4a0553c/src/main/target/stm32_flash_f405_bl.ld
--------------------------------------------------------------------------------
/src/main/telemetry/frsky.h:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of Cleanflight.
3 | *
4 | * Cleanflight is free software: you can redistribute it and/or modify
5 | * it under the terms of the GNU General Public License as published by
6 | * the Free Software Foundation, either version 3 of the License, or
7 | * (at your option) any later version.
8 | *
9 | * Cleanflight is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | * GNU General Public License for more details.
13 | *
14 | * You should have received a copy of the GNU General Public License
15 | * along with Cleanflight. If not, see .
16 | */
17 |
18 | #include "rx/rx.h"
19 |
20 | #ifndef TELEMETRY_FRSKY_H_
21 | #define TELEMETRY_FRSKY_H_
22 |
23 | typedef enum {
24 | FRSKY_VFAS_PRECISION_LOW = 0,
25 | FRSKY_VFAS_PRECISION_HIGH
26 | } frskyVFasPrecision_e;
27 |
28 | typedef struct frskyTelemetryConfig_s {
29 | float gpsNoFixLatitude;
30 | float gpsNoFixLongitude;
31 | frskyGpsCoordFormat_e frsky_coordinate_format;
32 | frskyUnit_e frsky_unit;
33 | uint8_t frsky_vfas_precision;
34 | } frskyTelemetryConfig_t;
35 |
36 | PG_DECLARE(frskyTelemetryConfig_t, frskyTelemetryConfig);
37 |
38 | void handleFrSkyTelemetry(uint16_t deadband3d_throttle);
39 | void checkFrSkyTelemetryState(void);
40 |
41 | void initFrSkyTelemetry(void);
42 | void configureFrSkyTelemetryPort(void);
43 | void freeFrSkyTelemetryPort(void);
44 |
45 | #endif /* TELEMETRY_FRSKY_H_ */
46 |
--------------------------------------------------------------------------------
/src/main/telemetry/ltm.h:
--------------------------------------------------------------------------------
1 | /*
2 | * ltm.h
3 | *
4 | * This file is part of Cleanflight.
5 | *
6 | * Cleanflight is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * Cleanflight is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU General Public License
17 | * along with Cleanflight. If not, see .
18 | */
19 |
20 | #ifndef TELEMETRY_LTM_H_
21 | #define TELEMETRY_LTM_H_
22 |
23 | void initLtmTelemetry(void);
24 | void handleLtmTelemetry(void);
25 | void checkLtmTelemetryState(void);
26 |
27 | void freeLtmTelemetryPort(void);
28 | void configureLtmTelemetryPort(void);
29 |
30 | #endif /* TELEMETRY_LTM_H_ */
31 |
--------------------------------------------------------------------------------
/src/main/telemetry/mavlink.h:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of Cleanflight.
3 | *
4 | * Cleanflight is free software: you can redistribute it and/or modify
5 | * it under the terms of the GNU General Public License as published by
6 | * the Free Software Foundation, either version 3 of the License, or
7 | * (at your option) any later version.
8 | *
9 | * Cleanflight is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | * GNU General Public License for more details.
13 | *
14 | * You should have received a copy of the GNU General Public License
15 | * along with Cleanflight. If not, see .
16 | */
17 |
18 | #ifndef TELEMETRY_MAVLINK_H_
19 | #define TELEMETRY_MAVLINK_H_
20 |
21 | void initMAVLinkTelemetry(void);
22 | void handleMAVLinkTelemetry(void);
23 | void checkMAVLinkTelemetryState(void);
24 |
25 | void freeMAVLinkTelemetryPort(void);
26 | void configureMAVLinkTelemetryPort(void);
27 |
28 | #endif /* TELEMETRY_MSP_H_ */
29 |
--------------------------------------------------------------------------------
/src/main/telemetry/smartport.h:
--------------------------------------------------------------------------------
1 | /*
2 | * smartport.h
3 | *
4 | * Created on: 25 October 2014
5 | * Author: Frank26080115
6 | */
7 |
8 | #ifndef TELEMETRY_SMARTPORT_H_
9 | #define TELEMETRY_SMARTPORT_H_
10 |
11 | void initSmartPortTelemetry(void);
12 |
13 | void handleSmartPortTelemetry(void);
14 | void checkSmartPortTelemetryState(void);
15 |
16 | void configureSmartPortTelemetryPort(void);
17 | void freeSmartPortTelemetryPort(void);
18 |
19 | bool isSmartPortTimedOut(void);
20 |
21 | #endif /* TELEMETRY_SMARTPORT_H_ */
22 |
--------------------------------------------------------------------------------
/src/main/telemetry/telemetry.h:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of Cleanflight.
3 | *
4 | * Cleanflight is free software: you can redistribute it and/or modify
5 | * it under the terms of the GNU General Public License as published by
6 | * the Free Software Foundation, either version 3 of the License, or
7 | * (at your option) any later version.
8 | *
9 | * Cleanflight is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | * GNU General Public License for more details.
13 | *
14 | * You should have received a copy of the GNU General Public License
15 | * along with Cleanflight. If not, see .
16 | */
17 |
18 | #pragma once
19 |
20 | typedef enum {
21 | FRSKY_FORMAT_DMS = 0,
22 | FRSKY_FORMAT_NMEA
23 | } frskyGpsCoordFormat_e;
24 |
25 | typedef enum {
26 | FRSKY_UNIT_METRICS = 0,
27 | FRSKY_UNIT_IMPERIALS
28 | } frskyUnit_e;
29 |
30 | typedef struct telemetryConfig_s {
31 | uint8_t telemetry_switch; // Use aux channel to change serial output & baudrate( MSP / Telemetry ). It disables automatic switching to Telemetry when armed.
32 | uint8_t telemetry_inversion; // also shared with smartport inversion
33 | } telemetryConfig_t;
34 |
35 | PG_DECLARE(telemetryConfig_t, telemetryConfig);
36 |
37 | void telemetryInit(void);
38 |
39 | void telemetryCheckState(void);
40 | void telemetryProcess(uint16_t deadband3d_throttle);
41 |
42 | bool telemetryDetermineEnabledState(portSharing_e portSharing);
43 |
44 | void telemetryUseConfig(telemetryConfig_t *telemetryConfig);
45 |
46 |
--------------------------------------------------------------------------------
/src/test/mock/mock_system.cc:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of Cleanflight.
3 | *
4 | * Cleanflight is free software: you can redistribute it and/or modify
5 | * it under the terms of the GNU General Public License as published by
6 | * the Free Software Foundation, either version 3 of the License, or
7 | * (at your option) any later version.
8 | *
9 | * Cleanflight is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | * GNU General Public License for more details.
13 | *
14 | * You should have received a copy of the GNU General Public License
15 | * along with Cleanflight. If not, see .
16 | */
17 |
18 | #include
19 |
20 | extern "C" {
21 | #include "platform.h"
22 | #include "drivers/system.h"
23 | }
24 |
25 | #include "unittest_macros.h"
26 | #include "gtest/gtest.h"
27 |
28 | void failureMode(uint8_t mode)
29 | {
30 | UNUSED(mode);
31 | EXPECT_TRUE(false);
32 | }
33 |
34 | uint16_t cycleTime;
35 |
--------------------------------------------------------------------------------
/src/test/unit/parameter_group.ld:
--------------------------------------------------------------------------------
1 |
2 | SECTIONS {
3 | /* BLOCK: on Windows (PE) output section must be page-aligned. Use 4-byte alignment otherwise */
4 | /* SUBALIGN: force 4-byte alignment of input sections for pg_registry.
5 | Gcc defaults to 32 bytes; padding is then inserted between object files, breaking the init structure. */
6 | .pg_registry BLOCK( DEFINED(__section_alignment__) ? __section_alignment__ : 4 ) : SUBALIGN(4)
7 | {
8 | PROVIDE_HIDDEN (__pg_registry_start = . );
9 | PROVIDE_HIDDEN (___pg_registry_start = . );
10 | KEEP (*(.pg_registry))
11 | KEEP (*(SORT(.pg_registry.*)))
12 | PROVIDE_HIDDEN (__pg_registry_end = . );
13 | PROVIDE_HIDDEN (___pg_registry_end = . );
14 |
15 | PROVIDE_HIDDEN (__pg_resetdata_start = . );
16 | PROVIDE_HIDDEN (___pg_resetdata_start = . );
17 | KEEP (*(.pg_resetdata))
18 | PROVIDE_HIDDEN (__pg_resetdata_end = . );
19 | PROVIDE_HIDDEN (___pg_resetdata_end = . );
20 | }
21 | }
22 | INSERT AFTER .text;
23 |
--------------------------------------------------------------------------------
/src/test/unit/target.h:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of Cleanflight.
3 | *
4 | * Cleanflight is free software: you can redistribute it and/or modify
5 | * it under the terms of the GNU General Public License as published by
6 | * the Free Software Foundation, either version 3 of the License, or
7 | * (at your option) any later version.
8 | *
9 | * Cleanflight is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | * GNU General Public License for more details.
13 | *
14 | * You should have received a copy of the GNU General Public License
15 | * along with Cleanflight. If not, see .
16 | */
17 |
18 | #pragma once
19 |
20 | #define MAG
21 | #define BARO
22 | #define GPS
23 | #define DISPLAY
24 | #define TELEMETRY
25 | #define LED_STRIP
26 | #define USE_SERVOS
27 | #define TRANSPONDER
28 | #define USE_VCP
29 | #define USE_UART1
30 | #define USE_UART2
31 | #define USE_UART3
32 | #define USE_UART4
33 | #define USE_UART5
34 | #define USE_SOFTSERIAL1
35 | #define USE_SOFTSERIAL2
36 |
37 | #define SERIAL_PORT_COUNT 8
38 |
39 | #define MAX_SIMULTANEOUS_ADJUSTMENT_COUNT 6
40 |
41 | #define TARGET_BOARD_IDENTIFIER "TEST"
42 |
43 | #define LED_STRIP_TIMER 1
44 | #define SOFTSERIAL_1_TIMER 2
45 | #define SOFTSERIAL_2_TIMER 3
46 |
--------------------------------------------------------------------------------
/src/test/unit/unittest_macros.h:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of Cleanflight.
3 | *
4 | * Cleanflight is free software: you can redistribute it and/or modify
5 | * it under the terms of the GNU General Public License as published by
6 | * the Free Software Foundation, either version 3 of the License, or
7 | * (at your option) any later version.
8 | *
9 | * Cleanflight is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | * GNU General Public License for more details.
13 | *
14 | * You should have received a copy of the GNU General Public License
15 | * along with Cleanflight. If not, see .
16 | */
17 |
18 | #pragma once
19 |
20 |
21 | #define UNUSED(x) (void)(x)
22 |
--------------------------------------------------------------------------------
/support/buildserver/upload.php:
--------------------------------------------------------------------------------
1 |
58 |
--------------------------------------------------------------------------------
/support/flash.bat:
--------------------------------------------------------------------------------
1 | @@echo OFF
2 |
3 | :: User configuration
4 |
5 | :: set your port number. ie: for COM6 , port is 6
6 | set PORT=2
7 | :: location of stmflashloader.exe, this is default
8 | set FLASH_LOADER="C:\Program Files (x86)\STMicroelectronics\Software\Flash Loader Demonstrator\STMFlashLoader.exe"
9 | :: path to firmware
10 | set FIRMWARE="D:\baseflight.hex"
11 |
12 | :: ----------------------------------------------
13 |
14 | mode COM%PORT% BAUD=115200 PARITY=N DATA=8 STOP=1 XON=OFF DTR=OFF RTS=OFF
15 | echo/|set /p ="R" > COM%PORT%:
16 |
17 | TIMEOUT /T 3
18 |
19 | cd %LOADER_PATH%
20 |
21 | %FLASH_LOADER% ^
22 | -c --pn %PORT% --br 115200 --db 8 ^
23 | -i STM32_Med-density_128K ^
24 | -e --all ^
25 | -d --fn %FIRMWARE% ^
26 | -r --a 0x8000000
27 |
--------------------------------------------------------------------------------
/support/stmloader/Makefile:
--------------------------------------------------------------------------------
1 | CC = $(CROSS_COMPILE)gcc
2 | AR = $(CROSS_COMPILE)ar
3 | export CC
4 | export AR
5 |
6 | all:
7 | $(CC) -g -o stmloader -I./ \
8 | loader.c \
9 | serial.c \
10 | stmbootloader.c \
11 | -Wall
12 |
13 | clean:
14 | rm -f stmloader; rm -rf stmloader.dSYM
15 |
--------------------------------------------------------------------------------
/support/stmloader/serial.h:
--------------------------------------------------------------------------------
1 | /*
2 | This file is part of AutoQuad.
3 |
4 | AutoQuad is free software: you can redistribute it and/or modify
5 | it under the terms of the GNU General Public License as published by
6 | the Free Software Foundation, either version 3 of the License, or
7 | (at your option) any later version.
8 |
9 | AutoQuad is distributed in the hope that it will be useful,
10 | but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | GNU General Public License for more details.
13 | You should have received a copy of the GNU General Public License
14 | along with AutoQuad. If not, see .
15 |
16 | Copyright © 2011 Bill Nesbitt
17 | */
18 |
19 | #ifndef _serial_h
20 | #define _serial_h
21 |
22 | #define INPUT_BUFFER_SIZE 1024
23 |
24 | typedef struct {
25 | int fd;
26 | } serialStruct_t;
27 |
28 | extern serialStruct_t *initSerial(const char *port, unsigned int baud, char ctsRts);
29 | extern void serialWrite(serialStruct_t *s, const char *str, unsigned int len);
30 | extern void serialWriteChar(serialStruct_t *s, unsigned char c);
31 | extern unsigned char serialAvailable(serialStruct_t *s);
32 | extern void serialFlush(serialStruct_t *s);
33 | extern unsigned char serialRead(serialStruct_t *s);
34 | extern void serialEvenParity(serialStruct_t *s);
35 | extern void serialNoParity(serialStruct_t *s);
36 | extern void serialFree(serialStruct_t *s);
37 |
38 | #endif
39 |
--------------------------------------------------------------------------------
/support/stmloader/stmbootloader.h:
--------------------------------------------------------------------------------
1 | /*
2 | This file is part of AutoQuad.
3 |
4 | AutoQuad is free software: you can redistribute it and/or modify
5 | it under the terms of the GNU General Public License as published by
6 | the Free Software Foundation, either version 3 of the License, or
7 | (at your option) any later version.
8 |
9 | AutoQuad is distributed in the hope that it will be useful,
10 | but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | GNU General Public License for more details.
13 | You should have received a copy of the GNU General Public License
14 | along with AutoQuad. If not, see .
15 |
16 | Copyright © 2011 Bill Nesbitt
17 | */
18 |
19 | #ifndef _stmbootloader_h
20 | #define _stmbootloader_h
21 |
22 | #include
23 | #include "serial.h"
24 |
25 | extern void stmLoader(serialStruct_t *s, FILE *fp, unsigned char overrideParity, unsigned char noSendR);
26 |
27 | #endif
28 |
--------------------------------------------------------------------------------