LibDriver SYN6288E
Loading...
Searching...
No Matches
driver_syn6288e_basic.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_BASIC_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_basic_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
187{
188 uint8_t res;
189 syn6288e_status_t status;
190
191 status = SYN6288E_STATUS_BUSY;
192 while (status == SYN6288E_STATUS_BUSY)
193 {
195 res = syn6288e_get_status(&gs_handle, &status);
196 if (res != 0)
197 {
198 return 1;
199 }
200 }
201
202 return 0;
203}
204
213{
214 /* deinit syn6288e */
215 if (syn6288e_deinit(&gs_handle) != 0)
216 {
217 return 1;
218 }
219 else
220 {
221 return 0;
222 }
223}
driver syn6288e basic 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_init(syn6288e_handle_t *handle)
initialize the chip
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
syn6288e_status_t
syn6288e status enumeration definition
@ SYN6288E_STATUS_BUSY
uint8_t syn6288e_basic_init(void)
basic example init
#define SYN6288E_BASIC_DEFAULT_BACKGROUND_VOLUME
#define SYN6288E_BASIC_DEFAULT_TEXT_TYPE
#define SYN6288E_BASIC_DEFAULT_BAUD_RATE
syn6288e basic example default definition
#define SYN6288E_BASIC_DEFAULT_SYNTHESIS_VOLUME
uint8_t syn6288e_basic_sync(void)
basic example sync
uint8_t syn6288e_basic_synthesis(char *text)
basic example synthesis
#define SYN6288E_BASIC_DEFAULT_SYNTHESIS_SPEED
uint8_t syn6288e_basic_deinit(void)
basic example deinit
#define SYN6288E_BASIC_DEFAULT_MODE
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