LibDriver AMG8833
Loading...
Searching...
No Matches
driver_amg8833_basic.c
Go to the documentation of this file.
1
36
38
39static amg8833_handle_t gs_handle;
40
50{
51 uint8_t res;
52
53 /* link interface function */
62
63 /* set the address */
64 res = amg8833_set_addr_pin(&gs_handle, addr_pin);
65 if (res != 0)
66 {
67 amg8833_interface_debug_print("amg8833: set addr pin failed.\n");
68
69 return 1;
70 }
71
72 /* init */
73 res = amg8833_init(&gs_handle);
74 if (res != 0)
75 {
76 amg8833_interface_debug_print("amg8833: init failed.\n");
77
78 return 1;
79 }
80
81 /* set normal mode */
82 res = amg8833_set_mode(&gs_handle, AMG8833_MODE_NORMAL);
83 if (res != 0)
84 {
85 amg8833_interface_debug_print("amg8833: set mode failed.\n");
86 (void)amg8833_deinit(&gs_handle);
87
88 return 1;
89 }
90
91 /* set frame rate */
93 if (res != 0)
94 {
95 amg8833_interface_debug_print("amg8833: set frame rate failed.\n");
96 (void)amg8833_deinit(&gs_handle);
97
98 return 1;
99 }
100
101 /* disable */
102 res = amg8833_set_interrupt(&gs_handle, AMG8833_BOOL_FALSE);
103 if (res != 0)
104 {
105 amg8833_interface_debug_print("amg8833: set interrupt failed.\n");
106 (void)amg8833_deinit(&gs_handle);
107
108 return 1;
109 }
110
111 /* set average mode */
113 if (res != 0)
114 {
115 amg8833_interface_debug_print("amg8833: set average mode failed.\n");
116 (void)amg8833_deinit(&gs_handle);
117
118 return 1;
119 }
120
121 return 0;
122}
123
132{
133 if (amg8833_deinit(&gs_handle) != 0)
134 {
135 return 1;
136 }
137 else
138 {
139 return 0;
140 }
141}
142
152{
153 int16_t raw[8][8];
154
155 /* read temperature array */
156 if (amg8833_read_temperature_array(&gs_handle, (int16_t (*)[8])raw, temp) != 0)
157 {
158 return 1;
159 }
160 else
161 {
162 return 0;
163 }
164}
165
175{
176 int16_t raw;
177
178 /* read temperature */
179 if (amg8833_read_temperature(&gs_handle, (int16_t *)&raw, (float *)temp) != 0)
180 {
181 return 1;
182 }
183 else
184 {
185 return 0;
186 }
187}
driver amg8833 basic header file
amg8833_address_t
amg8833 address 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
uint8_t amg8833_set_addr_pin(amg8833_handle_t *handle, amg8833_address_t addr_pin)
set the iic address pin
uint8_t amg8833_deinit(amg8833_handle_t *handle)
close the chip
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_set_average_mode(amg8833_handle_t *handle, amg8833_average_mode_t mode)
set the average_mode
uint8_t amg8833_read_temperature(amg8833_handle_t *handle, int16_t *raw, float *temp)
read the temperature
uint8_t amg8833_set_frame_rate(amg8833_handle_t *handle, amg8833_frame_rate_t rate)
set the frame rate
uint8_t amg8833_init(amg8833_handle_t *handle)
initialize the chip
@ AMG8833_BOOL_FALSE
@ AMG8833_MODE_NORMAL
uint8_t amg8833_basic_deinit(void)
basic example deinit
uint8_t amg8833_basic_read_temperature(float *temp)
basic example read temperature
uint8_t amg8833_basic_read_temperature_array(float temp[8][8])
basic example read temperature array
#define AMG8833_BASIC_DEFAULT_FRAME_RATE
amg8833 basic example default definition
uint8_t amg8833_basic_init(amg8833_address_t addr_pin)
basic example init
#define AMG8833_BASIC_DEFAULT_AVERAGE_MODE
uint8_t amg8833_interface_iic_deinit(void)
interface iic bus deinit
void amg8833_interface_receive_callback(uint8_t type)
interface receive callback
void amg8833_interface_delay_ms(uint32_t ms)
interface delay ms
uint8_t amg8833_interface_iic_write(uint8_t addr, uint8_t reg, uint8_t *buf, uint16_t len)
interface iic bus write
void amg8833_interface_debug_print(const char *const fmt,...)
interface print format data
uint8_t amg8833_interface_iic_init(void)
interface iic bus init
uint8_t amg8833_interface_iic_read(uint8_t addr, uint8_t reg, uint8_t *buf, uint16_t len)
interface iic bus read