/* result: address where the result will be written returns: 0 on success -1 on fail;  */
int16_t getTemp(int32_t *result)
/* result: address where the result will be written returns: 0 on success -1 on fail;  */
int16_t getTemp(int32_t *result)
{
    uint8_t buffer[3] = { 0 };
    int16_t i = readBlock(DPS310__REG_ADR_TEMP, DPS310__REG_LEN_TEMP, buffer);
    if (i != DPS310__REG_LEN_TEMP) {
        return DPS310__FAIL_UNKNOWN;
    }
    int32_t temp = (uint32_t)buffer[0] << 16 | (uint32_t)buffer[1] << 8 |
                   (uint32_t)buffer[2];
    if (temp & ((uint32_t)1 << 23)) {
        temp -= (uint32_t)1 << 24;
    }
    *result = calcTemp(temp);
    return DPS310__SUCCEEDED;
}