1
0
mirror of https://bitbucket.org/librepilot/librepilot.git synced 2025-02-20 10:54:14 +01:00

Change the bus speed for the L3GD20 to 10MHz and some small cleanups

This commit is contained in:
James Cotton 2012-01-24 19:17:49 -06:00
parent 3ab40b713e
commit a25d52785b
6 changed files with 10 additions and 27 deletions

View File

@ -371,6 +371,7 @@ static int32_t updateSensorsCC3D(AccelsData * accelsData, GyrosData * gyrosData)
float accel_scaling = 1;
#if defined(PIOS_INCLUDE_BMA180)
struct pios_bma180_data accel;
accel_samples = 0;
bool error = false;
int32_t accel_read_good;
@ -398,6 +399,7 @@ static int32_t updateSensorsCC3D(AccelsData * accelsData, GyrosData * gyrosData)
#endif
#if defined(PIOS_INCLUDE_L3GD20)
struct pios_l3gd20_data gyro;
int32_t gyro_read_good;
gyro_samples = 0;
bool gyro_error = false;

View File

@ -254,20 +254,11 @@ extern uint32_t pios_com_telem_usb_id;
//-------------------------
// GPIO
//-------------------------
#define PIOS_GPIO_1_PORT GPIOA
#define PIOS_GPIO_1_PIN GPIO_Pin_7
#define PIOS_GPIO_1_GPIO_CLK RCC_APB2Periph_GPIOA
#define PIOS_GPIO_PORTS { }
#define PIOS_GPIO_PINS { }
#define PIOS_GPIO_CLKS { }
#define PIOS_GPIO_NUM 0
#define PIOS_GPIO_PORTS { PIOS_GPIO_1_PORT }
#define PIOS_GPIO_PINS { PIOS_GPIO_1_PIN }
#define PIOS_GPIO_CLKS { PIOS_GPIO_1_GPIO_CLK }
#define PIOS_GPIO_NUM 1
#define PIOS_FLASH_CS_PIN 0
#define PIOS_FLASH_ENABLE PIOS_GPIO_On(0)
#define PIOS_FLASH_DISABLE PIOS_GPIO_Off(0)
#define PIOS_ADXL_ENABLE PIOS_SPI_RC_PinSet(PIOS_SPI_ACCEL,0)
#define PIOS_ADXL_DISABLE PIOS_SPI_RC_PinSet(PIOS_SPI_ACCEL,1)
//-------------------------
// USB

View File

@ -118,21 +118,8 @@ int32_t PIOS_L3GD20_Init(uint32_t spi_id, uint32_t slave_num, const struct pios_
dev->cfg = cfg;
/* Configure the MPU6050 Sensor */
PIOS_SPI_SetClockSpeed(dev->spi_id, SPI_BaudRatePrescaler_256);
PIOS_L3GD20_Config(cfg);
/* This should either use a real speed (constant across boards) or pull from */
/* the default configuration */
const struct pios_board_info * bdinfo = &pios_board_info_blob;
switch(bdinfo->board_type) {
case 0x04: /* CopterControl */
PIOS_SPI_SetClockSpeed(dev->spi_id, SPI_BaudRatePrescaler_8);
break;
default:
PIOS_SPI_SetClockSpeed(dev->spi_id, SPI_BaudRatePrescaler_16);
break;
}
/* Set up EXTI */
PIOS_EXTI_Init(cfg->exti_cfg);

View File

@ -64,6 +64,7 @@
/* Ctrl1 flags */
#define PIOS_L3GD20_CTRL1_FASTEST 0xF0
#define PIOS_L3GD20_CTRL1_380HZ_100HZ 0xB0
#define PIOS_L3GD20_CTRL1_PD 0x08
#define PIOS_L3GD20_CTRL1_ZEN 0x04
#define PIOS_L3GD20_CTRL1_YEN 0x02

View File

@ -82,6 +82,7 @@
6543A04714CF1823004EEC4C /* board_hw_defs.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = board_hw_defs.c; sourceTree = "<group>"; };
6543A04914CF1823004EEC4C /* board_hw_defs.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = board_hw_defs.c; sourceTree = "<group>"; };
6543A04B14CF1823004EEC4C /* board_hw_defs.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = board_hw_defs.c; sourceTree = "<group>"; };
6543A04C14CF717E004EEC4C /* pios_usb.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = pios_usb.c; sourceTree = "<group>"; };
6549E0D21279B3C800C5476F /* fifo_buffer.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = fifo_buffer.c; sourceTree = "<group>"; };
6549E0D31279B3CF00C5476F /* fifo_buffer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = fifo_buffer.h; sourceTree = "<group>"; };
655268BC121FBD2900410C6E /* ahrscalibration.xml */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xml; path = ahrscalibration.xml; sourceTree = "<group>"; };
@ -8580,6 +8581,7 @@
65E8F0E911EFF25C00BBF654 /* pios_sys.c */,
65643CB91413456D00A32F59 /* pios_tim.c */,
65E8F0EA11EFF25C00BBF654 /* pios_usart.c */,
6543A04C14CF717E004EEC4C /* pios_usb.c */,
65E8F0ED11EFF25C00BBF654 /* pios_usb_hid.c */,
651CF9E6120B5D8300EEFD70 /* pios_usb_hid_istr.c */,
651CF9E8120B5D8300EEFD70 /* pios_usb_hid_pwr.c */,

View File

@ -88,7 +88,7 @@ static const struct pios_spi_cfg pios_spi_gyro_cfg = {
.SPI_CRCPolynomial = 7,
.SPI_CPOL = SPI_CPOL_High,
.SPI_CPHA = SPI_CPHA_2Edge,
.SPI_BaudRatePrescaler = SPI_BaudRatePrescaler_256, /* 10 Mhz */
.SPI_BaudRatePrescaler = SPI_BaudRatePrescaler_8, /* 10 Mhz */
},
.use_crc = false,
.dma = {