42#define CHIP_NAME "Panasonic AMG8833"
43#define MANUFACTURER_NAME "Panasonic"
44#define SUPPLY_VOLTAGE_MIN 3.0f
45#define SUPPLY_VOLTAGE_MAX 3.6f
46#define MAX_CURRENT 5.0f
47#define TEMPERATURE_MIN -20.0f
48#define TEMPERATURE_MAX 80.0f
49#define DRIVER_VERSION 1000
54#define AMG8833_REG_PCTL 0x00
55#define AMG8833_REG_RST 0x01
56#define AMG8833_REG_FPSC 0x02
57#define AMG8833_REG_INTC 0x03
58#define AMG8833_REG_STAT 0x04
59#define AMG8833_REG_SCLR 0x05
60#define AMG8833_REG_AVE 0x07
61#define AMG8833_REG_INTHL 0x08
62#define AMG8833_REG_INTHH 0x09
63#define AMG8833_REG_INTLL 0x0A
64#define AMG8833_REG_INTLH 0x0B
65#define AMG8833_REG_IHYSL 0x0C
66#define AMG8833_REG_IHYSH 0x0D
67#define AMG8833_REG_TTHL 0x0E
68#define AMG8833_REG_TTHH 0x0F
69#define AMG8833_REG_INT0 0x10
70#define AMG8833_REG_INT1 0x11
71#define AMG8833_REG_INT2 0x12
72#define AMG8833_REG_INT3 0x13
73#define AMG8833_REG_INT4 0x14
74#define AMG8833_REG_INT5 0x15
75#define AMG8833_REG_INT6 0x16
76#define AMG8833_REG_INT7 0x17
77#define AMG8833_REG_T01L 0x80
78#define AMG8833_REG_T01H 0x81
91static uint8_t a_amg8833_iic_read(
amg8833_handle_t *handle, uint8_t reg, uint8_t *data, uint16_t len)
114static uint8_t a_amg8833_iic_write(
amg8833_handle_t *handle, uint8_t reg, uint8_t *data, uint16_t len)
142 handle->
iic_addr = (uint8_t)addr_pin;
193 handle->
debug_print(
"amg8833: iic_init is null.\n");
199 handle->
debug_print(
"amg8833: iic_deinit is null.\n");
205 handle->
debug_print(
"amg8833: iic_read is null.\n");
211 handle->
debug_print(
"amg8833: iic_write is null.\n");
217 handle->
debug_print(
"amg8833: delay_ms is null.\n");
223 handle->
debug_print(
"amg8833: receive_callback is null.\n");
229 handle->
debug_print(
"amg8833: iic init failed.\n");
237 handle->
debug_print(
"amg8833: write pctl register failed.\n");
244 res = a_amg8833_iic_write(handle,
AMG8833_REG_RST, (uint8_t *)&prev, 1);
247 handle->
debug_print(
"amg8833: write rst register failed.\n");
254 res = a_amg8833_iic_write(handle,
AMG8833_REG_RST, (uint8_t *)&prev, 1);
257 handle->
debug_print(
"amg8833: write rst register failed.\n");
295 handle->
debug_print(
"amg8833: write pctl register failed.\n");
302 handle->
debug_print(
"amg8833: iic deinit failed.\n");
340 handle->
debug_print(
"amg8833: read stat register failed.\n");
347 handle->
debug_print(
"amg8833: write sclr register failed.\n");
405 handle->
debug_print(
"amg8833: write pctl register failed.\n");
441 handle->
debug_print(
"amg8833: read pctl register failed.\n");
476 res = a_amg8833_iic_write(handle,
AMG8833_REG_RST, (uint8_t *)&prev, 1);
479 handle->
debug_print(
"amg8833: write rst register failed.\n");
515 handle->
debug_print(
"amg8833: read fpsc register failed.\n");
524 handle->
debug_print(
"amg8833: write fpsc register failed.\n");
560 handle->
debug_print(
"amg8833: read fpsc register failed.\n");
597 handle->
debug_print(
"amg8833: read intc register failed.\n");
606 handle->
debug_print(
"amg8833: write intc register failed.\n");
642 handle->
debug_print(
"amg8833: read intc register failed.\n");
679 handle->
debug_print(
"amg8833: read intc register failed.\n");
688 handle->
debug_print(
"amg8833: write intc register failed.\n");
724 handle->
debug_print(
"amg8833: read intc register failed.\n");
761 handle->
debug_print(
"amg8833: read stat register failed.\n");
799 handle->
debug_print(
"amg8833: write sclr register failed.\n");
832 res = a_amg8833_iic_read(handle,
AMG8833_REG_AVE, (uint8_t *)&prev, 1);
835 handle->
debug_print(
"amg8833: read ave register failed.\n");
841 res = a_amg8833_iic_write(handle,
AMG8833_REG_AVE, (uint8_t *)&prev, 1);
844 handle->
debug_print(
"amg8833: write ave register failed.\n");
877 res = a_amg8833_iic_read(handle,
AMG8833_REG_AVE, (uint8_t *)&prev, 1);
880 handle->
debug_print(
"amg8833: read ave register failed.\n");
914 buf[0] = (level >> 0) & 0xFF;
915 buf[1] = (level >> 8) & 0xF;
919 handle->
debug_print(
"amg8833: write inthl register failed.\n");
926 handle->
debug_print(
"amg8833: write inthh register failed.\n");
962 handle->
debug_print(
"amg8833: read inthl register failed.\n");
969 handle->
debug_print(
"amg8833: read inthh register failed.\n");
973 if ((buf[1] & (1 << 3)) != 0)
975 *level = (int16_t)(((uint16_t)(buf[1]) << 8) |
976 ((uint16_t)(0xF) << 12) | (buf[0] << 0));
980 *level = (int16_t)(((uint16_t)(buf[1]) << 8) | (buf[0] << 0));
1011 buf[0] = (level >> 0) & 0xFF;
1012 buf[1] = (level >> 8) & 0xF;
1016 handle->
debug_print(
"amg8833: write intll register failed.\n");
1023 handle->
debug_print(
"amg8833: write intlh register failed.\n");
1059 handle->
debug_print(
"amg8833: read intll register failed.\n");
1066 handle->
debug_print(
"amg8833: read intlh register failed.\n");
1070 if ((buf[1] & (1 << 3)) != 0)
1072 *level = (int16_t)(((uint16_t)(buf[1]) << 8) |
1073 ((uint16_t)(0xF) << 12) | (buf[0] << 0));
1077 *level = (int16_t)(((uint16_t)(buf[1]) << 8) | (buf[0] << 0));
1108 buf[0] = (level >> 0) & 0xFF;
1109 buf[1] = (level >> 8) & 0xF;
1113 handle->
debug_print(
"amg8833: write ihysl register failed.\n");
1120 handle->
debug_print(
"amg8833: write ihysh register failed.\n");
1156 handle->
debug_print(
"amg8833: read ihysl register failed.\n");
1163 handle->
debug_print(
"amg8833: read ihysh register failed.\n");
1167 if ((buf[1] & (1 << 3)) != 0)
1169 *level = (int16_t)(((uint16_t)(buf[1]) << 8) |
1170 ((uint16_t)(0xF) << 12) | (buf[0] << 0));
1174 *level = (int16_t)(((uint16_t)(buf[1]) << 8) | (buf[0] << 0));
1202 *reg = (int16_t)(temp / 0.25f);
1229 *temp = (float)(reg) * 0.25f;
1264 handle->
debug_print(
"amg8833: read tthl register failed.\n");
1271 handle->
debug_print(
"amg8833: read tthh register failed.\n");
1275 *raw = (int16_t)(((uint16_t)(buf[1] & 0xF) << 8) | (buf[0] << 0));
1276 data = (int16_t)(((uint16_t)(buf[1] & 0x7) << 8) | (buf[0] << 0));
1277 if ((buf[1] & 0x8) != 0)
1281 *temp = data * 0.0625f;
1323 handle->
debug_print(
"amg8833: read t01l register failed.\n");
1327 for (i = 0; i < 8; i++)
1329 for (j = 0; j < 8; j++)
1331 raw[7 - i][7 - j] = (int16_t)(((uint16_t)buf[i * 16 + j * 2 + 1] << 8) |
1332 buf[i * 16 + j * 2 + 0]);
1333 temp[7 - i][7 - j] = (float)raw[7 - i][7 - j] * 0.25f;
1370 res = a_amg8833_iic_read(handle,
AMG8833_REG_INT0, (uint8_t *)table[7], 1);
1373 handle->
debug_print(
"amg8833: read int0 register failed.\n");
1377 res = a_amg8833_iic_read(handle,
AMG8833_REG_INT1, (uint8_t *)table[6], 1);
1380 handle->
debug_print(
"amg8833: read int1 register failed.\n");
1384 res = a_amg8833_iic_read(handle,
AMG8833_REG_INT2, (uint8_t *)table[5], 1);
1387 handle->
debug_print(
"amg8833: read int2 register failed.\n");
1391 res = a_amg8833_iic_read(handle,
AMG8833_REG_INT3, (uint8_t *)table[4], 1);
1394 handle->
debug_print(
"amg8833: read int3 register failed.\n");
1398 res = a_amg8833_iic_read(handle,
AMG8833_REG_INT4, (uint8_t *)table[3], 1);
1401 handle->
debug_print(
"amg8833: read int4 register failed.\n");
1405 res = a_amg8833_iic_read(handle,
AMG8833_REG_INT5, (uint8_t *)table[2], 1);
1408 handle->
debug_print(
"amg8833: read int5 register failed.\n");
1412 res = a_amg8833_iic_read(handle,
AMG8833_REG_INT6, (uint8_t *)table[1], 1);
1415 handle->
debug_print(
"amg8833: read int6 register failed.\n");
1419 res = a_amg8833_iic_read(handle,
AMG8833_REG_INT7, (uint8_t *)table[0], 1);
1422 handle->
debug_print(
"amg8833: read int7 register failed.\n");
1454 return a_amg8833_iic_write(handle, reg, buf, len);
1481 return a_amg8833_iic_read(handle, reg, buf, len);
#define AMG8833_REG_IHYSH
#define SUPPLY_VOLTAGE_MAX
#define AMG8833_REG_INTHL
#define AMG8833_REG_INTLH
#define AMG8833_REG_INTLL
#define MANUFACTURER_NAME
#define SUPPLY_VOLTAGE_MIN
#define AMG8833_REG_PCTL
chip register definition
#define AMG8833_REG_IHYSL
#define CHIP_NAME
chip information definition
#define AMG8833_REG_INTHH
driver amg8833 header file
amg8833_address_t
amg8833 address enumeration definition
uint8_t amg8833_get_frame_rate(amg8833_handle_t *handle, amg8833_frame_rate_t *rate)
get the frame rate
amg8833_frame_rate_t
amg8833 frame rate enumeration definition
uint8_t amg8833_set_interrupt(amg8833_handle_t *handle, amg8833_bool_t enable)
enable or disable the interrupt
struct amg8833_handle_s amg8833_handle_t
amg8833 handle structure definition
amg8833_bool_t
amg8833 bool enumeration definition
uint8_t amg8833_get_status(amg8833_handle_t *handle, uint8_t *status)
get the status
uint8_t amg8833_clear_status(amg8833_handle_t *handle, amg8833_status_t status)
clear the interrupt status
amg8833_average_mode_t
amg8833 average mode enumeration definition
uint8_t amg8833_set_addr_pin(amg8833_handle_t *handle, amg8833_address_t addr_pin)
set the iic address pin
amg8833_mode_t
amg8833 mode enumeration definition
uint8_t amg8833_get_mode(amg8833_handle_t *handle, amg8833_mode_t *mode)
get the mode
uint8_t amg8833_get_interrupt_table(amg8833_handle_t *handle, uint8_t table[8][1])
get the interrupt table
uint8_t amg8833_deinit(amg8833_handle_t *handle)
close the chip
struct amg8833_info_s amg8833_info_t
amg8833 information structure definition
uint8_t amg8833_get_interrupt_hysteresis_level(amg8833_handle_t *handle, int16_t *level)
get the interrupt hysteresis level
uint8_t amg8833_interrupt_level_convert_to_data(amg8833_handle_t *handle, int16_t reg, float *temp)
convert the register raw data to the interrupt level
uint8_t amg8833_get_average_mode(amg8833_handle_t *handle, amg8833_average_mode_t *mode)
get the average_mode
uint8_t amg8833_reset(amg8833_handle_t *handle, amg8833_reset_type_t type)
reset the chip
uint8_t amg8833_set_interrupt_low_level(amg8833_handle_t *handle, int16_t level)
set the interrupt low level
uint8_t amg8833_get_interrupt_high_level(amg8833_handle_t *handle, int16_t *level)
get the interrupt high level
uint8_t amg8833_info(amg8833_info_t *info)
get chip's information
uint8_t amg8833_set_interrupt_mode(amg8833_handle_t *handle, amg8833_interrupt_mode_t mode)
set the interrupt mode
uint8_t amg8833_get_interrupt_mode(amg8833_handle_t *handle, amg8833_interrupt_mode_t *mode)
get the interrupt mode
uint8_t amg8833_read_temperature_array(amg8833_handle_t *handle, int16_t raw[8][8], float temp[8][8])
read the temperature array
uint8_t amg8833_set_mode(amg8833_handle_t *handle, amg8833_mode_t mode)
set the mode
uint8_t amg8833_get_addr_pin(amg8833_handle_t *handle, amg8833_address_t *addr_pin)
get the iic address pin
amg8833_reset_type_t
amg8833 reset type enumeration definition
amg8833_interrupt_mode_t
amg8833 interrupt mode enumeration definition
uint8_t amg8833_set_average_mode(amg8833_handle_t *handle, amg8833_average_mode_t mode)
set the average_mode
uint8_t amg8833_set_interrupt_high_level(amg8833_handle_t *handle, int16_t level)
set the interrupt high level
uint8_t amg8833_read_temperature(amg8833_handle_t *handle, int16_t *raw, float *temp)
read the temperature
uint8_t amg8833_get_interrupt_low_level(amg8833_handle_t *handle, int16_t *level)
get the interrupt low level
uint8_t amg8833_irq_handler(amg8833_handle_t *handle)
irq handler
uint8_t amg8833_get_interrupt(amg8833_handle_t *handle, amg8833_bool_t *enable)
get the interrupt status
uint8_t amg8833_set_frame_rate(amg8833_handle_t *handle, amg8833_frame_rate_t rate)
set the frame rate
uint8_t amg8833_interrupt_level_convert_to_register(amg8833_handle_t *handle, float temp, int16_t *reg)
convert the interrupt level to the register raw data
amg8833_status_t
amg8833 status enumeration definition
uint8_t amg8833_set_interrupt_hysteresis_level(amg8833_handle_t *handle, int16_t level)
set the interrupt hysteresis level
uint8_t amg8833_init(amg8833_handle_t *handle)
initialize the chip
uint8_t amg8833_set_reg(amg8833_handle_t *handle, uint8_t reg, uint8_t *buf, uint16_t len)
set the chip register
uint8_t amg8833_get_reg(amg8833_handle_t *handle, uint8_t reg, uint8_t *buf, uint16_t len)
get the chip register
void(* delay_ms)(uint32_t ms)
void(* receive_callback)(uint8_t type)
void(* debug_print)(const char *const fmt,...)
uint8_t(* iic_init)(void)
uint8_t(* iic_write)(uint8_t addr, uint8_t reg, uint8_t *buf, uint16_t len)
uint8_t(* iic_read)(uint8_t addr, uint8_t reg, uint8_t *buf, uint16_t len)
uint8_t(* iic_deinit)(void)
float supply_voltage_max_v
char manufacturer_name[32]
float supply_voltage_min_v