AnsweredAssumed Answered

generate callback function

Question asked by Pilous Droip on Mar 10, 2018
Latest reply on Mar 10, 2018 by Pilous Droip

Hello friends.


I have uart. And I need generate callback function.


For example. I send from PC 0x01 and I need generate call back function "HelloWorld". Send 0x02 generate "SunShine".


So I receive char in interrupt:

void UART4_IRQHandler(void)

   if (LL_USART_IsActiveFlag_RTO(UART4))


      /* here clear flags, .........*/




/* here is my definitions */

#define    FIRST_CALL         0x01

#define    SECOND_CALL    0x02


function generate call back:

void UART_generate_call_back(uint8_t *input_buffer)
   if(input_buffer[0] == 0x01)
   if(input_buffer[0] == 0x02)



and my function to generate callback:

void UART_callback(uint32_t InterruptID, InterruptHandler Handler)
   UART_HandlerTable = Handler;



other function and declaration:

typedef void (*InterruptHandler) (uint32_t uart_interrupt);
InterruptHandler UART_HandlerTable;


And in my main:

void HelloWorld();

void SunShine();


int main(void)
   /* init system clock */
   /* Init UART5 and DMA1 */
   /* Init LED */


   UART_callback( FIRST_CALL, (InterruptHandler)HelloWorld);

   UART_callback( SECOND_CALL, (InterruptHandler)SunShine);


   while (1)


      if(time == 500)
         LL_GPIO_TogglePin(MCU_LED_PORT, MCU_LED_PIN);
         time = 0;


void HelloWorld()
   usart_puts("Hello world\r\n");


void SunShine()





And when I send 0x01 by UART callback function isn't working.


Any idea, what is wrong?