Skip to content

STM32 - HAL_I2C_ErrorCallback - error 'handle' undeclared #14696

@ladislas

Description

@ladislas

Description of defect

Commit b5f864d introduced a bug for STM32 targets in HAL_I2C_ErrorCallback when DEVICE_I2CSLAVE is not defined.

../../extern/mbed-os/targets/TARGET_STM/i2c_api.c: In function 'HAL_I2C_ErrorCallback':
../../extern/mbed-os/targets/TARGET_STM/i2c_api.c:1082:10: error: 'handle' undeclared (first use in this function)
 1082 |     if ((handle->ErrorCode & HAL_I2C_ERROR_AF) == HAL_I2C_ERROR_AF) {
      |          ^~~~~~

I can provide a fix, but I don't know if the handle should be defined outside of the #if or if the if() should be moved in the #if

Target(s) affected by this defect ?

STM32

Toolchain(s) (name and version) displaying this defect ?

gcc version 10.2.1 20201103 (release) (GNU Arm Embedded Toolchain 10-2020-q4-major)

What version of Mbed-os are you using (tag or sha) ?

mbed-os-6.11.0

What version(s) of tools are you using. List all that apply (E.g. mbed-cli)

7.15.0

How is this defect reproduced ?

Compile code using I2C on STM32 targets, e.g. DISCO_F769

cc @jeromecoutant @affrinpinhero-2356

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions