2018-04-09 08:29 AM
As a detailed look into
STSW-STM8069 / STM8S_StdPeriph_Lib v2.2.0 :
, the Utilities/STM8S_EVAL/Common/stm8s_eval_i2c_ee.c file is quite confusing.I can see there is a SAFE procedure implemented.
in line230* Read data from first byte until byte N-3 */
if ((uint16_t)(*NumByteToRead)> 3)
I believe it should be a 'while' instead of 'if'. 'if' case only got one byte read. and there is no outer 'while' to repeat this case.
in line 295
/* Reset the number of bytes to be read from the EEPROM */
NumByteToRead = 0;In this function,
NumByteToRead is a uint16_t pointer. setting the pointer to 0 / null, is it what the lib mean? Maybe doing it will also make (uint16_t)(*NumByteToRead) == 0.
Somehow I just do not know why a safe
procedureis recommended.#i2c #stm8s #standard-peripheral-library2018-04-10 03:22 AM
the comment in the code associated with your first question should have given enough clue: that's typical for i2c read/write functions from/to a block;
the 2nd one is legit. unless they changed the use for that variable.
2018-04-10 11:51 AM