Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #define BAUD_RATE (int)100e3 // the standard baud rate
- ...
- void initIR(){
- bcm2835_init();
- bcm2835_i2c_begin();
- bcm2835_i2c_set_baudrate((int)BAUD_RATE);
- bcm2835_i2c_setSlaveAddress(0x5a);
- }
- void writeConfig(){
- unsigned char comm = 0x25; // the command to send. access EEPROM
- unsigned char * write = (unsigned char *)malloc(sizeof(unsigned char) * 9);
- unsigned char * clear = (unsigned char *)malloc(sizeof(unsigned char) * 9);
- write[0] = 0x25; write[1] = 0x74; write[2] = 0xb4; write[3] = 0x70;
- clear[0] = 0x25; clear[1] = 0x00; clear[2] = 0x00; clear[3] = 0x83;
- /*bcm2835_i2c_begin();*/
- int c = bcm2835_i2c_write(clear, 3);
- waitMillis(100);
- int w = bcm2835_i2c_write(write, 3);
- waitMillis(100);
- printf("c: %d, w: %dn", c, w);
- free(clear);
- free(write);
- }
- | Return value | Message |
- |:------------:|:------------------------------:|
- | 0 | Message received OK |
- | 1 | Received NACK |
- | 2 | Received clock stretch timeout |
- | 3 | Not all data sent/received |
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement