library for AMS ENS210 temperature and humidity sensor
Dependents: rIoTwear-temp-humid
Diff: AMS_ENS210.cpp
- Revision:
- 9:e121ac861a82
- Parent:
- 8:1a7d241afbcb
--- a/AMS_ENS210.cpp Wed Mar 08 09:44:13 2017 +0000 +++ b/AMS_ENS210.cpp Tue Dec 03 18:48:39 2019 +0000 @@ -256,10 +256,12 @@ int write_count = 0; - char cmd[len+1]; + // char cmd[len+1]; works with mbed, but not with IAR/GCC + char *cmd = (char *) malloc( len + 1); cmd[0] = reg_addr; memcpy(cmd+1, input, len); write_count = _i2c.write(ENS210_SLAVE_ADDR, cmd, len+1) + 1; - + free(cmd); + return write_count; } \ No newline at end of file