This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

CCS/TM4C123GH6PM: A static function called inside MPU6050Callback

Part Number: TM4C123GH6PM

Tool/software: Code Composer Studio

Hello,

I want to use the MPU6050Init function in my main.c as follows:

MPU6050Init(&g_sMPU6050Inst, &g_sI2CInst, MPU6050_I2C_ADDRESS, MPU6050Callback, &g_sMPU6050Inst);

However, the MPU6050Callback function passed to MPU6050Init is declared as a static function inside MPU6050.c so I get a compilation error when I call call MPU6050Init.

I have 2 questions:

1. What was the motivation behind making "MPU6050Callback" static if it's required inside "MPU6050Init" ?

2. How would you solve this problem ?

  • I think the reason "MPU6050Callback" is static inside of mpu6050.c is that it is expected the user will want to write their own version with specific error handling. You can copy the function from mpu6050.c or start with the example on page 115 of the Sensor Library User's Guide.
    C:\ti\TivaWare_C_Series-2.1.4.178\docs\SW-TM4C-SENSORLIB-UG-2.1.4.178.pdf