cancel
Showing results for 
Search instead for 
Did you mean: 

Feature request: Pass arbitrary data pointer in HAL callbacks

tdecker2
Associate III

It is really sad that ST decided to not implement this requested and really helpful feature: https://github.com/STMicroelectronics/STM32CubeG4/issues/23

Maybe we can change their minds by creating some more attention to this topic here? Leave a comment, when you also find this useful ;)

Example solution for the I²C driver by adding a void* to the handle:

 

 

typedef struct __I2C_HandleTypeDef
{
/* Rest of struct... */
#if (USE_HAL_CALLBACK_CONTEXT == 1)
  void *UserContext;
#endif /* USE_HAL_CALLBACK_CONTEXT */
} I2C_HandleTypeDef;

 

 

 

10 REPLIES 10

 

.