jlaitine opened a new pull request, #8303:
URL: https://github.com/apache/nuttx/pull/8303

   …alue
   
   When sending small number of bytes with larger CONFIG_USEC_PER_TICK this 
function should return at least 1. Solve this by rounding up the result.
   
   Signed-off-by: Jukka Laitinen <[email protected]>
   
   ## Summary
   
   This function should always return at least 1. For example with values
   
   bytecount == 1
   CONFIG_USEC_PER_TICK == 10000 (default)
   CONFIG_STM32F7_I2C_DYNTIMEO_USECPERBYTE = 500
   
   Since USEC2TICK does rounding to nearest, the calculation in ticks would 
result in (((500 * 1) + (10000 / 2)) / 10000) == ( 5500 / 10000 ) == 0 
   
   Solve this by rounding it up (adding CONFIG_USEC_PER_TICK / 2 - 
CONFIG_STM32F7_I2C_DYNTIMEO_USECPERBYTE), which always results 1 tick at 1 byte 
regardless of the selected USEC_PER_TICK or STM32F7_I2C_DYNTIMEO_USECPERBYTE 
values.
   
   ## Impact
   
   Fixes the i2c on stm32f7 with default USEC_PER_TICK setting
   
   ## Testing
   
   Tested on stm32f7 based board
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to