I2C. Mutual exclusion support added. Need testing.
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/branches/i2c_dev@2847 35acf78f-673a-0410-8e92-d51de3d6d3f4
This commit is contained in:
parent
1ab46c6fb9
commit
7a694b4402
|
@ -69,6 +69,19 @@ void i2cObjectInit(I2CDriver *i2cp) {
|
||||||
i2cp->id_state = I2C_STOP;
|
i2cp->id_state = I2C_STOP;
|
||||||
i2cp->id_config = NULL;
|
i2cp->id_config = NULL;
|
||||||
i2cp->id_slave_config = NULL;
|
i2cp->id_slave_config = NULL;
|
||||||
|
|
||||||
|
#if I2C_USE_WAIT
|
||||||
|
i2cp->id_thread = NULL;
|
||||||
|
#endif /* I2C_USE_WAIT */
|
||||||
|
|
||||||
|
#if I2C_USE_MUTUAL_EXCLUSION
|
||||||
|
#if CH_USE_MUTEXES
|
||||||
|
chMtxInit(&i2cp->id_mutex);
|
||||||
|
#else
|
||||||
|
chSemInit(&i2cp->id_semaphore, 1);
|
||||||
|
#endif /* CH_USE_MUTEXES */
|
||||||
|
#endif /* I2C_USE_MUTUAL_EXCLUSION */
|
||||||
|
|
||||||
#if defined(I2C_DRIVER_EXT_INIT_HOOK)
|
#if defined(I2C_DRIVER_EXT_INIT_HOOK)
|
||||||
I2C_DRIVER_EXT_INIT_HOOK(i2cp);
|
I2C_DRIVER_EXT_INIT_HOOK(i2cp);
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in New Issue