43 #define CHIP_NAME "Voicetx SYN6988"
44 #define MANUFACTURER_NAME "Voicetx"
45 #define SUPPLY_VOLTAGE_MIN 3.1f
46 #define SUPPLY_VOLTAGE_MAX 4.5f
47 #define MAX_CURRENT 53.0f
48 #define TEMPERATURE_MIN -40.0f
49 #define TEMPERATURE_MAX 85.0f
50 #define DRIVER_VERSION 1000
66 for (i = 0; i < timeout; i++)
99 for (i = 0; i < len; i++)
138 static uint16_t a_read(
syn6988_handle_t *handle, uint8_t *buf, uint16_t len)
145 for (i = 0; i < len; i++)
184 handle->
uart_spi = (uint8_t)interface;
233 handle->
debug_print(
"syn6988: uart_init is null.\n");
239 handle->
debug_print(
"syn6988: uart_deinit is null.\n");
245 handle->
debug_print(
"syn6988: uart_read is null.\n");
251 handle->
debug_print(
"syn6988: uart_write is null.\n");
257 handle->
debug_print(
"syn6988: uart_flush is null.\n");
263 handle->
debug_print(
"syn6988: spi_init is null.\n");
269 handle->
debug_print(
"syn6988: spi_deinit is null.\n");
275 handle->
debug_print(
"syn6988: spi_transmit is null.\n");
281 handle->
debug_print(
"syn6988: gpio_ready_init is null.\n");
287 handle->
debug_print(
"syn6988: gpio_ready_deinit is null.\n");
293 handle->
debug_print(
"syn6988: gpio_ready_read is null.\n");
299 handle->
debug_print(
"syn6988: delay_ms is null.\n");
308 handle->
debug_print(
"syn6988: spi init failed.\n");
317 handle->
debug_print(
"syn6988: uart init failed.\n");
332 handle->
debug_print(
"syn6988: gpio ready init failed.\n");
367 handle->
debug_print(
"syn6988: spi deinit failed.\n");
376 handle->
debug_print(
"syn6988: uart deinit failed.\n");
383 handle->
debug_print(
"syn6988: gpio ready deinit failed.\n");
448 handle->
debug_print(
"syn6988: uart flush failed.\n");
455 handle->
debug_print(
"syn6988: uart write failed.\n");
460 memset(temp, 0,
sizeof(uint8_t) * 1);
461 len = handle->
uart_read((uint8_t *)temp, 1);
464 handle->
debug_print(
"syn6988: uart read failed.\n");
474 else if (temp[0] == 0x4E)
489 handle->
debug_print(
"syn6988: command receive failed.\n");
526 can't use this function.\n");
535 res = a_write(handle, (uint8_t *)cmd, 4);
538 handle->
debug_print(
"syn6988: uart write failed.\n");
543 len = a_read(handle, (uint8_t *)&temp, 1);
546 handle->
debug_print(
"syn6988: uart read failed.\n");
556 handle->
debug_print(
"syn6988: command receive failed.\n");
591 can't use this function.\n");
600 res = a_write(handle, (uint8_t *)cmd, 4);
603 handle->
debug_print(
"syn6988: uart write failed.\n");
608 len = a_read(handle, (uint8_t *)&temp, 1);
611 handle->
debug_print(
"syn6988: uart read failed.\n");
622 handle->
debug_print(
"syn6988: command receive failed.\n");
657 can't use this function.\n");
666 res = a_write(handle, (uint8_t *)cmd, 4);
669 handle->
debug_print(
"syn6988: uart write failed.\n");
674 len = a_read(handle, (uint8_t *)&temp, 1);
677 handle->
debug_print(
"syn6988: uart read failed.\n");
687 handle->
debug_print(
"syn6988: command receive failed.\n");
722 can't use this function.\n");
731 res = a_write(handle, (uint8_t *)cmd, 4);
734 handle->
debug_print(
"syn6988: uart write failed.\n");
739 len = a_read(handle, (uint8_t *)&temp, 1);
742 handle->
debug_print(
"syn6988: uart read failed.\n");
752 handle->
debug_print(
"syn6988: command receive failed.\n");
787 can't use this function.\n");
796 res = a_write(handle, (uint8_t *)cmd, 4);
799 handle->
debug_print(
"syn6988: uart write failed.\n");
804 res = a_write(handle, (uint8_t *)cmd, 4);
807 handle->
debug_print(
"syn6988: uart write failed.\n");
812 len = a_read(handle, (uint8_t *)&temp, 1);
815 handle->
debug_print(
"syn6988: uart read failed.\n");
825 handle->
debug_print(
"syn6988: command receive failed.\n");
852 handle->
type = (uint8_t)type;
914 memset((
char *)(handle->
buf + 5), 0,
sizeof(
char) * 4091);
916 (void)vsnprintf((
char *)(handle->
buf + 5), 4091,
917 (
char const *)fmt, args);
919 len = (uint16_t)strlen((
const char *)(handle->
buf + 5));
920 handle->
buf[0] = 0xFD;
921 handle->
buf[1] = (uint8_t)((len + 2) / 256);
922 handle->
buf[2] = (len + 2) % 256;
923 handle->
buf[3] = 0x01;
925 res = a_check_busy(handle, timeout);
932 res = a_write(handle, handle->
buf, len + 5);
943 l = a_read(handle, (uint8_t *)&temp, 1);
946 handle->
debug_print(
"syn6988: uart read failed.\n");
961 handle->
debug_print(
"syn6988: command receive failed.\n");
993 handle->
debug_print(
"syn6988: volume is invalid.\n");
998 memset((
char *)cmd, 0,
sizeof(
char) * 8);
999 (void)snprintf((
char *)cmd, 8,
"[v%d]", (int16_t)volume);
1034 handle->
debug_print(
"syn6988: speed is invalid.\n");
1039 memset((
char *)cmd, 0,
sizeof(
char) * 8);
1040 (void)snprintf((
char *)cmd, 8,
"[s%d]", (int16_t)speed);
1073 memset((
char *)cmd, 0,
sizeof(
char) * 8);
1074 (void)snprintf((
char *)cmd, 8,
"[g%d]", (int16_t)language);
1116 len = (uint16_t)strlen(txt);
1119 handle->
debug_print(
"syn6988: txt is too long.\n");
1123 handle->
buf[0] = 0xFD;
1124 handle->
buf[1] = (uint8_t)((len + 2) / 256);
1125 handle->
buf[2] = (len + 2) % 256;
1126 handle->
buf[3] = command;
1127 handle->
buf[4] = param;
1128 strcpy((
char *)&handle->
buf[5], txt);
1129 res = a_check_busy(handle, timeout);
1136 res = a_write(handle, handle->
buf, len + 5);
1147 l = a_read(handle, (uint8_t *)&temp, 1);
1150 handle->
debug_print(
"syn6988: uart read failed.\n");
1165 handle->
debug_print(
"syn6988: command receive failed.\n");
1200 handle->
buf[0] = 0xFD;
1201 handle->
buf[1] = 0x00;
1202 handle->
buf[2] = 0x01;
1203 handle->
buf[3] = command;
1204 res = a_check_busy(handle, timeout);
1211 res = a_write(handle, handle->
buf, 4);
1222 l = a_read(handle, (uint8_t *)&temp, 1);
1225 handle->
debug_print(
"syn6988: uart read failed.\n");
1240 handle->
debug_print(
"syn6988: command receive failed.\n");
1264 strncpy(info->
interface,
"UART SPI", 16);
#define SUPPLY_VOLTAGE_MAX
#define MANUFACTURER_NAME
#define SUPPLY_VOLTAGE_MIN
#define CHIP_NAME
chip information definition
driver syn6988 header file
#define SYN6988_BUSY_TIMEOUT
syn6988 timeout definition
syn6988_type_t
syn6988 type enumeration definition
uint8_t syn6988_stop(syn6988_handle_t *handle)
stop the chip
uint8_t syn6988_get_text_type(syn6988_handle_t *handle, syn6988_type_t *type)
get the chip text type
uint8_t syn6988_synthesis_text(syn6988_handle_t *handle, const char *const fmt,...)
synthesis the test
uint8_t syn6988_init(syn6988_handle_t *handle)
initialize the chip
syn6988_status_t
syn6988 status enumeration definition
uint8_t syn6988_set_interface(syn6988_handle_t *handle, syn6988_interface_t interface)
set the chip interface
syn6988_interface_t
syn6988 interface enumeration definition
uint8_t syn6988_set_synthesis_language(syn6988_handle_t *handle, syn6988_language_t language)
set synthesis language
uint8_t syn6988_wake_up(syn6988_handle_t *handle)
wake up the chip
uint8_t syn6988_get_interface(syn6988_handle_t *handle, syn6988_interface_t *interface)
get the chip interface
uint8_t syn6988_pause(syn6988_handle_t *handle)
pause the chip
uint8_t syn6988_info(syn6988_info_t *info)
get chip's information
uint8_t syn6988_deinit(syn6988_handle_t *handle)
close the chip
uint8_t syn6988_standby(syn6988_handle_t *handle)
set the chip to standby mode
uint8_t syn6988_get_status(syn6988_handle_t *handle, syn6988_status_t *status)
get the current status
uint8_t syn6988_set_synthesis_speed(syn6988_handle_t *handle, uint8_t speed)
set the synthesis speed
syn6988_language_t
syn6988 language enumeration definition
uint8_t syn6988_resume(syn6988_handle_t *handle)
resume the chip
uint8_t syn6988_set_synthesis_volume(syn6988_handle_t *handle, uint8_t volume)
set the chip synthesis volume
uint8_t syn6988_set_text_type(syn6988_handle_t *handle, syn6988_type_t type)
set the chip text type
uint8_t syn6988_set_command(syn6988_handle_t *handle, uint8_t command, uint32_t timeout)
send the command to the chip
uint8_t syn6988_set_command_with_arg(syn6988_handle_t *handle, uint8_t command, uint8_t param, char *txt, uint32_t timeout)
send the command with arg to the chip
syn6988 handle structure definition
uint8_t(* uart_flush)(void)
uint8_t(* uart_write)(uint8_t *buf, uint16_t len)
uint8_t(* spi_init)(void)
void(* delay_ms)(uint32_t ms)
uint8_t(* gpio_ready_read)(uint8_t *value)
uint8_t(* uart_deinit)(void)
uint8_t(* gpio_ready_init)(void)
void(* debug_print)(const char *const fmt,...)
uint8_t(* spi_transmit)(uint8_t *tx, uint8_t *rx, uint16_t len)
uint8_t(* spi_deinit)(void)
uint16_t(* uart_read)(uint8_t *buf, uint16_t len)
uint8_t(* gpio_ready_deinit)(void)
uint8_t(* uart_init)(void)
syn6988 information structure definition
float supply_voltage_max_v
char manufacturer_name[32]
float supply_voltage_min_v