#include "mma8653.h" #include #define AXL_ADDR 0x1D #define AXL_ERR_RET(e) if(1){err = e; goto err;} #define TRY(c) if(1){ret = c; if (ret) return c;} static int mma8653_i2c_transfer(int write, uint8_t reg, uint8_t *data, uint8_t length) { int err = 0; // WRITE TARGET REGISTER // Send start TWCR = (1<x = buffer[1]; measurements->y = buffer[2]; measurements->z = buffer[3]; /* led[0].r = buffer[1] > 0; led[1].r = buffer[2] > 0; led[2].r = buffer[3] > 0; led[5].r = !!(buffer[0] & 1); // 0 led[5].g = !!(buffer[0] & 2); // 1 led[5].b = !!(buffer[0] & 4); // 2 led[4].r = !!(buffer[0] & 8); // 3 led[4].g = !!(buffer[0] & 16); // 4 led[4].b = !!(buffer[0] & 32); // 5 led[3].r = !!(buffer[0] & 64); // 6 led[3].g = !!(buffer[0] & 128); // 7 */ return 0; }