Offload I2C work onto interrupts. For now, we just spin while waiting

for the I2C activity to complete.
This commit is contained in:
2011-05-26 01:57:16 +00:00
parent 6a3c096bc5
commit 0f508fb424
5 changed files with 197 additions and 135 deletions

15
main.c
View File

@@ -160,6 +160,7 @@ void average_sample(void)
int main(void) {
int i;
init_interrupt();
init_uart();
init_i2c();
@@ -193,8 +194,6 @@ int main(void) {
reply("Help is not available. Try a psychiatrist.");
break;
case 'T':
putstr("I2C status was: ");
puthex(i2cstat);
putstr(" I2C status is: ");
puthex(i2c_statreg());
reply(".");
@@ -202,18 +201,6 @@ int main(void) {
puthex(i2c_conreg());
reply(".");
break;
case 'S':
putstr("Sending START... ");
if (i2c_send_start())
reply("OK");
else
reply("FAIL");
break;
case 'O':
putstr("Sending STOP... ");
i2c_send_stop();
reply("sent");
break;
case 'I':
putstr("Initialising WMP... ");
if (wmp_init())