Skip to content

Commit f3f919e

Browse files
authored
Merge pull request #11830 from yarbcy/pr/dev-arm-issue-11746
Cypress: Add implementation of free() for gpio
2 parents 33e392e + e5d31c8 commit f3f919e

File tree

3 files changed

+17
-0
lines changed

3 files changed

+17
-0
lines changed

targets/TARGET_Cypress/TARGET_PSOC6/cy_analogin_api.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,12 @@ uint16_t analogin_read_u16(analogin_t *obj)
6060
return cyhal_adc_read_u16(&(obj->hal_adc_channel));
6161
}
6262

63+
void analogin_free(analogin_t *obj)
64+
{
65+
cyhal_adc_channel_free(&(obj->hal_adc_channel));
66+
cyhal_adc_free(obj->hal_adc);
67+
}
68+
6369
const PinMap *analogin_pinmap(void)
6470
{
6571
return PinMap_ADC;

targets/TARGET_Cypress/TARGET_PSOC6/cy_gpio_api.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,11 @@ void gpio_dir(gpio_t *obj, PinDirection direction)
8787
apply_config(obj);
8888
}
8989

90+
void gpio_free(gpio_t *obj)
91+
{
92+
cyhal_gpio_free(obj->pin);
93+
}
94+
9095
#ifdef __cplusplus
9196
}
9297
#endif

targets/TARGET_Cypress/TARGET_PSOC6/cy_i2c_api.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -281,6 +281,12 @@ void i2c_abort_asynch(i2c_t *obj)
281281
}
282282
}
283283

284+
void i2c_free(i2c_t *obj)
285+
{
286+
struct i2c_s *i2c = cy_get_i2c(obj);
287+
cyhal_i2c_free(&i2c->hal_i2c);
288+
}
289+
284290
#endif
285291

286292
#ifdef __cplusplus

0 commit comments

Comments
 (0)