LibDriver WT588E02B
Loading...
Searching...
No Matches
driver_wt588e02b_update_test.c
Go to the documentation of this file.
1
36
38#include <stdlib.h>
39
40static wt588e02b_handle_t gs_handle;
41
50uint8_t wt588e02b_update_all_test(char *path)
51{
52 uint8_t res;
54
55 /* link driver */
75
76 /* get information */
77 res = wt588e02b_info(&info);
78 if (res != 0)
79 {
80 wt588e02b_interface_debug_print("wt588e02b: get info failed.\n");
81
82 return 1;
83 }
84 else
85 {
86 /* print chip info */
87 wt588e02b_interface_debug_print("wt588e02b: chip is %s.\n", info.chip_name);
88 wt588e02b_interface_debug_print("wt588e02b: manufacturer is %s.\n", info.manufacturer_name);
89 wt588e02b_interface_debug_print("wt588e02b: interface is %s.\n", info.interface);
90 wt588e02b_interface_debug_print("wt588e02b: driver version is %d.%d.\n", info.driver_version / 1000, (info.driver_version % 1000) / 100);
91 wt588e02b_interface_debug_print("wt588e02b: min supply voltage is %0.1fV.\n", info.supply_voltage_min_v);
92 wt588e02b_interface_debug_print("wt588e02b: max supply voltage is %0.1fV.\n", info.supply_voltage_max_v);
93 wt588e02b_interface_debug_print("wt588e02b: max current is %0.2fmA.\n", info.max_current_ma);
94 wt588e02b_interface_debug_print("wt588e02b: max temperature is %0.1fC.\n", info.temperature_max);
95 wt588e02b_interface_debug_print("wt588e02b: min temperature is %0.1fC.\n", info.temperature_min);
96 }
97
98 /* start update all test */
99 wt588e02b_interface_debug_print("wt588e02b: start update all test.\n");
100
101 /* init */
102 res = wt588e02b_init(&gs_handle);
103 if (res != 0)
104 {
105 wt588e02b_interface_debug_print("wt588e02b: init failed.\n");
106
107 return 1;
108 }
109
110 /* start update all */
111 wt588e02b_interface_debug_print("wt588e02b: start update all...\n");
112
113 /* update all */
114 res = wt588e02b_update_all(&gs_handle, path);
115 if (res != 0)
116 {
117 wt588e02b_interface_debug_print("wt588e02b: update all failed.\n");
118 (void)wt588e02b_deinit(&gs_handle);
119
120 return 1;
121 }
122
123 /* finish update */
124 wt588e02b_interface_debug_print("wt588e02b: finish update.\n");
125
126 /* finish update all test */
127 wt588e02b_interface_debug_print("wt588e02b: finish update all test.\n");
128 (void)wt588e02b_deinit(&gs_handle);
129
130 return 0;
131}
132
142uint8_t wt588e02b_update_test(uint8_t ind, char *path)
143{
144 uint8_t res;
145 wt588e02b_info_t info;
146
147 /* link driver */
167
168 /* get information */
169 res = wt588e02b_info(&info);
170 if (res != 0)
171 {
172 wt588e02b_interface_debug_print("wt588e02b: get info failed.\n");
173
174 return 1;
175 }
176 else
177 {
178 /* print chip info */
179 wt588e02b_interface_debug_print("wt588e02b: chip is %s.\n", info.chip_name);
180 wt588e02b_interface_debug_print("wt588e02b: manufacturer is %s.\n", info.manufacturer_name);
181 wt588e02b_interface_debug_print("wt588e02b: interface is %s.\n", info.interface);
182 wt588e02b_interface_debug_print("wt588e02b: driver version is %d.%d.\n", info.driver_version / 1000, (info.driver_version % 1000) / 100);
183 wt588e02b_interface_debug_print("wt588e02b: min supply voltage is %0.1fV.\n", info.supply_voltage_min_v);
184 wt588e02b_interface_debug_print("wt588e02b: max supply voltage is %0.1fV.\n", info.supply_voltage_max_v);
185 wt588e02b_interface_debug_print("wt588e02b: max current is %0.2fmA.\n", info.max_current_ma);
186 wt588e02b_interface_debug_print("wt588e02b: max temperature is %0.1fC.\n", info.temperature_max);
187 wt588e02b_interface_debug_print("wt588e02b: min temperature is %0.1fC.\n", info.temperature_min);
188 }
189
190 /* start update test */
191 wt588e02b_interface_debug_print("wt588e02b: start update test.\n");
192
193 /* init */
194 res = wt588e02b_init(&gs_handle);
195 if (res != 0)
196 {
197 wt588e02b_interface_debug_print("wt588e02b: init failed.\n");
198
199 return 1;
200 }
201
202 /* start update */
203 wt588e02b_interface_debug_print("wt588e02b: start update...\n");
204
205 /* update */
206 res = wt588e02b_update(&gs_handle, ind, path);
207 if (res != 0)
208 {
209 wt588e02b_interface_debug_print("wt588e02b: update failed.\n");
210 (void)wt588e02b_deinit(&gs_handle);
211
212 return 1;
213 }
214
215 /* finish update */
216 wt588e02b_interface_debug_print("wt588e02b: finish update.\n");
217
218 /* finish update test */
219 wt588e02b_interface_debug_print("wt588e02b: finish update test.\n");
220 (void)wt588e02b_deinit(&gs_handle);
221
222 return 0;
223}
driver wt588e02b update test header file
struct wt588e02b_info_s wt588e02b_info_t
wt588e02b information structure definition
uint8_t wt588e02b_update(wt588e02b_handle_t *handle, uint8_t ind, char *path)
update audio
struct wt588e02b_handle_s wt588e02b_handle_t
wt588e02b handle structure definition
uint8_t wt588e02b_info(wt588e02b_info_t *info)
get chip's information
uint8_t wt588e02b_deinit(wt588e02b_handle_t *handle)
deinit the chip
uint8_t wt588e02b_init(wt588e02b_handle_t *handle)
initialize the chip
uint8_t wt588e02b_update_all(wt588e02b_handle_t *handle, char *path)
update all audio
void wt588e02b_interface_debug_print(const char *const fmt,...)
interface print format data
uint8_t wt588e02b_interface_bin_read(uint32_t addr, uint16_t size, uint8_t *buffer)
interface bin read
void wt588e02b_interface_delay_us(uint32_t us)
interface delay us
uint8_t wt588e02b_interface_sclk_gpio_init(void)
interface sclk gpio init
uint8_t wt588e02b_interface_cs_gpio_init(void)
interface cs gpio init
uint8_t wt588e02b_interface_miso_gpio_deinit(void)
interface miso gpio deinit
uint8_t wt588e02b_interface_cs_gpio_deinit(void)
interface cs gpio init
uint8_t wt588e02b_interface_cs_gpio_write(uint8_t data)
interface cs gpio write
uint8_t wt588e02b_interface_sclk_gpio_deinit(void)
interface sclk gpio deinit
uint8_t wt588e02b_interface_miso_gpio_init(void)
interface miso gpio init
uint8_t wt588e02b_interface_sclk_gpio_write(uint8_t data)
interface sclk gpio write
uint8_t wt588e02b_interface_mosi_gpio_init(void)
interface mosi gpio init
uint8_t wt588e02b_interface_mosi_gpio_deinit(void)
interface mosi gpio deinit
void wt588e02b_interface_delay_ms(uint32_t ms)
interface delay ms
uint8_t wt588e02b_interface_miso_gpio_read(uint8_t *data)
interface miso_gpio_read
uint8_t wt588e02b_interface_mosi_gpio_write(uint8_t data)
interface mosi gpio write
uint8_t wt588e02b_interface_bin_read_deinit(void)
interface bin read deinit
uint8_t wt588e02b_interface_bin_read_init(char *name, uint32_t *size)
interface bin read init
uint8_t wt588e02b_update_test(uint8_t ind, char *path)
update test
uint8_t wt588e02b_update_all_test(char *path)
update all test