Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Fork of _8_CONV_1_SLAVE by
Diff: main.cpp
- Revision:
- 2:42a084b14fb2
- Parent:
- 1:455088a984b0
- Child:
- 3:45f63cbde7b3
--- a/main.cpp Sun Dec 06 21:24:27 2015 +0000
+++ b/main.cpp Mon Dec 07 21:45:29 2015 +0000
@@ -9,7 +9,7 @@
void i2cStart(void){
SDA_interrupt.disable_irq();
char addr = (char)slave.read();
- if (addr == (char)SLAVE_ADDR) {
+ if (addr == SLAVE_ADDR) {
count = 0;
char uart_rec;
device.putc(DATA_TO_WRITE_CHAR);
@@ -34,7 +34,7 @@
//slave.stop();
device.putc(END_OF_TRANSMISSION);
}
- else if (addr == (char)(SLAVE_ADDR | 0x01)){
+ else if (addr & 0x01 == 0x01){
char uart_rec2;
device.putc(DATA_TO_WRITE_CHAR);
device.putc(addr);
@@ -45,19 +45,15 @@
if (device.getc() == UART_CHAR_INCOMING){
uart_rec2 = device.getc();
break;
- }
-
+ }
}
}
if(!slave.write(uart_rec2)) {
device.putc(END_OF_TRANSMISSION);
break;
}
-
-
}
slave.read();
-
}
else {
//pc.printf("Unknown address: %x\n\r",addr);
