program for conv1, universal converter before including conv2 code
Fork of _8_CONV_1_SLAVE by
Diff: main.cpp
- Revision:
- 10:7eaae60dc9e4
- Parent:
- 9:58c110e686f0
- Child:
- 11:3f1020fcd090
--- a/main.cpp Fri Dec 25 21:33:52 2015 +0000 +++ b/main.cpp Sat Jan 02 14:10:13 2016 +0000 @@ -15,11 +15,10 @@ void onUartChar() { char first_char = device.getc(); - if (first_char == SET_CONV2_FUNCT){ + if (first_char == SET_CONV2_FUNCT) { char slave_address = device.getc(); // not used at all, may be delete latar init_conv2(I2C_FREQUENCY_STANDARD); - } - else if (first_char == DATA_TO_WRITE_CHAR) { + } else if (first_char == DATA_TO_WRITE_CHAR) { char received = device.getc(); if (received & 0x01 == 0x01) { // reading from slave char rec; @@ -27,7 +26,7 @@ i2c.start(); transmission = 1; } - if (i2c.write((int)rec)) { + if (i2c.write((int)rec)) { // TODO: check if here should be received instead of rec while (device.getc() == DATA_TO_READ_CHAR) { rec = (char)i2c.read(1); device.putc(UART_CHAR_INCOMING);