2008-07-29 09:13 PM
about I2C Library question
2011-05-17 03:40 AM
hello
I have a question I2C Library(stm32f10x_i2c.c) void I2C_Init(I2C_TypeDef* I2Cx, I2C_InitTypeDef* I2C_InitStruct) { /* Configure speed in standard mode */ if (I2C_InitStruct->I2C_ClockSpeed <= 100000) { ...... /* Set Maximum Rise Time: ((1000/(1000000000/pclk1clock))+1 */ I2Cx->TRISE = freqrange + 1; } /* Configure speed in fast mode */ else /*(I2C_InitStruct->I2C_ClockSpeed <= 400000)*/ { /* Set Maximum Rise Time: ((300/(1000000000/pclk1clock))+1 */ I2Cx->TRISE = (u16)(((freqrange * 300) / 1000) + 1); } .... }//end func Plz, look commet. '' Set Maximum Rise Time: ((1000/(1000000000/pclk1clock))+1 '' --- <- How compute this number(1000ns)? ''Set Maximum Rise Time: ((300/(1000000000/pclk1clock))+1 '' --- <- How compute this number(300ns)? plz answer my question. p.s. : Have a good time~