Skip to content

Commit

Permalink
ports/psoc6: Updating pins in adcblock for multiple boards.
Browse files Browse the repository at this point in the history
Signed-off-by: NikhitaR-IFX <Nikhita.Rajasekhar@infineon.com>
  • Loading branch information
NikhitaR-IFX committed Oct 20, 2023
1 parent 387b77e commit fb24596
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 6 deletions.
15 changes: 13 additions & 2 deletions ports/psoc6/modules/machine/machine_adcblock.c
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,26 @@ 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)},
{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)}
}; // 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

Expand Down
5 changes: 2 additions & 3 deletions tests/psoc6/adc.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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)
1 change: 0 additions & 1 deletion tests/psoc6/adc.py.exp
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
Invalid ADC Pin
<ADC Pin=80, ADCBlock_id=0, sampling_time_ns=1000>
True
True

0 comments on commit fb24596

Please sign in to comment.