I try to use CMSIS-RTOS virtual timer to periodically call a function that send "hello world!" to PC by using serial port. I can correct pass a word to the function, but failed to pass a pointer! I have no idea what's the problem. Maybe the limitation of CMSIS-RTOS?
"H" is sent back to PC by the comment out parts of code, which is what I wanted. However, now in this code, I try to pass the pointer of the array to the callback function, a "P" is sent back to PC. Why?? Is my code wrong??
void callback(void const *param);
osTimerDef(timer_handle, callback);
void callback(void const *param){
uint8_t *t=(uint8_t *)param;
SER_Send(t, 1);
}
//void callback(void const *param){
// uint8_t t = (uint8_t)param;
// SER_Send(&t, 1);
//}
int main (void) {
uint8_t text[]="Hello world!";
osTimerId timer = osTimerCreate(osTimer(timer_handle), osTimerPeriodic, (void *)text);
// osTimerId timer = osTimerCreate(osTimer(timer_handle), osTimerPeriodic, (void *)text[0]);
SystemCoreClockUpdate();
osKernelInitialize (); // initialize CMSIS-RTOS
SER_Config(UART0);
SER_Init(9600);
osTimerStart(timer, 500);
osKernelStart (); // start thread execution
}