1
0
mirror of https://bitbucket.org/librepilot/librepilot.git synced 2025-01-29 14:52:12 +01:00

cc: use defines for board revisions instead of hard-coded numbers

This commit is contained in:
Stacey Sheldon 2012-05-23 00:29:12 -04:00
parent d2615cac96
commit 56dddee56c
2 changed files with 10 additions and 10 deletions

View File

@ -76,10 +76,10 @@ void PIOS_Board_Init(void) {
uint32_t pios_usb_id; uint32_t pios_usb_id;
switch(bdinfo->board_rev) { switch(bdinfo->board_rev) {
case 0x01: // Revision 1 case BOARD_REVISION_CC:
PIOS_USB_Init(&pios_usb_id, &pios_usb_main_cfg_cc); PIOS_USB_Init(&pios_usb_id, &pios_usb_main_cfg_cc);
break; break;
case 0x02: // Revision 2 case BOARD_REVISION_CC3D:
PIOS_USB_Init(&pios_usb_id, &pios_usb_main_cfg_cc3d); PIOS_USB_Init(&pios_usb_id, &pios_usb_main_cfg_cc3d);
break; break;
default: default:

View File

@ -165,12 +165,12 @@ void PIOS_Board_Init(void) {
/* Set up the SPI interface to the serial flash */ /* Set up the SPI interface to the serial flash */
switch(bdinfo->board_rev) { switch(bdinfo->board_rev) {
case 0x01: // Revision 1 case BOARD_REVISION_CC:
if (PIOS_SPI_Init(&pios_spi_flash_accel_id, &pios_spi_flash_accel_cfg_cc)) { if (PIOS_SPI_Init(&pios_spi_flash_accel_id, &pios_spi_flash_accel_cfg_cc)) {
PIOS_Assert(0); PIOS_Assert(0);
} }
break; break;
case 0x02: // Revision 2 case BOARD_REVISION_CC3D:
if (PIOS_SPI_Init(&pios_spi_flash_accel_id, &pios_spi_flash_accel_cfg_cc3d)) { if (PIOS_SPI_Init(&pios_spi_flash_accel_id, &pios_spi_flash_accel_cfg_cc3d)) {
PIOS_Assert(0); PIOS_Assert(0);
} }
@ -182,11 +182,11 @@ void PIOS_Board_Init(void) {
#endif #endif
switch(bdinfo->board_rev) { switch(bdinfo->board_rev) {
case 0x01: // Revision 1 case BOARD_REVISION_CC:
PIOS_Flash_Jedec_Init(pios_spi_flash_accel_id, 1, &flash_w25x_cfg); PIOS_Flash_Jedec_Init(pios_spi_flash_accel_id, 1, &flash_w25x_cfg);
PIOS_FLASHFS_Init(&flashfs_w25x_cfg); PIOS_FLASHFS_Init(&flashfs_w25x_cfg);
break; break;
case 0x02: // Revision 2 case BOARD_REVISION_CC3D:
PIOS_Flash_Jedec_Init(pios_spi_flash_accel_id, 0, &flash_m25p_cfg); PIOS_Flash_Jedec_Init(pios_spi_flash_accel_id, 0, &flash_m25p_cfg);
PIOS_FLASHFS_Init(&flashfs_m25p_cfg); PIOS_FLASHFS_Init(&flashfs_m25p_cfg);
break; break;
@ -259,10 +259,10 @@ void PIOS_Board_Init(void) {
uint32_t pios_usb_id; uint32_t pios_usb_id;
switch(bdinfo->board_rev) { switch(bdinfo->board_rev) {
case 0x01: // Revision 1 case BOARD_REVISION_CC:
PIOS_USB_Init(&pios_usb_id, &pios_usb_main_cfg_cc); PIOS_USB_Init(&pios_usb_id, &pios_usb_main_cfg_cc);
break; break;
case 0x02: // Revision 2 case BOARD_REVISION_CC3D:
PIOS_USB_Init(&pios_usb_id, &pios_usb_main_cfg_cc3d); PIOS_USB_Init(&pios_usb_id, &pios_usb_main_cfg_cc3d);
break; break;
default: default:
@ -682,7 +682,7 @@ void PIOS_Board_Init(void) {
#endif /* PIOS_DEBUG_ENABLE_DEBUG_PINS */ #endif /* PIOS_DEBUG_ENABLE_DEBUG_PINS */
switch(bdinfo->board_rev) { switch(bdinfo->board_rev) {
case 0x01: case BOARD_REVISION_CC:
// Revision 1 with invensense gyros, start the ADC // Revision 1 with invensense gyros, start the ADC
#if defined(PIOS_INCLUDE_ADC) #if defined(PIOS_INCLUDE_ADC)
PIOS_ADC_Init(&pios_adc_cfg); PIOS_ADC_Init(&pios_adc_cfg);
@ -691,7 +691,7 @@ void PIOS_Board_Init(void) {
PIOS_ADXL345_Init(pios_spi_flash_accel_id, 0); PIOS_ADXL345_Init(pios_spi_flash_accel_id, 0);
#endif #endif
break; break;
case 0x02: case BOARD_REVISION_CC3D:
// Revision 2 with L3GD20 gyros, start a SPI interface and connect to it // 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);