42#define CHIP_NAME "Tontek TTP229"
43#define MANUFACTURER_NAME "Tontek"
44#define SUPPLY_VOLTAGE_MIN 2.4f
45#define SUPPLY_VOLTAGE_MAX 5.5f
46#define MAX_CURRENT 8.0f
47#define TEMPERATURE_MIN -40.0f
48#define TEMPERATURE_MAX 85.0f
49#define DRIVER_VERSION 1000
54#define TTP229_ADDRESS (0x57 << 1)
66static uint8_t a_ttp229_iic_spi_read(
ttp229_handle_t *handle, uint8_t *buf, uint16_t len)
104 handle->
iic_spi = (uint8_t)interface;
151 handle->
active = (uint8_t)active_level;
204 handle->
debug_print(
"ttp229: iic_init is null.\n");
210 handle->
debug_print(
"ttp229: iic_deinit is null.\n");
216 handle->
debug_print(
"ttp229: iic_read_cmd is null.\n");
222 handle->
debug_print(
"ttp229: spi_init is null.\n");
228 handle->
debug_print(
"ttp229: spi_deinit is null.\n");
234 handle->
debug_print(
"ttp229: spi_read_cmd is null.\n");
240 handle->
debug_print(
"ttp229: delay_ms is null.\n");
338 if (a_ttp229_iic_spi_read(handle, buf, 2) != 0)
344 for (i = 0; i < 16; i++)
346 keys[i] = (buf[i / 8] >> (7 - i % 8)) & 0x01;
381 if (a_ttp229_iic_spi_read(handle, buf, 1) != 0)
387 for (i = 0; i < 8; i++)
389 keys[i] = (buf[i / 8] >> (7 - i % 8)) & 0x01;
422 return a_ttp229_iic_spi_read(handle, buf, len);
#define SUPPLY_VOLTAGE_MAX
#define TTP229_ADDRESS
chip address definition
#define MANUFACTURER_NAME
#define SUPPLY_VOLTAGE_MIN
#define CHIP_NAME
chip information definition
driver ttp229 header file
ttp229_active_t
ttp229 active enumeration definition
uint8_t ttp229_init(ttp229_handle_t *handle)
initialize the chip
struct ttp229_info_s ttp229_info_t
ttp229 information structure definition
ttp229_interface_t
ttp229 interface enumeration definition
uint8_t ttp229_set_active(ttp229_handle_t *handle, ttp229_active_t active_level)
set the active level
uint8_t ttp229_get_interface(ttp229_handle_t *handle, ttp229_interface_t *interface)
get the interface
uint8_t ttp229_deinit(ttp229_handle_t *handle)
close the chip
uint8_t ttp229_read_8_keys(ttp229_handle_t *handle, uint8_t keys[8])
read 8 keys
uint8_t ttp229_info(ttp229_info_t *info)
get chip's information
uint8_t ttp229_get_active(ttp229_handle_t *handle, ttp229_active_t *active_level)
get the active level
uint8_t ttp229_read_16_keys(ttp229_handle_t *handle, uint8_t keys[16])
read 16 keys
uint8_t ttp229_set_interface(ttp229_handle_t *handle, ttp229_interface_t interface)
set the interface
struct ttp229_handle_s ttp229_handle_t
ttp229 handle structure definition
uint8_t ttp229_get_reg(ttp229_handle_t *handle, uint8_t *buf, uint16_t len)
get the chip register
uint8_t(* spi_init)(void)
void(* delay_ms)(uint32_t ms)
uint8_t(* spi_read_cmd)(uint8_t *buf, uint16_t len)
void(* debug_print)(const char *const fmt,...)
uint8_t(* iic_init)(void)
uint8_t(* spi_deinit)(void)
uint8_t(* iic_read_cmd)(uint8_t addr, uint8_t *buf, uint16_t len)
uint8_t(* iic_deinit)(void)
float supply_voltage_max_v
char manufacturer_name[32]
float supply_voltage_min_v