i wanty to comunicate with a shield SiM900, i see the example UART of STM32F1xx
but i have this question:
1) in code i see this:
Code: Select all
static VirtualTimer vt1, vt2;
why you use this timer?
2) i see this for tx
Code: Select all
/*
* This callback is invoked when a transmission has physically completed.
*/
static void txend2(UARTDriver *uartp) {
(void)uartp;
palSetPad(IOPORT3, GPIOC_LED);
chSysLockFromIsr();
if (chVTIsArmedI(&vt1))
chVTResetI(&vt1);
chVTSetI(&vt1, MS2ST(5000), restart, NULL);
chSysUnlockFromIsr();
}
/*
* This callback is invoked when a character is received but the application
* was not ready to receive it, the character is passed as parameter.
*/
static void rxchar(UARTDriver *uartp, uint16_t c) {
(void)uartp;
(void)c;
/* Flashing the LED each time a character is received.*/
palClearPad(IOPORT3, GPIOC_LED);
chSysLockFromIsr();
if (chVTIsArmedI(&vt2))
chVTResetI(&vt2);
chVTSetI(&vt2, MS2ST(200), ledoff, NULL);
chSysUnlockFromIsr();
}
do you have a easy system for serial communication?
this example is a good for all serial communication?
best regards
Antonio