X-CUBE-SUBG2 is an expansion software package for STM32Cube. The software runs on the STM32 and includes drivers that recognize the Sub-1 GHz RF communication for S2-LP.
Modified the signiature of the S2LP_RcoCalibration method to return
int32_t instead of void, at s2lp.h and s2lp.c.
Changed the do-while loop which waits for the RCCAL_OK bit to be set,
so the loop body now checks the value of the ERROR_LOCK bit,
and returns an error code if the bit is set.
Accordingly, modified the function to return S2LP_OK when it is done
and no error was detected.
In addition, to clean up the code, I changed the way of querying the
MC_STATE register:
Instead of using S2LP_ReadRegister to directly read the MC_STATE1
register, I used the S2LP_RefreshStatus to read the update into
the global state variable g_xStatus, and then used it to get the value
of ERROR_LOCK and RCCAL_OK bits.
I believe this change makes the code cleaner.
thank you very much for you detailed investigation!
We'll check your proposed fix (that seems actually ok at a first glance) with the driver team and provide a reply asap.
Modified the signiature of the
S2LP_RcoCalibration
method to returnint32_t
instead ofvoid
, ats2lp.h
ands2lp.c
.Changed the do-while loop which waits for the
RCCAL_OK
bit to be set, so the loop body now checks the value of theERROR_LOCK
bit, and returns an error code if the bit is set. Accordingly, modified the function to returnS2LP_OK
when it is done and no error was detected.In addition, to clean up the code, I changed the way of querying the MC_STATE register: Instead of using
S2LP_ReadRegister
to directly read theMC_STATE1
register, I used theS2LP_RefreshStatus
to read the update into the global state variableg_xStatus
, and then used it to get the value ofERROR_LOCK
andRCCAL_OK
bits. I believe this change makes the code cleaner.At last, I fixed formatting in the function:
while
loopdo-while
block=
signFixes: https://github.com/STMicroelectronics/x-cube-subg2/issues/1