* arch/arm/src/nrf53/nrf53_adc.h
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership. The
* ASF licenses this file to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance with the
* License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations
* under the License.
*
****************************************************************************/
#ifndef __ARCH_ARM_SRC_NRF53_NRF53_ADC_H
#define __ARCH_ARM_SRC_NRF53_NRF53_ADC_H
* Included Files
****************************************************************************/
#include <nuttx/config.h>
#include "chip.h"
#include <nuttx/analog/adc.h>
* Pre-processor Definitions
****************************************************************************/
* Public Types
****************************************************************************/
enum nrf53_adc_ain_e
{
NRF53_ADC_IN_NC = 0,
NRF53_ADC_IN_IN0 = 1,
NRF53_ADC_IN_IN1 = 2,
NRF53_ADC_IN_IN2 = 3,
NRF53_ADC_IN_IN3 = 4,
NRF53_ADC_IN_IN4 = 5,
NRF53_ADC_IN_IN5 = 6,
NRF53_ADC_IN_IN6 = 7,
NRF53_ADC_IN_IN7 = 8,
NRF53_ADC_IN_VDD = 9,
NRF53_ADC_IN_VDDHDIV5 = 10,
};
enum nrf53_adc_res_e
{
NRF53_ADC_RES_BYPASS = 0,
NRF53_ADC_RES_PULLDOWN = 1,
NRF53_ADC_RES_PULLUP = 2,
NRF53_ADC_RES_VDD_2 = 3
};
enum nrf53_adc_gain_e
{
NRF53_ADC_GAIN_1_6 = 0,
NRF53_ADC_GAIN_1_5 = 1,
NRF53_ADC_GAIN_1_4 = 2,
NRF53_ADC_GAIN_1_3 = 3,
NRF53_ADC_GAIN_1_2 = 4,
NRF53_ADC_GAIN_1 = 5,
NRF53_ADC_GAIN_2 = 6,
NRF53_ADC_GAIN_4 = 7
};
enum nrf53_adc_refsel_e
{
NRF53_ADC_REFSEL_INTERNAL = 0,
NRF53_ADC_REFSEL_VDD_4 = 1
};
enum nrf53_adc_tacq_e
{
NRF53_ADC_TACQ_3US = 0,
NRF53_ADC_TACQ_5US = 1,
NRF53_ADC_TACQ_10US = 2,
NRF53_ADC_TACQ_15US = 3,
NRF53_ADC_TACQ_20US = 4,
NRF53_ADC_TACQ_40US = 5
};
enum nrf53_adc_mode_e
{
NRF53_ADC_MODE_SE = 0,
NRF53_ADC_MODE_DIFF = 1
};
enum nrf53_adc_burst_e
{
NRF53_ADC_BURST_DISABLE = 0,
NRF53_ADC_BURST_ENABLE = 1
};
struct nrf53_adc_channel_s
{
uint32_t p_psel;
uint32_t n_psel;
#ifdef CONFIG_NRF53_SAADC_LIMITS
uint16_t limith;
uint16_t limitl;
#endif
uint8_t resp:2;
uint8_t resn:2;
uint8_t gain:3;
uint8_t refsel:1;
uint8_t tacq:3;
uint8_t mode:1;
uint8_t burst:1;
uint8_t _res:3;
};
* Public Function Prototypes
****************************************************************************/
* Name: nrf53_adcinitialize
*
* Description:
* Initialize the ADC. See nrf53_adc.c for more details.
*
* Input Parameters:
* chanlist - channels configuration
* nchannels - number of channels
*
* Returned Value:
* Valid ADC device structure reference on success; a NULL on failure
*
****************************************************************************/
struct adc_dev_s *nrf53_adcinitialize(
const struct nrf53_adc_channel_s *chan,
int channels);
#endif