program for conv1
main.h@4:9e2adff677ac, 2015-12-16 (annotated)
- Committer:
- marcus255
- Date:
- Wed Dec 16 19:42:44 2015 +0000
- Revision:
- 4:9e2adff677ac
- Parent:
- 1:455088a984b0
Reading/Writting EEPROM works fine, Reading/Writting works fine when temperature sensor connected to the i2c bus. Device addresses must be hardcoded for now.
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
marcus255 | 0:ab0f6f4ef7ac | 1 | #ifndef MAIN_H |
marcus255 | 0:ab0f6f4ef7ac | 2 | #define MAIN_H |
marcus255 | 0:ab0f6f4ef7ac | 3 | |
marcus255 | 0:ab0f6f4ef7ac | 4 | #include <mbed.h> |
marcus255 | 0:ab0f6f4ef7ac | 5 | #define SLAVE_ADDR 0xA0 |
marcus255 | 4:9e2adff677ac | 6 | #define RTC_ADDR 0xD0 |
marcus255 | 0:ab0f6f4ef7ac | 7 | #define RECBUFSIZE 64 |
marcus255 | 0:ab0f6f4ef7ac | 8 | #define UART_CONFIRMATION_CHAR 0x33 |
marcus255 | 0:ab0f6f4ef7ac | 9 | #define DATA_TO_WRITE_CHAR 0xCC |
marcus255 | 0:ab0f6f4ef7ac | 10 | #define DATA_TO_READ_CHAR 0x99 |
marcus255 | 0:ab0f6f4ef7ac | 11 | #define UART_NON_CONFIRMATION_CHAR 0xAA |
marcus255 | 0:ab0f6f4ef7ac | 12 | #define END_OF_TRANSMISSION 0x66 |
marcus255 | 0:ab0f6f4ef7ac | 13 | #define UART_CHAR_INCOMING 0x44 |
marcus255 | 0:ab0f6f4ef7ac | 14 | |
marcus255 | 0:ab0f6f4ef7ac | 15 | I2CSlave slave(PTB4, PTB3); |
marcus255 | 0:ab0f6f4ef7ac | 16 | Serial device(USBTX, USBRX); |
marcus255 | 0:ab0f6f4ef7ac | 17 | InterruptIn SDA_interrupt(PTB7); |
marcus255 | 0:ab0f6f4ef7ac | 18 | DigitalIn SDA_state(PTB6); |
marcus255 | 0:ab0f6f4ef7ac | 19 | |
marcus255 | 1:455088a984b0 | 20 | //char msg[] = "qwertyuiopasdfghjklzxcvbnmqwertyuiopasdfghjklzxcvbnm"; |
marcus255 | 0:ab0f6f4ef7ac | 21 | char buffer; |
marcus255 | 0:ab0f6f4ef7ac | 22 | int count; |
marcus255 | 0:ab0f6f4ef7ac | 23 | |
marcus255 | 0:ab0f6f4ef7ac | 24 | void i2cStart(void); |
marcus255 | 0:ab0f6f4ef7ac | 25 | void init(void); |
marcus255 | 0:ab0f6f4ef7ac | 26 | |
marcus255 | 0:ab0f6f4ef7ac | 27 | #endif |