Lines Matching refs:obj
83 cy_rslt_t _cyhal_opamp_init_hw(cyhal_opamp_t *obj, const cy_stc_ctb_opamp_config_t* cfg) in _cyhal_opamp_init_hw() argument
85 obj->base = _cyhal_ctb_base[obj->resource.block_num]; in _cyhal_opamp_init_hw()
86 …cy_rslt_t result = Cy_CTB_OpampInit(obj->base, _cyhal_opamp_convert_sel(obj->resource.channel_num)… in _cyhal_opamp_init_hw()
89 obj->is_init_success = true; in _cyhal_opamp_init_hw()
91 cyhal_analog_ctb_init(obj->base); in _cyhal_opamp_init_hw()
96 cy_rslt_t cyhal_opamp_init(cyhal_opamp_t *obj, cyhal_gpio_t vin_p, cyhal_gpio_t vin_m, cyhal_gpio_t… in cyhal_opamp_init() argument
99 CY_ASSERT(NULL != obj); in cyhal_opamp_init()
103 memset(obj, 0, sizeof(cyhal_opamp_t)); in cyhal_opamp_init()
104 obj->base = NULL; in cyhal_opamp_init()
105 obj->resource.type = CYHAL_RSC_INVALID; in cyhal_opamp_init()
106 obj->is_init_success = false; in cyhal_opamp_init()
117 …result = _cyhal_opamp_init_common(&(obj->resource), CYHAL_OPAMP_RSLT_BAD_ARGUMENT, vin_p, vin_m, v… in cyhal_opamp_init()
124 obj->pin_vin_p = vin_p; in cyhal_opamp_init()
125 obj->pin_vin_m = vin_m; in cyhal_opamp_init()
126 obj->pin_vout = vout; in cyhal_opamp_init()
128 result = _cyhal_opamp_init_hw(obj, &_cyhal_opamp_default_config); in cyhal_opamp_init()
134 …Cy_CTB_SetAnalogSwitch(obj->base, _cyhal_opamp_convert_switch(obj->resource.channel_num), _cyhal_o… in cyhal_opamp_init()
135 _cyhal_opamp_set_isolation_switch(obj->resource.channel_num, obj->base, true); in cyhal_opamp_init()
141 cyhal_opamp_free(obj); in cyhal_opamp_init()
146 cy_rslt_t cyhal_opamp_init_cfg(cyhal_opamp_t *obj, const cyhal_opamp_configurator_t *cfg) in cyhal_opamp_init_cfg() argument
148 memset(obj, 0, sizeof(cyhal_opamp_t)); in cyhal_opamp_init_cfg()
149 obj->owned_by_configurator = true; in cyhal_opamp_init_cfg()
150 obj->resource = *cfg->resource; in cyhal_opamp_init_cfg()
151 obj->is_init_success = false; in cyhal_opamp_init_cfg()
152 obj->pin_vin_p = NC; in cyhal_opamp_init_cfg()
153 obj->pin_vin_m = NC; in cyhal_opamp_init_cfg()
154 obj->pin_vout = NC; in cyhal_opamp_init_cfg()
155 cy_rslt_t result = _cyhal_opamp_init_hw(obj, cfg->config); in cyhal_opamp_init_cfg()
158 cyhal_opamp_free(obj); in cyhal_opamp_init_cfg()
164 cy_rslt_t cyhal_opamp_set_power(cyhal_opamp_t *obj, cyhal_power_level_t power) in cyhal_opamp_set_power() argument
169 …Cy_CTB_SetPower(obj->base, _cyhal_opamp_convert_sel(obj->resource.channel_num), power_level, _CYHA… in cyhal_opamp_set_power()
174 void cyhal_opamp_free(cyhal_opamp_t *obj) in cyhal_opamp_free() argument
176 if (NULL != obj && NULL != obj->base) in cyhal_opamp_free()
178 if (obj->is_init_success) in cyhal_opamp_free()
180 cyhal_opamp_set_power(obj, CYHAL_POWER_LEVEL_OFF); in cyhal_opamp_free()
181 if(false == obj->owned_by_configurator) in cyhal_opamp_free()
183 …obj->base, _cyhal_opamp_convert_switch(obj->resource.channel_num), _cyhal_opamp_pin_to_mask(obj->r… in cyhal_opamp_free()
184 _cyhal_opamp_set_isolation_switch(obj->resource.channel_num, obj->base, false); in cyhal_opamp_free()
186 cyhal_analog_ctb_free(obj->base); in cyhal_opamp_free()
190 if((NULL != obj) && (CYHAL_RSC_INVALID != obj->resource.type)) in cyhal_opamp_free()
192 if(false == obj->owned_by_configurator) in cyhal_opamp_free()
194 cyhal_hwmgr_free(&obj->resource); in cyhal_opamp_free()
196 obj->base = NULL; in cyhal_opamp_free()
197 obj->resource.type = CYHAL_RSC_INVALID; in cyhal_opamp_free()
200 if(NULL != obj) in cyhal_opamp_free()
202 _cyhal_utils_release_if_used(&(obj->pin_vin_p)); in cyhal_opamp_free()
203 _cyhal_utils_release_if_used(&(obj->pin_vout)); in cyhal_opamp_free()
204 _cyhal_utils_release_if_used(&(obj->pin_vin_m)); in cyhal_opamp_free()