• 大小: 0.60M
    文件类型: .zip
    金币: 1
    下载: 0 次
    发布日期: 2024-04-20
  • 语言: C/C++
  • 标签: 飞行器  国外  迷你  

资源简介

国外很强的迷你四轴飞行器

资源截图

代码片段和文件信息

/**
 *    ||          ____  _ __                           
 * +------+      / __ )(_) /_______________ _____  ___ 
 * | 0xBC |     / __  / / __/ ___/ ___/ __ ‘/_  / / _ \
 * +------+    / /_/ / / /_/ /__/ /  / /_/ / / /_/  __/
 *  ||  ||    /_____/_/\__/\___/_/   \___/ /___/\___/
 *
 * Crazyflie control firmware
 *
 * Copyright (C) 2011-2012 Bitcraze AB
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation in version 3.
 *
 * This program is distributed in the hope that it will be useful
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program. If not see .
 *
 * adc.c - Analog Digital Conversion
 *
 * TODO: Describe functionality.
 *
 * Sample time: According to the formula in the stm32 product manual
 *              page 69 with a Ts of 28.5 samples 12-bit and ADC@12
 *              the highest impedance to use is 25.2kOhm.
 */
#include “stm32f10x_conf.h“

#include “FreeRTOS.h“
#include “task.h“
#include “semphr.h“
#include “adc.h“
#include “pm.h“
#include “nvicconf.h“
#include “imu.h“

#ifdef ADC_OUTPUT_RAW_DATA
#include “uart.h“
#include “acc.h“
#endif

// PORT A
#define GPIO_VBAT        GPIO_Pin_3

// CHANNELS
#define NBR_OF_ADC_CHANNELS   1
#define CH_VBAT               ADC_Channel_3

#define CH_VREF               ADC_Channel_17
#define CH_TEMP               ADC_Channel_16

static bool isInit;
volatile AdcGroup adcValues[ADC_MEAN_SIZE * 2];

xQueueHandle      adcQueue;

static void adcDmaInit(void)
{
  DMA_InitTypeDef DMA_InitStructure;

  RCC_AHBPeriphClockCmd(RCC_AHBPeriph_DMA1 ENABLE);

  // DMA channel1 configuration
  DMA_DeInit(DMA1_Channel1);
  DMA_InitStructure.DMA_PeripheralbaseAddr = (uint32_t)&ADC1->DR;
  DMA_InitStructure.DMA_MemorybaseAddr = (uint32_t)&adcValues;
  DMA_InitStructure.DMA_DIR = DMA_DIR_PeripheralSRC;
  DMA_InitStructure.DMA_BufferSize = NBR_OF_ADC_CHANNELS * (ADC_MEAN_SIZE * 2);
  DMA_InitStructure.DMA_PeripheralInc = DMA_PeripheralInc_Disable;
  DMA_InitStructure.DMA_MemoryInc = DMA_MemoryInc_Enable;
  DMA_InitStructure.DMA_PeripheralDataSize = DMA_PeripheralDataSize_Word;
  DMA_InitStructure.DMA_MemoryDataSize = DMA_MemoryDataSize_Word;
  DMA_InitStructure.DMA_Mode = DMA_Mode_Circular;
  DMA_InitStructure.DMA_Priority = DMA_Priority_VeryHigh;
  DMA_InitStructure.DMA_M2M = DMA_M2M_Disable;
  DMA_Init(DMA1_Channel1 &DMA_InitStructure);
  // Enable DMA channel1
  DMA_Cmd(DMA1_Channel1 ENABLE);
}

/**
 * Decimates the adc samples after oversampling
 */
static void adcDecimate(AdcGroup* oversampled AdcGroup* decimated)
{
  uint32_t i j;
  uint32_

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----
     目录           0  2016-11-07 14:39  固件源码\
     目录           0  2016-11-07 14:39  固件源码\bitcraze-crazyflie-firmware-26d661941c7e\
     文件         147  2013-03-03 20:06  固件源码\bitcraze-crazyflie-firmware-26d661941c7e\.hg_archival.txt
     文件        4762  2013-03-03 20:06  固件源码\bitcraze-crazyflie-firmware-26d661941c7e\Makefile
     文件        1736  2013-03-03 20:06  固件源码\bitcraze-crazyflie-firmware-26d661941c7e\README
     目录           0  2016-11-07 14:39  固件源码\bitcraze-crazyflie-firmware-26d661941c7e\bin\
     目录           0  2016-11-07 14:39  固件源码\bitcraze-crazyflie-firmware-26d661941c7e\bin\dep\
     文件          39  2013-03-03 20:06  固件源码\bitcraze-crazyflie-firmware-26d661941c7e\bin\dep\readme.txt
     文件          30  2013-03-03 20:06  固件源码\bitcraze-crazyflie-firmware-26d661941c7e\bin\readme.txt
     目录           0  2016-11-07 14:39  固件源码\bitcraze-crazyflie-firmware-26d661941c7e\config\
     文件        5882  2013-03-03 20:06  固件源码\bitcraze-crazyflie-firmware-26d661941c7e\config\FreeRTOSConfig.h
     文件        3336  2013-03-03 20:06  固件源码\bitcraze-crazyflie-firmware-26d661941c7e\config\config.h
     文件        1623  2013-03-03 20:06  固件源码\bitcraze-crazyflie-firmware-26d661941c7e\config\nvicconf.h
     文件        3156  2013-03-03 20:06  固件源码\bitcraze-crazyflie-firmware-26d661941c7e\config\stm32f10x_conf.h
     目录           0  2016-11-07 14:39  固件源码\bitcraze-crazyflie-firmware-26d661941c7e\drivers\
     目录           0  2016-11-07 14:39  固件源码\bitcraze-crazyflie-firmware-26d661941c7e\drivers\interface\
     文件        3097  2013-03-03 20:06  固件源码\bitcraze-crazyflie-firmware-26d661941c7e\drivers\interface\adc.h
     文件        1171  2013-03-03 20:06  固件源码\bitcraze-crazyflie-firmware-26d661941c7e\drivers\interface\exti.h
     文件        4621  2013-03-03 20:06  固件源码\bitcraze-crazyflie-firmware-26d661941c7e\drivers\interface\hmc5883l.h
     文件        5953  2013-03-03 20:06  固件源码\bitcraze-crazyflie-firmware-26d661941c7e\drivers\interface\i2cdev.h
     文件        4965  2013-03-03 20:06  固件源码\bitcraze-crazyflie-firmware-26d661941c7e\drivers\interface\i2croutines.h
     文件        1740  2013-03-03 20:06  固件源码\bitcraze-crazyflie-firmware-26d661941c7e\drivers\interface\led.h
     文件        2488  2013-03-03 20:06  固件源码\bitcraze-crazyflie-firmware-26d661941c7e\drivers\interface\motors.h
     文件       46869  2013-03-03 20:06  固件源码\bitcraze-crazyflie-firmware-26d661941c7e\drivers\interface\mpu6050.h
     文件        2466  2013-03-03 20:06  固件源码\bitcraze-crazyflie-firmware-26d661941c7e\drivers\interface\ms5611.h
     文件        1968  2013-03-03 20:06  固件源码\bitcraze-crazyflie-firmware-26d661941c7e\drivers\interface\nRF24L01reg.h
     文件        2251  2013-03-03 20:06  固件源码\bitcraze-crazyflie-firmware-26d661941c7e\drivers\interface\nrf24l01.h
     文件        1142  2013-03-03 20:06  固件源码\bitcraze-crazyflie-firmware-26d661941c7e\drivers\interface\nvic.h
     文件        3002  2013-03-03 20:06  固件源码\bitcraze-crazyflie-firmware-26d661941c7e\drivers\interface\uart.h
     目录           0  2016-11-07 14:39  固件源码\bitcraze-crazyflie-firmware-26d661941c7e\drivers\src\
     文件        8651  2013-03-03 20:06  固件源码\bitcraze-crazyflie-firmware-26d661941c7e\drivers\src\adc.c
............此处省略206个文件信息

评论

共有 条评论