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

Revo Mini 2: Get basic LED working. Board revision is actually 3 since right now it masquerades as Revo.

This commit is contained in:
James Cotton 2012-09-26 01:17:32 -05:00
parent 0fa4b062a4
commit dadc38d82d
4 changed files with 56 additions and 4 deletions

View File

@ -46,8 +46,12 @@ void PIOS_Board_Init() {
/* Delay system */
PIOS_DELAY_Init();
const struct pios_board_info * bdinfo = &pios_board_info_blob;
#if defined(PIOS_INCLUDE_LED)
PIOS_LED_Init(&pios_led_cfg);
const struct pios_led_cfg * led_cfg = PIOS_BOARD_HW_DEFS_GetLedCfg(bdinfo->board_rev);
PIOS_Assert(led_cfg);
PIOS_LED_Init(led_cfg);
#endif /* PIOS_INCLUDE_LED */
#if defined(PIOS_INCLUDE_USB)

View File

@ -296,7 +296,13 @@ void PIOS_Board_Init(void) {
/* Delay system */
PIOS_DELAY_Init();
PIOS_LED_Init(&pios_led_cfg);
const struct pios_board_info * bdinfo = &pios_board_info_blob;
#if defined(PIOS_INCLUDE_LED)
const struct pios_led_cfg * led_cfg = PIOS_BOARD_HW_DEFS_GetLedCfg(bdinfo->board_rev);
PIOS_Assert(led_cfg);
PIOS_LED_Init(led_cfg);
#endif /* PIOS_INCLUDE_LED */
/* Set up the SPI interface to the gyro/acelerometer */
if (PIOS_SPI_Init(&pios_spi_gyro_id, &pios_spi_gyro_cfg)) {

View File

@ -52,9 +52,51 @@ static const struct pios_led_cfg pios_led_cfg = {
.num_leds = NELEMENTS(pios_leds),
};
static const struct pios_led pios_leds_v2[] = {
[PIOS_LED_HEARTBEAT] = {
.pin = {
.gpio = GPIOB,
.init = {
.GPIO_Pin = GPIO_Pin_5,
.GPIO_Speed = GPIO_Speed_50MHz,
.GPIO_Mode = GPIO_Mode_OUT,
.GPIO_OType = GPIO_OType_PP,
.GPIO_PuPd = GPIO_PuPd_UP
},
},
},
[PIOS_LED_ALARM] = {
.pin = {
.gpio = GPIOB,
.init = {
.GPIO_Pin = GPIO_Pin_4,
.GPIO_Speed = GPIO_Speed_50MHz,
.GPIO_Mode = GPIO_Mode_OUT,
.GPIO_OType = GPIO_OType_PP,
.GPIO_PuPd = GPIO_PuPd_UP
},
},
},
};
static const struct pios_led_cfg pios_led_v2_cfg = {
.leds = pios_leds_v2,
.num_leds = NELEMENTS(pios_leds_v2),
};
const struct pios_led_cfg * PIOS_BOARD_HW_DEFS_GetLedCfg (uint32_t board_revision)
{
return &pios_led_cfg;
switch(board_revision) {
case 2:
return &pios_led_cfg;
break;
case 3:
return &pios_led_v2_cfg;
break;
default:
PIOS_DEBUG_Assert(0);
}
return NULL;
}
#endif /* PIOS_INCLUDE_LED */

View File

@ -1,5 +1,5 @@
BOARD_TYPE := 0x09
BOARD_REVISION := 0x02
BOARD_REVISION := 0x03
BOOTLOADER_VERSION := 0x01
HW_TYPE := 0x00