LibDriver SYN6288E
Loading...
Searching...
No Matches
driver_syn6288e_advance.c
Go to the documentation of this file.
1
36
38
39static syn6288e_handle_t gs_handle;
40
49{
50 uint8_t res;
51
52 /* link interface function */
61
62 /* syn6288e init */
63 res = syn6288e_init(&gs_handle);
64 if (res != 0)
65 {
66 syn6288e_interface_debug_print("syn6288e: init failed.\n");
67
68 return 1;
69 }
70#if (SYN6288E_ADVANCE_SEND_CONFIG == 1)
71
72 /* set defalut baud rate */
74 if (res != 0)
75 {
76 syn6288e_interface_debug_print("syn6288e: set baud rate failed.\n");
77 (void)syn6288e_deinit(&gs_handle);
78
79 return 1;
80 }
82
83 /* set defalut mode */
85 if (res != 0)
86 {
87 syn6288e_interface_debug_print("syn6288e: set mode failed.\n");
88 (void)syn6288e_deinit(&gs_handle);
89
90 return 1;
91 }
93
94 /* set defalut text type */
96 if (res != 0)
97 {
98 syn6288e_interface_debug_print("syn6288e: set text type failed.\n");
99 (void)syn6288e_deinit(&gs_handle);
100
101 return 1;
102 }
104
105 /* set defalut synthesis volume */
107 if (res != 0)
108 {
109 syn6288e_interface_debug_print("syn6288e: set synthesis volume failed.\n");
110 (void)syn6288e_deinit(&gs_handle);
111
112 return 1;
113 }
115
116 /* set defalut background volume */
118 if (res != 0)
119 {
120 syn6288e_interface_debug_print("syn6288e: set background volume failed.\n");
121 (void)syn6288e_deinit(&gs_handle);
122
123 return 1;
124 }
126
127 /* set defalut synthesis speed */
129 if (res != 0)
130 {
131 syn6288e_interface_debug_print("syn6288e: set synthesis speed failed.\n");
132 (void)syn6288e_deinit(&gs_handle);
133
134 return 1;
135 }
137#endif
138
139 return 0;
140}
141
150uint8_t syn6288e_advance_synthesis(char *text)
151{
152 uint8_t res;
153 syn6288e_status_t status;
154
155 /* get status */
156 res = syn6288e_get_status(&gs_handle, &status);
157 if (res != 0)
158 {
159 return 1;
160 }
161
162 /* check status */
163 if (status == SYN6288E_STATUS_BUSY)
164 {
165 return 1;
166 }
167
168 /* synthesis text */
169 if (syn6288e_synthesis_text(&gs_handle, text) != 0)
170 {
171 return 1;
172 }
173 else
174 {
175 return 0;
176 }
177}
178
188{
189 uint8_t res;
190 syn6288e_status_t status;
191
192 /* get status */
193 res = syn6288e_get_status(&gs_handle, &status);
194 if (res != 0)
195 {
196 return 1;
197 }
198
199 /* check status */
200 if (status == SYN6288E_STATUS_BUSY)
201 {
202 return 1;
203 }
204
205 /* synthesis sound */
206 if (syn6288e_synthesis_sound(&gs_handle, sound) != 0)
207 {
208 return 1;
209 }
210 else
211 {
212 return 0;
213 }
214}
215
225{
226 uint8_t res;
227 syn6288e_status_t status;
228
229 /* get status */
230 res = syn6288e_get_status(&gs_handle, &status);
231 if (res != 0)
232 {
233 return 1;
234 }
235
236 /* check status */
237 if (status == SYN6288E_STATUS_BUSY)
238 {
239 return 1;
240 }
241
242 /* synthesis message */
243 if (syn6288e_synthesis_message(&gs_handle, message) != 0)
244 {
245 return 1;
246 }
247 else
248 {
249 return 0;
250 }
251}
252
262{
263 uint8_t res;
264 syn6288e_status_t status;
265
266 /* get status */
267 res = syn6288e_get_status(&gs_handle, &status);
268 if (res != 0)
269 {
270 return 1;
271 }
272
273 /* check status */
274 if (status == SYN6288E_STATUS_BUSY)
275 {
276 return 1;
277 }
278
279 /* synthesis ring */
280 if (syn6288e_synthesis_ring(&gs_handle, ring) != 0)
281 {
282 return 1;
283 }
284 else
285 {
286 return 0;
287 }
288}
289
298{
299 /* pause syn6288e */
300 if (syn6288e_pause(&gs_handle) != 0)
301 {
302 return 1;
303 }
304 else
305 {
306 return 0;
307 }
308}
309
318{
319 /* resume syn6288e */
320 if (syn6288e_resume(&gs_handle) != 0)
321 {
322 return 1;
323 }
324 else
325 {
326 return 0;
327 }
328}
329
338{
339 /* stop syn6288e */
340 if (syn6288e_stop(&gs_handle) != 0)
341 {
342 return 1;
343 }
344 else
345 {
346 return 0;
347 }
348}
349
358{
359 /* power on syn6288e */
360 if (syn6288e_power_down(&gs_handle) != 0)
361 {
362 return 1;
363 }
364 else
365 {
366 return 0;
367 }
368}
369
378{
379 /* deinit syn6288e */
380 if (syn6288e_deinit(&gs_handle) != 0)
381 {
382 return 1;
383 }
384 else
385 {
386 return 0;
387 }
388}
389
398{
399 uint8_t res;
400 syn6288e_status_t status;
401
402 status = SYN6288E_STATUS_BUSY;
403 while (status == SYN6288E_STATUS_BUSY)
404 {
406 res = syn6288e_get_status(&gs_handle, &status);
407 if (res != 0)
408 {
409 return 1;
410 }
411 }
412
413 return 0;
414}
driver syn6288e advance header file
uint8_t syn6288e_set_background_volume(syn6288e_handle_t *handle, uint8_t volume)
set the synthesis background volume
uint8_t syn6288e_set_baud_rate(syn6288e_handle_t *handle, syn6288e_baud_rate_t rate)
set the baud rate
uint8_t syn6288e_set_synthesis_speed(syn6288e_handle_t *handle, uint8_t speed)
set the synthesis speed
uint8_t syn6288e_set_synthesis_volume(syn6288e_handle_t *handle, uint8_t volume)
set the chip synthesis volume
uint8_t syn6288e_set_mode(syn6288e_handle_t *handle, syn6288e_mode_t mode)
set the chip mode
uint8_t syn6288e_synthesis_text(syn6288e_handle_t *handle, char *text)
synthesis the test
uint8_t syn6288e_synthesis_sound(syn6288e_handle_t *handle, syn6288e_sound_t sound)
synthesis the sound
syn6288e_message_t
syn6288e message enumeration definition
syn6288e_ring_t
syn6288e ring enumeration definition
uint8_t syn6288e_init(syn6288e_handle_t *handle)
initialize the chip
uint8_t syn6288e_synthesis_ring(syn6288e_handle_t *handle, syn6288e_ring_t ring)
synthesis the ring
uint8_t syn6288e_deinit(syn6288e_handle_t *handle)
close the chip
uint8_t syn6288e_set_text_type(syn6288e_handle_t *handle, syn6288e_type_t type)
set the chip text type
struct syn6288e_handle_s syn6288e_handle_t
syn6288e handle structure definition
uint8_t syn6288e_get_status(syn6288e_handle_t *handle, syn6288e_status_t *status)
get the current status
uint8_t syn6288e_stop(syn6288e_handle_t *handle)
stop the chip
uint8_t syn6288e_power_down(syn6288e_handle_t *handle)
power down the chip
uint8_t syn6288e_synthesis_message(syn6288e_handle_t *handle, syn6288e_message_t message)
synthesis the message
uint8_t syn6288e_pause(syn6288e_handle_t *handle)
pause the chip
syn6288e_status_t
syn6288e status enumeration definition
uint8_t syn6288e_resume(syn6288e_handle_t *handle)
resume the chip
syn6288e_sound_t
syn6288e sound enumeration definition
@ SYN6288E_STATUS_BUSY
#define SYN6288E_ADVANCE_DEFAULT_SYNTHESIS_VOLUME
#define SYN6288E_ADVANCE_DEFAULT_BAUD_RATE
syn6288e advance example default definition
uint8_t syn6288e_advance_init(void)
advance example init
uint8_t syn6288e_advance_sound(syn6288e_sound_t sound)
advance example play the sound
uint8_t syn6288e_advance_message(syn6288e_message_t message)
advance example play the message
uint8_t syn6288e_advance_pause(void)
advance example pause
#define SYN6288E_ADVANCE_DEFAULT_SYNTHESIS_SPEED
uint8_t syn6288e_advance_synthesis(char *text)
advance example synthesis
uint8_t syn6288e_advance_stop(void)
advance example stop
uint8_t syn6288e_advance_resume(void)
advance example resume
#define SYN6288E_ADVANCE_DEFAULT_MODE
#define SYN6288E_ADVANCE_DEFAULT_TEXT_TYPE
uint8_t syn6288e_advance_ring(syn6288e_ring_t ring)
advance example play the ring
#define SYN6288E_ADVANCE_DEFAULT_BACKGROUND_VOLUME
uint8_t syn6288e_advance_deinit(void)
advance example deinit
uint8_t syn6288e_advance_sync(void)
advance example sync
uint8_t syn6288e_advance_power_down(void)
advance example power down
uint8_t syn6288e_interface_uart_init(void)
interface uart init
uint8_t syn6288e_interface_uart_flush(void)
interface uart flush
void syn6288e_interface_delay_ms(uint32_t ms)
interface delay ms
uint16_t syn6288e_interface_uart_read(uint8_t *buf, uint16_t len)
interface uart read
void syn6288e_interface_debug_print(const char *const fmt,...)
interface print format data
uint8_t syn6288e_interface_uart_write(uint8_t *buf, uint16_t len)
interface uart write
uint8_t syn6288e_interface_uart_deinit(void)
interface uart deinit