mirror of
https://bitbucket.org/librepilot/librepilot.git
synced 2025-02-20 10:54:14 +01:00
Fix small bugs in pios_board.c relating to adxl345 spi configuration
This commit is contained in:
parent
728c05f973
commit
946c6a7f1d
@ -121,6 +121,7 @@ static const struct pios_spi_cfg pios_spi_gyro_cfg = {
|
|||||||
.GPIO_Mode = GPIO_Mode_AF_PP,
|
.GPIO_Mode = GPIO_Mode_AF_PP,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
.slave_count = 1,
|
||||||
.ssel = {{
|
.ssel = {{
|
||||||
.gpio = GPIOA,
|
.gpio = GPIOA,
|
||||||
.init = {
|
.init = {
|
||||||
@ -227,10 +228,11 @@ static const struct pios_spi_cfg pios_spi_flash_accel_cfg = {
|
|||||||
.GPIO_Mode = GPIO_Mode_AF_PP,
|
.GPIO_Mode = GPIO_Mode_AF_PP,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
.slave_count = 2,
|
||||||
.ssel = {{
|
.ssel = {{
|
||||||
.gpio = GPIOA,
|
.gpio = GPIOB,
|
||||||
.init = {
|
.init = {
|
||||||
.GPIO_Pin = GPIO_Pin_4,
|
.GPIO_Pin = GPIO_Pin_12,
|
||||||
.GPIO_Speed = GPIO_Speed_50MHz,
|
.GPIO_Speed = GPIO_Speed_50MHz,
|
||||||
.GPIO_Mode = GPIO_Mode_Out_PP,
|
.GPIO_Mode = GPIO_Mode_Out_PP,
|
||||||
}},{
|
}},{
|
||||||
@ -1731,28 +1733,24 @@ void PIOS_Board_Init(void) {
|
|||||||
case 0x01:
|
case 0x01:
|
||||||
// Revision 1 with invensense gyros, start the ADC
|
// Revision 1 with invensense gyros, start the ADC
|
||||||
PIOS_ADC_Init();
|
PIOS_ADC_Init();
|
||||||
|
PIOS_ADXL345_Init(pios_spi_flash_accel_id, 0);
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case 0x02:
|
case 0x02:
|
||||||
|
// Revision 2 with L3GD20 gyros, start a SPI interface and connect to it
|
||||||
GPIO_PinRemapConfig(GPIO_Remap_SWJ_JTAGDisable, ENABLE);
|
GPIO_PinRemapConfig(GPIO_Remap_SWJ_JTAGDisable, ENABLE);
|
||||||
|
|
||||||
if(0) {
|
// Set up the SPI interface to the serial flash
|
||||||
PIOS_ADC_Init();
|
if (PIOS_SPI_Init(&pios_spi_gyro_id, &pios_spi_gyro_cfg)) {
|
||||||
PIOS_ADXL345_Init(pios_spi_flash_accel_id, 0);
|
PIOS_Assert(0);
|
||||||
} else
|
|
||||||
{
|
|
||||||
// Revision 2 with L3GD20 gyros, start a SPI interface and connect to it
|
|
||||||
|
|
||||||
// Set up the SPI interface to the serial flash
|
|
||||||
if (PIOS_SPI_Init(&pios_spi_gyro_id, &pios_spi_gyro_cfg)) {
|
|
||||||
PIOS_Assert(0);
|
|
||||||
}
|
|
||||||
|
|
||||||
PIOS_L3GD20_Attach(pios_spi_gyro_id);
|
|
||||||
PIOS_L3GD20_Init(&pios_l3gd20_cfg);
|
|
||||||
|
|
||||||
PIOS_BMA180_Attach(pios_spi_flash_accel_id);
|
|
||||||
PIOS_BMA180_Init(&pios_bma180_cfg);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
PIOS_L3GD20_Attach(pios_spi_gyro_id);
|
||||||
|
PIOS_L3GD20_Init(&pios_l3gd20_cfg);
|
||||||
|
|
||||||
|
PIOS_BMA180_Attach(pios_spi_flash_accel_id);
|
||||||
|
PIOS_BMA180_Init(&pios_bma180_cfg);
|
||||||
|
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
PIOS_Assert(0);
|
PIOS_Assert(0);
|
||||||
@ -1760,7 +1758,6 @@ void PIOS_Board_Init(void) {
|
|||||||
|
|
||||||
PIOS_GPIO_Init();
|
PIOS_GPIO_Init();
|
||||||
|
|
||||||
|
|
||||||
/* Make sure we have at least one telemetry link configured or else fail initialization */
|
/* Make sure we have at least one telemetry link configured or else fail initialization */
|
||||||
PIOS_Assert(pios_com_telem_rf_id || pios_com_telem_usb_id);
|
PIOS_Assert(pios_com_telem_rf_id || pios_com_telem_usb_id);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user