Lines Matching refs:s_te_obj
105 static te_obj_t *s_te_obj = NULL; variable
146 TE_CHECK(s_te_obj == NULL, ESP_ERR_INVALID_STATE); in touch_element_install()
149 s_te_obj = (te_obj_t *)calloc(1, sizeof(te_obj_t)); in touch_element_install()
150 TE_CHECK(s_te_obj != NULL, ESP_ERR_NO_MEM); in touch_element_install()
153 …s_te_obj->global_config = (touch_elem_global_config_t *)calloc(1, sizeof(touch_elem_global_config_… in touch_element_install()
154 s_te_obj->mutex = xSemaphoreCreateMutex(); in touch_element_install()
155 TE_CHECK_GOTO(s_te_obj->global_config != NULL && s_te_obj->mutex != NULL, cleanup); in touch_element_install()
156 xSemaphoreTake(s_te_obj->mutex, portMAX_DELAY); in touch_element_install()
157 TE_CLS_METHODS_INITIALIZER(s_te_obj->object_methods, TE_CLS_TYPE_BUTTON, TE_CLS_TYPE_MAX); in touch_element_install()
164 xSemaphoreGive(s_te_obj->mutex); in touch_element_install()
167 xSemaphoreGive(s_te_obj->mutex); in touch_element_install()
171 TE_FREE_AND_NULL(s_te_obj->global_config); in touch_element_install()
172 if (s_te_obj->mutex != NULL) { in touch_element_install()
173 vSemaphoreDelete(s_te_obj->mutex); in touch_element_install()
175 TE_FREE_AND_NULL(s_te_obj); in touch_element_install()
181 TE_CHECK(s_te_obj != NULL, ESP_ERR_INVALID_STATE); in touch_element_start()
185 xSemaphoreTake(s_te_obj->mutex, portMAX_DELAY); in touch_element_start()
195 … s_te_obj->is_set_threshold = false; //Threshold configuration will be set on touch sense start in touch_element_start()
196 ret = esp_timer_start_periodic(s_te_obj->proc_timer, TE_PROCESSING_PERIOD(s_te_obj) * 1000); in touch_element_start()
208 xQueueReset(s_te_obj->event_msg_queue); in touch_element_start()
209 xQueueReset(s_te_obj->intr_msg_queue); in touch_element_start()
210 xSemaphoreGive(s_te_obj->mutex); in touch_element_start()
215 xSemaphoreGive(s_te_obj->mutex); in touch_element_start()
221 TE_CHECK(s_te_obj != NULL, ESP_ERR_INVALID_STATE); in touch_element_stop()
223 xSemaphoreTake(s_te_obj->mutex, portMAX_DELAY); in touch_element_stop()
232 ret = esp_timer_stop(s_te_obj->proc_timer); in touch_element_stop()
236 xSemaphoreGive(s_te_obj->mutex); in touch_element_stop()
244 xSemaphoreTake(s_te_obj->mutex, portMAX_DELAY); in touch_element_uninstall()
245 if (s_te_obj == NULL) { in touch_element_uninstall()
246 xSemaphoreGive(s_te_obj->mutex); in touch_element_uninstall()
254 ret = esp_timer_delete(s_te_obj->proc_timer); in touch_element_uninstall()
266 vQueueDelete(s_te_obj->event_msg_queue); in touch_element_uninstall()
267 vQueueDelete(s_te_obj->intr_msg_queue); in touch_element_uninstall()
268 xSemaphoreGive(s_te_obj->mutex); in touch_element_uninstall()
269 vSemaphoreDelete(s_te_obj->mutex); in touch_element_uninstall()
270 free(s_te_obj->global_config); in touch_element_uninstall()
271 s_te_obj->global_config = NULL; in touch_element_uninstall()
272 free(s_te_obj); in touch_element_uninstall()
273 s_te_obj = NULL; in touch_element_uninstall()
279 TE_CHECK(s_te_obj != NULL, ESP_ERR_INVALID_STATE); in touch_element_message_receive()
281 TE_CHECK(s_te_obj->event_msg_queue != NULL, ESP_ERR_INVALID_STATE); in touch_element_message_receive()
282 int ret = xQueueReceive(s_te_obj->event_msg_queue, element_message, ticks_to_wait); in touch_element_message_receive()
315 int ret = xQueueSend(s_te_obj->event_msg_queue, &te_message, 0); in te_event_give()
363 touch_pad_denoise_read_data(&s_te_obj->denoise_channel_raw); //Update de-noise signal in te_intr_cb()
368 xQueueSendFromISR(s_te_obj->intr_msg_queue, &te_intr_msg, &task_awoken); in te_intr_cb()
387 BaseType_t ret = xSemaphoreTake(s_te_obj->mutex, 0); in te_proc_timer_cb()
391 ret = xQueueReceive(s_te_obj->intr_msg_queue, &te_intr_msg, 0); in te_proc_timer_cb()
396 if (s_te_obj->is_set_threshold != true) { in te_proc_timer_cb()
397 s_te_obj->is_set_threshold = true; in te_proc_timer_cb()
402 te_waterproof_handle_t waterproof_handle = s_te_obj->waterproof_handle; in te_proc_timer_cb()
413 ESP_LOGD(TE_DEBUG_TAG, "read denoise channel %d", s_te_obj->denoise_channel_raw); in te_proc_timer_cb()
419 xSemaphoreGive(s_te_obj->mutex); in te_proc_timer_cb()
424 xSemaphoreTake(s_te_obj->mutex, portMAX_DELAY); in te_object_method_register()
425 TE_CLASS_ITEM(s_te_obj->object_methods, object_type, handle) = object_methods->handle; in te_object_method_register()
426 …TE_CLASS_ITEM(s_te_obj->object_methods, object_type, check_channel) = object_methods->check_channe… in te_object_method_register()
427 …TE_CLASS_ITEM(s_te_obj->object_methods, object_type, set_threshold) = object_methods->set_threshol… in te_object_method_register()
428 …TE_CLASS_ITEM(s_te_obj->object_methods, object_type, process_state) = object_methods->process_stat… in te_object_method_register()
429 … TE_CLASS_ITEM(s_te_obj->object_methods, object_type, update_state) = object_methods->update_state; in te_object_method_register()
430 xSemaphoreGive(s_te_obj->mutex); in te_object_method_register()
435 xSemaphoreTake(s_te_obj->mutex, portMAX_DELAY); in te_object_method_unregister()
436 TE_CLASS_ITEM(s_te_obj->object_methods, object_type, handle) = NULL; in te_object_method_unregister()
437 TE_CLASS_ITEM(s_te_obj->object_methods, object_type, check_channel) = NULL; in te_object_method_unregister()
438 TE_CLASS_ITEM(s_te_obj->object_methods, object_type, set_threshold) = NULL; in te_object_method_unregister()
439 TE_CLASS_ITEM(s_te_obj->object_methods, object_type, process_state) = NULL; in te_object_method_unregister()
440 TE_CLASS_ITEM(s_te_obj->object_methods, object_type, update_state) = NULL; in te_object_method_unregister()
441 xSemaphoreGive(s_te_obj->mutex); in te_object_method_unregister()
462 …if (TE_CLASS_FOREACH_CHECK_CHANNEL(s_te_obj->object_methods, TE_CLS_TYPE_BUTTON, TE_CLS_TYPE_MAX, … in te_object_check_channel()
480 TE_CLASS_FOREACH_SET_THRESHOLD(s_te_obj->object_methods, TE_CLS_TYPE_BUTTON, TE_CLS_TYPE_MAX); in te_object_set_threshold()
486 TE_CLASS_FOREACH_PROCESS_STATE(s_te_obj->object_methods, TE_CLS_TYPE_BUTTON, TE_CLS_TYPE_MAX); in te_object_process_state()
494 TE_CLASS_FOREACH_UPDATE_STATE(s_te_obj->object_methods, TE_CLS_TYPE_BUTTON, TE_CLS_TYPE_MAX, in te_object_update_state()
500 return (TE_PROCESSING_PERIOD(s_te_obj)); in te_get_timer_period()
540 return (s_te_obj != NULL); in te_system_check_state()
574 t0_raw = s_te_obj->denoise_channel_raw; in te_channel_get_equ_cap()
637 memcpy(&s_te_obj->global_config->hardware, hardware_init, sizeof(touch_elem_hw_config_t)); in te_hw_init()
649 … s_te_obj->intr_msg_queue = xQueueCreate(software_init->intr_message_size, sizeof(te_intr_msg_t)); in te_sw_init()
650 …s_te_obj->event_msg_queue = xQueueCreate(software_init->event_message_size, sizeof(touch_elem_mess… in te_sw_init()
651 TE_CHECK_GOTO(s_te_obj->event_msg_queue != NULL && s_te_obj->intr_msg_queue != NULL, cleanup); in te_sw_init()
658 ret = esp_timer_create(&te_proc_timer_args, &s_te_obj->proc_timer); in te_sw_init()
660 memcpy(&s_te_obj->global_config->software, software_init, sizeof(touch_elem_sw_config_t)); in te_sw_init()
664 if (s_te_obj->event_msg_queue != NULL) { in te_sw_init()
665 vQueueDelete(s_te_obj->event_msg_queue); in te_sw_init()
667 if (s_te_obj->intr_msg_queue != NULL) { in te_sw_init()
668 vQueueDelete(s_te_obj->intr_msg_queue); in te_sw_init()
676 TE_CHECK(s_te_obj != NULL, ESP_ERR_INVALID_STATE); in touch_element_waterproof_install()
698 TE_WATERPROOF_DIVIDER(s_te_obj)); in touch_element_waterproof_install()
716 s_te_obj->waterproof_handle = waterproof_handle; //Fixme: add mutex in touch_element_waterproof_install()
728 TE_CHECK(s_te_obj->waterproof_handle != NULL, ESP_ERR_INVALID_STATE); in touch_element_waterproof_add()
729 TE_CHECK(s_te_obj->waterproof_handle->guard_device != NULL, ESP_ERR_INVALID_STATE); in touch_element_waterproof_add()
731 te_waterproof_handle_t waterproof_handle = s_te_obj->waterproof_handle; in touch_element_waterproof_add()
732 xSemaphoreTake(s_te_obj->mutex, portMAX_DELAY); in touch_element_waterproof_add()
739 xSemaphoreGive(s_te_obj->mutex); in touch_element_waterproof_add()
745 TE_CHECK(s_te_obj->waterproof_handle != NULL, ESP_ERR_INVALID_STATE); in touch_element_waterproof_remove()
748 te_waterproof_handle_t waterproof_handle = s_te_obj->waterproof_handle; in touch_element_waterproof_remove()
749 xSemaphoreTake(s_te_obj->mutex, portMAX_DELAY); in touch_element_waterproof_remove()
757 xSemaphoreGive(s_te_obj->mutex); in touch_element_waterproof_remove()
763 xSemaphoreTake(s_te_obj->mutex, portMAX_DELAY); in touch_element_waterproof_uninstall()
765 free(s_te_obj->waterproof_handle->guard_device); in touch_element_waterproof_uninstall()
766 free(s_te_obj->waterproof_handle->mask_handle); in touch_element_waterproof_uninstall()
767 free(s_te_obj->waterproof_handle); in touch_element_waterproof_uninstall()
768 s_te_obj->waterproof_handle = NULL; in touch_element_waterproof_uninstall()
769 xSemaphoreGive(s_te_obj->mutex); in touch_element_waterproof_uninstall()
794 return (s_te_obj->waterproof_handle != NULL); in waterproof_check_state()
807 …if (s_te_obj->waterproof_handle->guard_device == NULL || s_te_obj->waterproof_handle->mask_handle … in waterproof_guard_check_state()
818 te_waterproof_handle_t waterproof_handle = s_te_obj->waterproof_handle; in waterproof_channel_check()
844 te_dev_set_threshold(s_te_obj->waterproof_handle->guard_device); in waterproof_guard_set_threshold()
864 te_waterproof_handle_t waterproof_handle = s_te_obj->waterproof_handle; in waterproof_check_mask_handle()
881 te_dev_t *guard_device = s_te_obj->waterproof_handle->guard_device; in waterproof_guard_update_state()