The unified diff between revisions [a39fe798..] and [9142f333..] is displayed below. It can also be downloaded as a raw diff.

This diff has been restricted to the following files: 'i2c.c'

#
# old_revision [a39fe7980c8f14b70401f4c97f3e10232dce016a]
# new_revision [9142f3330490a5aa00c1686475633b620c2ef5e7]
#
# patch "i2c.c"
#  from [ebacb54424d6c1bd22ce75978f6c6756eecf488c]
#    to [2dff1acf82a051d155952429555a65a193ba0fd5]
#
============================================================
--- i2c.c	ebacb54424d6c1bd22ce75978f6c6756eecf488c
+++ i2c.c	2dff1acf82a051d155952429555a65a193ba0fd5
@@ -1,6 +1,7 @@
 
 #include "i2c.h"
 #include "interrupt.h"
+#include "event.h"
 
 #define I2CBASE  0xE001C000
 
@@ -32,8 +33,12 @@ void init_i2c(void)
 	IREG(I2CONSET) = 0x40; /* Enable I2C ready for Master Tx */
 	/* Set up for just under 400kHz */
 #ifdef I2C_FAST
+#if 0
 	IWREG(I2SCLL) = (25 * 100);
 	IWREG(I2SCLH) = (12 * 100);
+#endif
+	IWREG(I2SCLL) = 25 * 4; /* ~400kHz */
+	IWREG(I2SCLH) = 12 * 4;
 #else
 	IWREG(I2SCLL) = 73; /* ~100kHz */
 	IWREG(I2SCLH) = 73;
@@ -105,6 +110,7 @@ void __attribute__((interrupt("IRQ"))) i
 				IREG(I2CONSET) = STAFLAG;
 				IREG(I2CONCLR) = STOFLAG | AAFLAG | SIFLAG;
 			} else {
+				event_set(i2c_transaction->event);
 				i2c_transaction = NULL;
 				IREG(I2CONSET) = STOFLAG;
 				IREG(I2CONCLR) = STAFLAG | AAFLAG | SIFLAG;
@@ -135,6 +141,7 @@ void __attribute__((interrupt("IRQ"))) i
 			IREG(I2CONSET) = STAFLAG;
 			IREG(I2CONCLR) = STOFLAG | AAFLAG | SIFLAG;
 		} else {
+			event_set(i2c_transaction->event);
 			i2c_transaction = NULL;
 			IREG(I2CONSET) = STOFLAG;
 			IREG(I2CONCLR) = STAFLAG | AAFLAG | SIFLAG;
@@ -147,6 +154,7 @@ void __attribute__((interrupt("IRQ"))) i
 	case 0x38: /* arbitration lost during SA+W or data */
 	case 0x00: /* bus error */
 		*(i2c_transaction->result) = I2C_FAIL;
+		event_set(i2c_transaction->event);
 		i2c_transaction = NULL;
 		IREG(I2CONSET) = STOFLAG;
 		IREG(I2CONCLR) = STAFLAG | AAFLAG | SIFLAG;