Skip to content

Commit

Permalink
[chibios] Fixed telemetry test (via proper uart initialization)
Browse files Browse the repository at this point in the history
  • Loading branch information
podhrmic authored and flixr committed Feb 24, 2015
1 parent 5809846 commit 0259234
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 6 deletions.
5 changes: 5 additions & 0 deletions sw/airborne/arch/chibios/mcu_periph/uart_arch.c
Expand Up @@ -46,6 +46,7 @@ static const SerialConfig usart1_config = {
};
void uart1_init(void)
{
uart_periph_init(&uart1);
sdStart(&SD1, &usart1_config);
uart1.reg_addr = &SD1;
}
Expand All @@ -64,6 +65,7 @@ static const SerialConfig usart2_config = {
};
void uart2_init(void)
{
uart_periph_init(&uart2);
sdStart(&SD2, &usart2_config);
uart2.reg_addr = &SD2;
}
Expand All @@ -81,6 +83,7 @@ static const SerialConfig usart3_config = {
};
void uart3_init(void)
{
uart_periph_init(&uart3);
sdStart(&SD3, &usart3_config);
uart3.reg_addr = &SD3;
}
Expand All @@ -98,6 +101,7 @@ static const SerialConfig usart4_config = {
};
void uart4_init(void)
{
uart_periph_init(&uart4);
sdStart(&SD4, &usart4_config);
uart4.reg_addr = &SD4;
}
Expand All @@ -115,6 +119,7 @@ static const SerialConfig usart5_config = {
};
void uart5_init(void)
{
uart_periph_init(&uart5);
sdStart(&SD5, &usart5_config);
uart5.reg_addr = &SD5;
}
Expand Down
20 changes: 14 additions & 6 deletions sw/airborne/test/chibios_test_telemetry.c
Expand Up @@ -57,6 +57,18 @@ static msg_t ThdBlinker(void *arg) {
return 0;
}

static WORKING_AREA(waThdTx, 1024);
static msg_t ThdTx(void *arg) {

(void)arg;
chRegSetThreadName("sender");
while (TRUE) {
DOWNLINK_SEND_ALIVE(DefaultChannel, DefaultDevice, 16, MD5SUM);
chThdSleepMilliseconds(100);
}
return 0;
}


int main(void)
{
Expand All @@ -68,14 +80,10 @@ int main(void)
* Creates the blinker thread.
*/
chThdCreateStatic(waThdBlinker, sizeof(waThdBlinker), NORMALPRIO, ThdBlinker, NULL);
chThdCreateStatic(waThdTx, sizeof(waThdTx), NORMALPRIO, ThdTx, NULL);

while (TRUE) {
DOWNLINK_SEND_ALIVE(DefaultChannel, DefaultDevice, 16, MD5SUM);

#ifdef LED_GREEN
LED_TOGGLE(LED_GREEN);
#endif
chThdSleep(MS2ST(100));
chThdSleep(S2ST(1));
}

return 0;
Expand Down

0 comments on commit 0259234

Please sign in to comment.