From 05604383d99a0f9b3438ca374804f9da8b8d057b Mon Sep 17 00:00:00 2001 From: NikhitaR-IFX Date: Fri, 20 Oct 2023 18:17:27 +0530 Subject: [PATCH] ports/psoc6: Updating pins in adcblock for multiple boards. Signed-off-by: NikhitaR-IFX --- ports/psoc6/modules/machine/machine_adcblock.c | 15 +++++++++++++-- tests/psoc6/adc.py | 5 ++--- tests/psoc6/adc.py.exp | 1 - 3 files changed, 15 insertions(+), 6 deletions(-) diff --git a/ports/psoc6/modules/machine/machine_adcblock.c b/ports/psoc6/modules/machine/machine_adcblock.c index 0b261c667125..520265225a05 100644 --- a/ports/psoc6/modules/machine/machine_adcblock.c +++ b/ports/psoc6/modules/machine/machine_adcblock.c @@ -11,6 +11,7 @@ extern void adc_obj_deinit(machine_adc_obj_t *adc); machine_adcblock_obj_t *adc_block[MAX_BLOCKS] = {NULL}; +#if defined(CY8C624ABZI_S2D44) const adc_block_channel_pin_map_t adc_block_pin_map[] = { {ADCBLOCK0, 0, CYHAL_GET_GPIO(CYHAL_PORT_10, 0)}, {ADCBLOCK0, 1, CYHAL_GET_GPIO(CYHAL_PORT_10, 1)}, @@ -18,8 +19,18 @@ const adc_block_channel_pin_map_t adc_block_pin_map[] = { {ADCBLOCK0, 3, CYHAL_GET_GPIO(CYHAL_PORT_10, 3)}, {ADCBLOCK0, 4, CYHAL_GET_GPIO(CYHAL_PORT_10, 4)}, {ADCBLOCK0, 5, CYHAL_GET_GPIO(CYHAL_PORT_10, 5)} -}; // will belong to only a particular bsp - +}; +#elif defined(CYBLE_416045_02_device) +const adc_block_channel_pin_map_t adc_block_pin_map[] = { + {ADCBLOCK0, 0, CYHAL_GET_GPIO(CYHAL_PORT_10, 0)}, + {ADCBLOCK0, 1, CYHAL_GET_GPIO(CYHAL_PORT_10, 1)}, + {ADCBLOCK0, 2, CYHAL_GET_GPIO(CYHAL_PORT_10, 2)}, + {ADCBLOCK0, 3, CYHAL_GET_GPIO(CYHAL_PORT_10, 3)}, + {ADCBLOCK0, 4, CYHAL_GET_GPIO(CYHAL_PORT_10, 4)}, + {ADCBLOCK0, 5, CYHAL_GET_GPIO(CYHAL_PORT_10, 5)}, + {ADCBLOCK0, 6, CYHAL_GET_GPIO(CYHAL_PORT_10, 6)} +}; +#endif /******************************************************************************/ // MicroPython bindings for machine.ADC diff --git a/tests/psoc6/adc.py b/tests/psoc6/adc.py index 24c4d4cc3a81..b13b6176ecac 100644 --- a/tests/psoc6/adc.py +++ b/tests/psoc6/adc.py @@ -11,8 +11,8 @@ adc_pin_name = "P10_0" adc_wrong_pin_name = "P13_7" elif "CY8CPROTO-063-BLE" in machine: - print("SKIP") - raise SystemExit + adc_pin_name = "P10_0" + adc_wrong_pin_name = "P13_7" # Exceptions should be raised try: @@ -21,7 +21,6 @@ print("Invalid ADC Pin") adc = ADC(adc_pin_name, sample_ns=1000) -print(adc) print(adc.read_u16() > 0) print(adc.read_uv() > 0) diff --git a/tests/psoc6/adc.py.exp b/tests/psoc6/adc.py.exp index acf3080c7150..8f47615cd743 100644 --- a/tests/psoc6/adc.py.exp +++ b/tests/psoc6/adc.py.exp @@ -1,4 +1,3 @@ Invalid ADC Pin - True True