LibDriver SYN6288
Loading...
Searching...
No Matches
driver_syn6288_basic.c
Go to the documentation of this file.
1
37
39
40static syn6288_handle_t gs_handle;
41
49uint8_t syn6288_basic_init(void)
50{
51 uint8_t res;
52
53 /* link interface function */
62
63 /* syn6288 init */
64 res = syn6288_init(&gs_handle);
65 if (res != 0)
66 {
67 syn6288_interface_debug_print("syn6288: init failed.\n");
68
69 return 1;
70 }
71#if (SYN6288_BASIC_SEND_CONFIG == 1)
72
73 /* set defalut baud rate */
75 if (res != 0)
76 {
77 syn6288_interface_debug_print("syn6288: set baud rate failed.\n");
78 (void)syn6288_deinit(&gs_handle);
79
80 return 1;
81 }
83
84 /* set defalut mode */
86 if (res != 0)
87 {
88 syn6288_interface_debug_print("syn6288: set mode failed.\n");
89 (void)syn6288_deinit(&gs_handle);
90
91 return 1;
92 }
94
95 /* set defalut text type */
97 if (res != 0)
98 {
99 syn6288_interface_debug_print("syn6288: set text type failed.\n");
100 (void)syn6288_deinit(&gs_handle);
101
102 return 1;
103 }
105
106 /* set defalut synthesis volume */
108 if (res != 0)
109 {
110 syn6288_interface_debug_print("syn6288: set synthesis volume failed.\n");
111 (void)syn6288_deinit(&gs_handle);
112
113 return 1;
114 }
116
117 /* set defalut background volume */
119 if (res != 0)
120 {
121 syn6288_interface_debug_print("syn6288: set background volume failed.\n");
122 (void)syn6288_deinit(&gs_handle);
123
124 return 1;
125 }
127
128 /* set defalut synthesis speed */
130 if (res != 0)
131 {
132 syn6288_interface_debug_print("syn6288: set synthesis speed failed.\n");
133 (void)syn6288_deinit(&gs_handle);
134
135 return 1;
136 }
138#endif
139
140 return 0;
141}
142
151uint8_t syn6288_basic_synthesis(char *text)
152{
153 uint8_t res;
154 syn6288_status_t status;
155
156 /* get status */
157 res = syn6288_get_status(&gs_handle, &status);
158 if (res != 0)
159 {
160 return 1;
161 }
162
163 /* check status */
164 if (status == SYN6288_STATUS_BUSY)
165 {
166 return 1;
167 }
168
169 /* synthesis text */
170 if (syn6288_synthesis_text(&gs_handle, text) != 0)
171 {
172 return 1;
173 }
174 else
175 {
176 return 0;
177 }
178}
179
188{
189 uint8_t res;
190 syn6288_status_t status;
191
192 status = SYN6288_STATUS_BUSY;
193 while (status == SYN6288_STATUS_BUSY)
194 {
196 res = syn6288_get_status(&gs_handle, &status);
197 if (res != 0)
198 {
199 return 1;
200 }
201 }
202
203 return 0;
204}
205
214{
215 /* deinit syn6288 */
216 if (syn6288_deinit(&gs_handle) != 0)
217 {
218 return 1;
219 }
220 else
221 {
222 return 0;
223 }
224}
driver syn6288 basic header file
uint8_t syn6288_set_background_volume(syn6288_handle_t *handle, uint8_t volume)
set the synthesis background volume
uint8_t syn6288_set_baud_rate(syn6288_handle_t *handle, syn6288_baud_rate_t rate)
set the baud rate
uint8_t syn6288_set_synthesis_volume(syn6288_handle_t *handle, uint8_t volume)
set the chip synthesis volume
uint8_t syn6288_set_synthesis_speed(syn6288_handle_t *handle, uint8_t speed)
set the synthesis speed
uint8_t syn6288_set_mode(syn6288_handle_t *handle, syn6288_mode_t mode)
set the chip mode
uint8_t syn6288_init(syn6288_handle_t *handle)
initialize the chip
syn6288_status_t
syn6288 status enumeration definition
uint8_t syn6288_get_status(syn6288_handle_t *handle, syn6288_status_t *status)
get the current status
uint8_t syn6288_set_text_type(syn6288_handle_t *handle, syn6288_type_t type)
set the chip text type
uint8_t syn6288_deinit(syn6288_handle_t *handle)
close the chip
uint8_t syn6288_synthesis_text(syn6288_handle_t *handle, char *text)
synthesis the test
struct syn6288_handle_s syn6288_handle_t
syn6288 handle structure definition
@ SYN6288_STATUS_BUSY
#define SYN6288_BASIC_DEFAULT_TEXT_TYPE
uint8_t syn6288_basic_init(void)
basic example init
uint8_t syn6288_basic_sync(void)
basic example sync
#define SYN6288_BASIC_DEFAULT_BACKGROUND_VOLUME
uint8_t syn6288_basic_deinit(void)
basic example deinit
#define SYN6288_BASIC_DEFAULT_SYNTHESIS_VOLUME
#define SYN6288_BASIC_DEFAULT_SYNTHESIS_SPEED
uint8_t syn6288_basic_synthesis(char *text)
basic example synthesis
#define SYN6288_BASIC_DEFAULT_MODE
#define SYN6288_BASIC_DEFAULT_BAUD_RATE
syn6288 basic example default definition
void syn6288_interface_delay_ms(uint32_t ms)
interface delay ms
uint8_t syn6288_interface_uart_flush(void)
interface uart flush
uint8_t syn6288_interface_uart_write(uint8_t *buf, uint16_t len)
interface uart write
uint16_t syn6288_interface_uart_read(uint8_t *buf, uint16_t len)
interface uart read
uint8_t syn6288_interface_uart_deinit(void)
interface uart deinit
void syn6288_interface_debug_print(const char *const fmt,...)
interface print format data
uint8_t syn6288_interface_uart_init(void)
interface uart init