Bug in PDL v2.1.0 | mfs.c | I2C | Mfs_I2c_ConfigAck

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
PaWa_3505426
Level 1
Level 1
First reply posted First question asked

Hi

So i found a bug in the PDL Library v2.1.0

The function Mfs.I2c_ConfigAck() doesn't work like it is in the library.

I had to change it like this to get it working:

/**

******************************************************************************

** \brief Configure ACK signal sent to master

**

** \param [in] pstcI2c    Pointer to I2C instance 

** \param [in] enAck      ACK to be sent

** \arg  I2cAck ACK will be sent as response signal

** \arg  I2cNAck NACK will be sent as response signal

**

** \retval Ok                    ACK signal has been successfully configured

** \retval ErrorInvalidParameter If one of following conditions are met:

**                               - pstcI2c == NULL         

**

** This function is only meaningful when I2C is in slave mode

**

******************************************************************************/

en_result_t Mfs_I2c_ConfigAck(volatile stc_mfsn_i2c_t* pstcI2c, en_i2c_ack_t enAck)

{

     if(pstcI2c == NULL)

          return ErrorInvalidParameter;

     if(I2cAck == enAck){

               *((volatile uint8_t *)(0x42000000UL + ((uint32_t)(pstcI2c - 0x40000000UL) * 32) + (13 * 4))) = 1; //ACKE set

          }else{

               *((volatile uint8_t *)(0x42000000UL + ((uint32_t)(pstcI2c - 0x40000000UL) * 32) + (13 * 4))) = 0; //ACKE clear

          }

     return Ok;

}

0 Likes
1 Solution
3 Replies