1
0
mirror of https://bitbucket.org/librepilot/librepilot.git synced 2025-01-18 03:52:11 +01:00

OP-14 I2C: Don't log a NAK as an error and also after NAKs seem to get an event

from the stop bit

git-svn-id: svn://svn.openpilot.org/OpenPilot/trunk@2466 ebee16cc-31ac-478f-84a7-5cbb03baadba
This commit is contained in:
peabody124 2011-01-17 02:11:02 +00:00 committed by peabody124
parent 31919241b8
commit 0d567f4e4b

View File

@ -935,7 +935,9 @@ void PIOS_I2C_EV_IRQ_Handler(uint8_t i2c)
i2c_evirq_history_pointer = (i2c_evirq_history_pointer + 1) % I2C_LOG_DEPTH;
#endif
event &= 0x000700FF;
#define EVENT_MASK 0x000700FF
event &= EVENT_MASK;
switch (event) { /* Mask out all the bits we don't care about */
case (I2C_EVENT_MASTER_MODE_SELECT | 0x40):
@ -1024,8 +1026,7 @@ void PIOS_I2C_EV_IRQ_Handler(uint8_t i2c)
break;
case 0x30084: /* Occurs between byte tranmistted and master mode selected */
case 0x30000: /* Need to throw away this spurious event */
case 0x30403: /* Detected this after got a NACK and then reprocessed by main handler */
//case 0x0: /* Not sure why zeros are occurring */
case 0x30403 & EVENT_MASK: /* Detected this after got a NACK, probably stop bit */
goto skip_event;
break;
default:
@ -1086,9 +1087,7 @@ void PIOS_I2C_ER_IRQ_Handler(uint8_t i2c)
/* Fail hard on any errors for now */
i2c_adapter_inject_event(i2c_adapter, I2C_EVENT_BUS_ERROR);
}
i2c_adapter_log_fault(PIOS_I2C_ERROR_INTERRUPT);
}
}
/**