Lines Matching refs:obj

62     Cy_LPComp_Init((base), (channel), (config), &(obj->context))
65 Cy_LPComp_Enable((base), (channel), &(obj->context))
68 Cy_LPComp_Disable((base), (channel), &(obj->context))
71 Cy_LPComp_SetInterruptTriggerMode((base), (channel), (intType), &(obj->context))
154 static cyhal_comp_event_t _cyhal_comp_lp_get_enabled_events(cyhal_comp_t * obj) in _cyhal_comp_lp_get_enabled_events() argument
156 switch((cy_en_lpcomp_int_t)obj->irq_cause) in _cyhal_comp_lp_get_enabled_events()
196 cyhal_comp_t* obj = _cyhal_comp_lp_config_structs[(block * _CYHAL_COMP_PER_LP) + instance_num]; in _cyhal_comp_lp_irq_handler() local
197 if (NULL != obj) in _cyhal_comp_lp_irq_handler()
199 Cy_LPComp_ClearInterrupt(obj->base_lpcomp, (uint32_t) (1u << obj->resource.channel_num)); in _cyhal_comp_lp_irq_handler()
201 … cyhal_comp_event_callback_t callback = (cyhal_comp_event_callback_t)obj->callback_data.callback; in _cyhal_comp_lp_irq_handler()
204 cyhal_comp_event_t event = _cyhal_comp_lp_get_enabled_events(obj); in _cyhal_comp_lp_irq_handler()
205 callback(obj->callback_data.callback_arg, event); in _cyhal_comp_lp_irq_handler()
210 cy_rslt_t _cyhal_comp_lp_init_hw(cyhal_comp_t *obj, const cy_stc_lpcomp_config_t* cfg) in _cyhal_comp_lp_init_hw() argument
212 obj->base_lpcomp = _cyhal_lpcomp_base[obj->resource.block_num]; in _cyhal_comp_lp_init_hw()
213 …cy_rslt_t result = _cyhal_lpcomp_init(obj->base_lpcomp, _CYHAL_COMP_GET_CHANNEL(obj->resource.chan… in _cyhal_comp_lp_init_hw()
217 Cy_LPComp_SetInterruptMask(obj->base_lpcomp, (uint32_t) (1u << obj->resource.channel_num)); in _cyhal_comp_lp_init_hw()
220 _cyhal_lpcomp_enable(obj->base_lpcomp, _CYHAL_COMP_GET_CHANNEL(obj->resource.channel_num)); in _cyhal_comp_lp_init_hw()
222 …_cyhal_comp_lp_config_structs[(obj->resource.block_num * _CYHAL_COMP_PER_LP) + obj->resource.chann… in _cyhal_comp_lp_init_hw()
223 …_cyhal_irq_register(_cyhal_lp_comp_irq_n[obj->resource.block_num], CYHAL_ISR_PRIORITY_DEFAULT, _cy… in _cyhal_comp_lp_init_hw()
224 _cyhal_irq_enable(_cyhal_lp_comp_irq_n[obj->resource.block_num]); in _cyhal_comp_lp_init_hw()
229 cy_rslt_t _cyhal_comp_lp_init(cyhal_comp_t *obj, cyhal_gpio_t vin_p, cyhal_gpio_t vin_m, cyhal_gpio… in _cyhal_comp_lp_init() argument
231 CY_ASSERT(NULL != obj); in _cyhal_comp_lp_init()
235 memset(obj, 0, sizeof(cyhal_comp_t)); in _cyhal_comp_lp_init()
236 obj->irq_cause = 0; in _cyhal_comp_lp_init()
239 obj->pin_vin_p = NC; in _cyhal_comp_lp_init()
240 obj->pin_vin_m = NC; in _cyhal_comp_lp_init()
241 obj->pin_out = NC; in _cyhal_comp_lp_init()
243 obj->base_lpcomp = NULL; in _cyhal_comp_lp_init()
244 obj->resource.type = CYHAL_RSC_INVALID; in _cyhal_comp_lp_init()
281 obj->resource = rsc; in _cyhal_comp_lp_init()
287 obj->pin_vin_p = vin_p; in _cyhal_comp_lp_init()
293 obj->pin_vin_m = vin_m; in _cyhal_comp_lp_init()
302 obj->pin_out = output; in _cyhal_comp_lp_init()
317 result = _cyhal_comp_lp_init_hw(obj, &comp_lp_config); in _cyhal_comp_lp_init()
324 …Cy_LPComp_SetInputs(obj->base_lpcomp, _CYHAL_COMP_GET_CHANNEL(obj->resource.channel_num), CY_LPCOM… in _cyhal_comp_lp_init()
328 …Cy_LPComp_SetPower(obj->base_lpcomp, _CYHAL_COMP_GET_CHANNEL(obj->resource.channel_num), comp_lp_c… in _cyhal_comp_lp_init()
336 _cyhal_comp_lp_free(obj); in _cyhal_comp_lp_init()
341 cy_rslt_t _cyhal_comp_lp_init_cfg(cyhal_comp_t *obj, const cyhal_comp_configurator_t *cfg) in _cyhal_comp_lp_init_cfg() argument
343 cy_rslt_t result = _cyhal_comp_lp_init_hw(obj, cfg->lpcomp); in _cyhal_comp_lp_init_cfg()
346 _cyhal_comp_lp_free(obj); in _cyhal_comp_lp_init_cfg()
352 void _cyhal_comp_lp_free(cyhal_comp_t *obj) in _cyhal_comp_lp_free() argument
354 CY_ASSERT(NULL != obj); in _cyhal_comp_lp_free()
356 if(CYHAL_RSC_INVALID != obj->resource.type) in _cyhal_comp_lp_free()
358 …_cyhal_comp_lp_config_structs[(obj->resource.block_num * _CYHAL_COMP_PER_LP) + obj->resource.chann… in _cyhal_comp_lp_free()
361 uint8_t lpcomp_num = obj->resource.block_num; in _cyhal_comp_lp_free()
368 if(NULL != obj->base_lpcomp) in _cyhal_comp_lp_free()
370 … _cyhal_lpcomp_disable(obj->base_lpcomp, _CYHAL_COMP_GET_CHANNEL(obj->resource.channel_num)); in _cyhal_comp_lp_free()
372 if(false == obj->owned_by_configurator) in _cyhal_comp_lp_free()
374 cyhal_hwmgr_free(&(obj->resource)); in _cyhal_comp_lp_free()
376 obj->base_lpcomp = NULL; in _cyhal_comp_lp_free()
377 obj->resource.type = CYHAL_RSC_INVALID; in _cyhal_comp_lp_free()
380 _cyhal_utils_release_if_used(&(obj->pin_vin_p)); in _cyhal_comp_lp_free()
381 _cyhal_utils_release_if_used(&(obj->pin_vin_m)); in _cyhal_comp_lp_free()
382 _cyhal_utils_release_if_used(&(obj->pin_out)); in _cyhal_comp_lp_free()
385 cy_rslt_t _cyhal_comp_lp_configure(cyhal_comp_t *obj, cyhal_comp_config_t *cfg) in _cyhal_comp_lp_configure() argument
387 CY_ASSERT(NULL != obj); in _cyhal_comp_lp_configure()
390 result = _cyhal_comp_lp_set_power(obj, cfg->power); in _cyhal_comp_lp_configure()
393 …Cy_LPComp_SetHysteresis(obj->base_lpcomp, _CYHAL_COMP_GET_CHANNEL(obj->resource.channel_num), cfg-… in _cyhal_comp_lp_configure()
398 cy_rslt_t _cyhal_comp_lp_set_power(cyhal_comp_t *obj, cyhal_power_level_t power) in _cyhal_comp_lp_set_power() argument
400 CY_ASSERT(NULL != obj); in _cyhal_comp_lp_set_power()
405 …Cy_LPComp_SetPower(obj->base_lpcomp, _CYHAL_COMP_GET_CHANNEL(obj->resource.channel_num), power_lev… in _cyhal_comp_lp_set_power()
410 bool _cyhal_comp_lp_read(cyhal_comp_t *obj) in _cyhal_comp_lp_read() argument
412 CY_ASSERT(NULL != obj); in _cyhal_comp_lp_read()
413 …return (1UL == Cy_LPComp_GetCompare(obj->base_lpcomp, _CYHAL_COMP_GET_CHANNEL(obj->resource.channe… in _cyhal_comp_lp_read()
416 void _cyhal_comp_lp_enable_event(cyhal_comp_t *obj, cyhal_comp_event_t event, uint8_t intr_priority… in _cyhal_comp_lp_enable_event() argument
420 obj->irq_cause |= event; in _cyhal_comp_lp_enable_event()
424 obj->irq_cause &= (~event); in _cyhal_comp_lp_enable_event()
427 _cyhal_system_irq_t irqn = _cyhal_lp_comp_irq_n[obj->resource.block_num]; in _cyhal_comp_lp_enable_event()
430 …cy_en_lpcomp_int_t pdl_event = _cyhal_comp_lp_convert_hal_event((cyhal_comp_event_t)obj->irq_cause… in _cyhal_comp_lp_enable_event()
431 …_cyhal_lpcomp_setinterrupttriggermode(obj->base_lpcomp, _CYHAL_COMP_GET_CHANNEL(obj->resource.chan… in _cyhal_comp_lp_enable_event()