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

Switch the gyro driver loaded based on the board revision flag from the

bootloader
This commit is contained in:
James Cotton 2012-01-20 14:52:05 -06:00
parent 9fb23d6491
commit 8935614a3f
2 changed files with 26 additions and 1 deletions

View File

@ -1166,6 +1166,8 @@ static const struct pios_l3gd20_cfg pios_l3gd20_cfg = {
.gyro_range = PIOS_L3GD20_SCALE_500_DEG,
};
#include <pios_board_info.h>
/**
* PIOS_Board_Init()
* initializes all the core subsystems on this specific hardware
@ -1670,8 +1672,29 @@ void PIOS_Board_Init(void) {
#else
PIOS_DEBUG_Init(&pios_tim_servo_all_channels, NELEMENTS(pios_tim_servo_all_channels));
#endif /* PIOS_DEBUG_ENABLE_DEBUG_PINS */
const struct pios_board_info * bdinfo = &pios_board_info_blob;
switch(bdinfo->board_rev == 0x01) {
case 0x01:
// Revision 1 with invensense gyros, start the ADC
PIOS_ADC_Init();
break;
case 0x02:
// 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);
break;
default:
PIOS_Assert(0);
}
PIOS_ADC_Init();
PIOS_GPIO_Init();
/* Make sure we have at least one telemetry link configured or else fail initialization */

View File

@ -2935,6 +2935,7 @@
65EA2E171273C55200636061 /* ratedesired.xml */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xml; path = ratedesired.xml; sourceTree = "<group>"; };
65F5FB9914C9FAC500261DE0 /* pios_l3gd20.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = pios_l3gd20.h; sourceTree = "<group>"; };
65F5FB9A14C9FB2C00261DE0 /* pios_l3gd20.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = pios_l3gd20.c; sourceTree = "<group>"; };
65F5FBAB14CA08FD00261DE0 /* pios_board_info.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = pios_board_info.h; sourceTree = "<group>"; };
65F93C3912EE09280047DB36 /* aes.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = aes.c; sourceTree = "<group>"; };
65F93C3B12EE09280047DB36 /* aes.lst */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = aes.lst; sourceTree = "<group>"; };
65F93C3C12EE09280047DB36 /* aes.o */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.objfile"; path = aes.o; sourceTree = "<group>"; };
@ -7711,6 +7712,7 @@
65E8F03811EFF25C00BBF654 /* inc */ = {
isa = PBXGroup;
children = (
65F5FBAB14CA08FD00261DE0 /* pios_board_info.h */,
6528CCE212E40F6700CF5144 /* pios_adxl345.h */,
65E8C745139A6D1A00E1F979 /* pios_crc.h */,
65E8F03A11EFF25C00BBF654 /* pios_adc.h */,