mirror of https://github.com/rusefi/ChibiOS.git
I2C. Additional locks added to avoiding system hangups. Some mistypes in comments fixed.
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/branches/i2c_dev@2865 35acf78f-673a-0410-8e92-d51de3d6d3f4
This commit is contained in:
parent
573b5e875b
commit
57fb5e703b
|
@ -215,7 +215,7 @@ static void i2c_serve_event_interrupt(I2CDriver *i2cp) {
|
|||
|
||||
if (i2cp->id_slave_config->id_callback != NULL)
|
||||
i2cp->id_slave_config->id_callback(i2cp, i2cp->id_slave_config);
|
||||
else /* No callback function set - generate stop */
|
||||
else /* No callback function set. Generate stop */
|
||||
i2c_lld_master_stop(i2cp);
|
||||
|
||||
return;
|
||||
|
@ -497,7 +497,7 @@ void i2c_lld_master_start(I2CDriver *i2cp){
|
|||
while (i2cp->id_i2c->CR1 & I2C_CR1_START);
|
||||
|
||||
/* enable interrupts from I2C hardware. They will disable in driver state
|
||||
machine after the tranafer finish.*/
|
||||
machine after the transfer finish.*/
|
||||
i2cp->id_i2c->CR2 |= I2C_CR2_ITEVTEN | I2C_CR2_ITBUFEN;
|
||||
}
|
||||
|
||||
|
|
|
@ -138,7 +138,9 @@ void i2cMasterStart(I2CDriver *i2cp){
|
|||
|
||||
chDbgCheck((i2cp != NULL), "i2cMasterTransmit");
|
||||
|
||||
chSysLock();
|
||||
i2c_lld_master_start(i2cp);
|
||||
chSysUnlock();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -149,8 +151,9 @@ void i2cMasterStart(I2CDriver *i2cp){
|
|||
void i2cMasterStop(I2CDriver *i2cp){
|
||||
|
||||
chDbgCheck((i2cp != NULL), "i2cMasterTransmit");
|
||||
|
||||
chSysLock();
|
||||
i2c_lld_master_stop(i2cp);
|
||||
chSysUnlock();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -168,7 +171,9 @@ void i2cMasterTransmit(I2CDriver *i2cp, I2CSlaveConfig *i2cscfg) {
|
|||
"i2cMasterTransmit(), #1",
|
||||
"not active");
|
||||
|
||||
chSysLock();
|
||||
i2c_lld_master_transmit(i2cp, i2cscfg);
|
||||
chSysUnlock();
|
||||
}
|
||||
|
||||
|
||||
|
@ -186,7 +191,9 @@ void i2cMasterReceive(I2CDriver *i2cp, I2CSlaveConfig *i2cscfg) {
|
|||
"i2cMasterReceive(), #1",
|
||||
"not active");
|
||||
|
||||
chSysLock();
|
||||
i2c_lld_master_receive(i2cp, i2cscfg);
|
||||
chSysUnlock();
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -36,7 +36,7 @@ static msg_t PollTmp75Thread(void *arg) {
|
|||
systime_t time = chTimeNow();
|
||||
|
||||
while (TRUE) {
|
||||
time += MS2ST(1000);
|
||||
time += MS2ST(1001);
|
||||
/* Call reading function */
|
||||
request_temperature();
|
||||
chThdSleepUntil(time);
|
||||
|
|
Loading…
Reference in New Issue