Programm to control a huge setup of sous vide cookers. See https://stratum0.org/wiki/S0us-vide for more information on this project.
Fork of rtos_basic by
main.cpp
- Committer:
- chrissidach
- Date:
- 2015-07-13
- Revision:
- 7:22b5cbcece06
- Parent:
- 3:c92e21f305d8
File content as of revision 7:22b5cbcece06:
#include "mbed.h" #include "rtos.h" #include "extensionIF.h" #include "serialParser.h" DigitalOut led1(LED1); SerialParser *pc; EIF *eif; I2C i2c(PB_9, PB_8); #define I2CslaveAddr 0x40 void i2c_1w(void const *args) { char data[10]; char data2[10]; int rc; data[0] = 0; i2c.frequency(100000); while(true) { printf("Write... "); rc = i2c.write(0x40, data, 1); printf("%i\r\n", rc); data[0] = ~data[0]; printf("Read... "); rc = i2c.read(0x40, data2, 1); printf("%i, %x\r\n", rc, data2[0]); Thread::wait(1000); } } int main() { printf("\r\n!****\r\n!System Init...\r\n"); eif = new EIF(); printf("!* EIF init complete\r\n"); //TODO: Remove //Lets pretend this extension is present: eif->mutex.lock(); eif->extensions[0].present = true; eif->extensions[0].pods[0].present = true; eif->extensions[0].pods[0].temp1 = 280; eif->extensions[0].pods[0].temp2 = 270; eif->mutex.unlock(); pc = new SerialParser(USBTX, USBRX, eif); printf("!* SerialParser init complete\r\n"); //Thread thread(i2c_1w); printf("!Init complete\r\n"); //Pretend we are still there... while (true) { led1 = !led1; Thread::wait(200); } }