Skip to content

Commit f4c1869

Browse files
committed
[nrf fromtree] drivers: adc: Update adc driver to support nRF54L15 device
Expands driver to cover nRF54L15 features like AIN as GPIO configuration, new reference voltage, different set of supported gain options. Signed-off-by: Karol Lasończyk <[email protected]> (cherry picked from commit 5f1fdc4)
1 parent 2c2f60d commit f4c1869

File tree

1 file changed

+12
-3
lines changed

1 file changed

+12
-3
lines changed

drivers/adc/adc_nrfx_saadc.c

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -279,9 +279,18 @@ static void adc_context_update_buffer_pointer(struct adc_context *ctx,
279279
ARG_UNUSED(ctx);
280280

281281
if (!repeat) {
282-
nrf_saadc_value_t *buffer =
283-
(uint8_t *)nrf_saadc_buffer_pointer_get(NRF_SAADC) +
284-
samples_to_bytes(&ctx->sequence, nrfy_saadc_amount_get(NRF_SAADC));
282+
nrf_saadc_value_t *buffer;
283+
284+
#if (NRF_SAADC_8BIT_SAMPLE_WIDTH == 8)
285+
if (nrfy_saadc_resolution_get(NRF_SAADC) == NRF_SAADC_RESOLUTION_8BIT) {
286+
buffer = (uint8_t *)nrfy_saadc_buffer_pointer_get(NRF_SAADC) +
287+
nrfy_saadc_amount_get(NRF_SAADC);
288+
} else
289+
#endif
290+
{
291+
buffer = (uint16_t *)nrfy_saadc_buffer_pointer_get(NRF_SAADC) +
292+
nrfy_saadc_amount_get(NRF_SAADC);
293+
}
285294

286295
nrfy_saadc_buffer_pointer_set(NRF_SAADC, buffer);
287296
}

0 commit comments

Comments
 (0)