1
0
mirror of https://bitbucket.org/librepilot/librepilot.git synced 2025-02-18 08:54:15 +01:00

Unfortunately for now hardcoding new LED configuration. Need to generalize LED

out to a proper run-time configuration.  This unfortunately breaks a general
firmware for now.
This commit is contained in:
James Cotton 2012-01-20 15:45:22 -06:00
parent 8935614a3f
commit 476cb4d9c2
3 changed files with 30 additions and 11 deletions

View File

@ -75,6 +75,17 @@ int main() {
if (BSL_HOLD_STATE == 0)
USB_connected = TRUE;
const struct pios_board_info * bdinfo = &pios_board_info_blob;
switch(bdinfo->board_rev) {
case 0x01:
// Original LED, no problem
break;
case 0x02:
GPIO_PinRemapConfig(GPIO_Remap_SWJ_JTAGDisable, ENABLE);
break;
}
PIOS_IAP_Init();
if (PIOS_IAP_CheckRequest() == TRUE) {

View File

@ -1675,21 +1675,28 @@ void PIOS_Board_Init(void) {
const struct pios_board_info * bdinfo = &pios_board_info_blob;
switch(bdinfo->board_rev == 0x01) {
switch(bdinfo->board_rev) {
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
GPIO_PinRemapConfig(GPIO_Remap_SWJ_JTAGDisable, ENABLE);
/* Set up the SPI interface to the serial flash */
if (PIOS_SPI_Init(&pios_spi_gyro_id, &pios_spi_gyro_cfg)) {
PIOS_Assert(0);
if(0) {
PIOS_ADC_Init();
} 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_L3GD20_Attach(pios_spi_gyro_id);
PIOS_L3GD20_Init(&pios_l3gd20_cfg);
break;
default:
PIOS_Assert(0);
@ -1697,6 +1704,7 @@ void PIOS_Board_Init(void) {
PIOS_GPIO_Init();
/* 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);
}

View File

@ -83,9 +83,9 @@ TIM4 | RC In 1 | Servo 3 | Servo 2 | Servo 1
//------------------------
// PIOS_LED
//------------------------
#define PIOS_LED_LED1_GPIO_PORT GPIOA
#define PIOS_LED_LED1_GPIO_PIN GPIO_Pin_6
#define PIOS_LED_LED1_GPIO_CLK RCC_APB2Periph_GPIOA
#define PIOS_LED_LED1_GPIO_PORT GPIOB
#define PIOS_LED_LED1_GPIO_PIN GPIO_Pin_3
#define PIOS_LED_LED1_GPIO_CLK RCC_APB2Periph_GPIOB
#define PIOS_LED_NUM 1
#define PIOS_LED_PORTS { PIOS_LED_LED1_GPIO_PORT }
#define PIOS_LED_PINS { PIOS_LED_LED1_GPIO_PIN }