|
|
@ -19,7 +19,7 @@ |
|
|
|
#define Y2_OUT (PJ2) |
|
|
|
#define Y2_IN (PJ3) |
|
|
|
|
|
|
|
#define PKT_LEN (64) |
|
|
|
#define PKT_LEN (48) |
|
|
|
#define PKT_NLEMS (128) /* must power of 2 */ |
|
|
|
|
|
|
|
#define RS422_PKT_HDR (0x61) |
|
|
@ -43,7 +43,7 @@ |
|
|
|
struct tag_fifo { |
|
|
|
char *pnew; /* points to newest fifo element */ |
|
|
|
char *pold; /* points to oldest fifo element */ |
|
|
|
short nelem; /* number of bytes currently in fifo */ |
|
|
|
short nelem;/* number of bytes currently in fifo */ |
|
|
|
short blen; |
|
|
|
char *bend; |
|
|
|
char *b; |
|
|
@ -412,16 +412,14 @@ static void __on_20ms(int ms) |
|
|
|
static int __on_40ms(struct timer *tm, void *user) |
|
|
|
{ |
|
|
|
to_send = (BIT0 | BIT1); |
|
|
|
// gpio_toggle(LED_D6);
|
|
|
|
#ifdef STM32F40_41xxx |
|
|
|
gpio_toggle(PC13); |
|
|
|
#endif |
|
|
|
return 0; |
|
|
|
} |
|
|
|
|
|
|
|
int main() |
|
|
|
{ |
|
|
|
NVIC_SetVectorTable(NVIC_VectTab_FLASH, (APP_ADDRESS - NVIC_VectTab_FLASH)); |
|
|
|
NVIC_PriorityGroupConfig(NVIC_PriorityGroup_4); |
|
|
|
__enable_irq(); |
|
|
|
|
|
|
|
/*
|
|
|
|
* recovery from bad image. |
|
|
|
*/ |
|
|
@ -435,7 +433,7 @@ int main() |
|
|
|
/* debug console */ |
|
|
|
serial_setup(&serial0, CONSOLE_BAUDRATE, 8, SERIAL_STOPBITS_1); |
|
|
|
|
|
|
|
printf("build: %s %s\r\n", __DATE__, __TIME__); |
|
|
|
printf("build: %s (%s)\r\n", __DATE__, __TIME__); |
|
|
|
|
|
|
|
/* RS422 */ |
|
|
|
serial_setup(RS422_0, RS422_BAUDRATE, 8, SERIAL_STOPBITS_1); |
|
|
@ -444,6 +442,10 @@ int main() |
|
|
|
/* eeprom */ |
|
|
|
eeprom_init(); |
|
|
|
|
|
|
|
#ifdef STM32F40_41xxx |
|
|
|
gpio_init(PC13, GPIO_OUTPUT); |
|
|
|
#endif |
|
|
|
|
|
|
|
#ifdef STM32F429_439xx |
|
|
|
gpio_init(Y1_OUT, GPIO_OUTPUT); |
|
|
|
gpio_init(Y1_IN, GPIO_INPUT); |
|
|
@ -462,12 +464,14 @@ int main() |
|
|
|
init_frames(&tx[1], NULL, 0); |
|
|
|
|
|
|
|
printf("setup vocode 0\r\n"); |
|
|
|
ticks_init(1); |
|
|
|
iwdg_reset(); |
|
|
|
a3k_setup(&a3k0, -1); |
|
|
|
|
|
|
|
printf("setup vocode 1\r\n"); |
|
|
|
iwdg_reset(); |
|
|
|
a3k_setup(&a3k1, -1); |
|
|
|
ticks_close(); |
|
|
|
|
|
|
|
ticks_set_callback(__on_20ms); |
|
|
|
ticks_init(20); |
|
|
|