fix i2c read + fix ds3231 temp + fix ssd1306 send

This commit is contained in:
Zaltora 2017-01-30 10:10:52 +01:00
parent f135752523
commit c5b480995d
3 changed files with 3 additions and 2 deletions

View file

@ -216,7 +216,7 @@ bool ds3231_getRawTemp(int16_t *temp)
uint8_t data[2]; uint8_t data[2];
data[0] = DS3231_ADDR_TEMP; data[0] = DS3231_ADDR_TEMP;
if (!ds3231_send(DS3231_ADDR_TEMP,data, 2)) if (!ds3231_recv(DS3231_ADDR_TEMP,data, 2))
{ {
*temp = (int16_t)(int8_t)data[0] << 2 | data[1] >> 6; *temp = (int16_t)(int8_t)data[0] << 2 | data[1] >> 6;
return true; return true;

View file

@ -308,7 +308,7 @@ int i2c_slave_read(uint8_t slave_addr, uint8_t *data, uint8_t *buf, uint32_t len
buf++; buf++;
len--; len--;
} }
if (i2c_stop()) if (!i2c_stop())
goto error; goto error;
flag = false ; // Bus free flag = false ; // Bus free
return 0; return 0;

View file

@ -256,6 +256,7 @@ int ssd1306_load_frame_buffer(const ssd1306_t *dev, uint8_t buf[])
{ {
if(dev->screen == SH1106_SCREEN && i%dev->width == 0) sh1106_go_coordinate(dev,0,i/dev->width); if(dev->screen == SH1106_SCREEN && i%dev->width == 0) sh1106_go_coordinate(dev,0,i/dev->width);
i2c_send(dev, 0x40, buf ? &buf[i] : tab, 16); i2c_send(dev, 0x40, buf ? &buf[i] : tab, 16);
i+=15 ;
} }
break; break;
#endif #endif