//
// Created by dell on 25-1-7.
//

#include "gd60914.h"

void gd60914_get_object_tempture(void) {
    #ifdef SOFTWARE_IIC
    soft_i2c_config();
    #else
    i2c_config();
    #endif

    uint8_t data[2] = {0};

#ifdef SOFTWARE_IIC
    soft_i2c_read_16bits(GD60914_ADDR, GD60914_OBJ_TEMP, data);
#else
    i2c_read_16bits(GD60914_ADDR, GD60914_OBJ_TEMP, data);
#endif

    delay_ms(300);

#ifdef SOFTWARE_IIC
    soft_i2c_read_16bits(GD60914_ADDR, GD60914_TEMP_REG, data);
#else
    i2c_read_16bits(GD60914_ADDR, GD60914_TEMP_REG, data);
#endif

    printf("%d\r\n", data[1] << 8 | data[0]);
}

void gd60914_read_temp(void) {

    uint8_t value[2] = {0};
    #ifdef SOFTWARE_IIC
    soft_i2c_read_16bits(GD60914_ADDR, GD60914_OBJ_TEMP, value);
    #else
    i2c_read_16bits(GD60914_ADDR, GD60914_TEMP_REG, value);
    #endif

    printf("%x %x\r\n", value[1], value[0]);
}