123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382 |
- { \
- .channel_config = \
- { \
- .resistor_p = NRF_SAADC_RESISTOR_DISABLED, \
- .resistor_n = NRF_SAADC_RESISTOR_DISABLED, \
- .gain = NRF_SAADC_GAIN1_6, \
- .reference = NRF_SAADC_REFERENCE_INTERNAL, \
- .acq_time = NRF_SAADC_ACQTIME_10US, \
- .mode = NRF_SAADC_MODE_SINGLE_ENDED, \
- .burst = NRF_SAADC_BURST_DISABLED, \
- }, \
- .pin_p = (nrf_saadc_input_t)_pin_p, \
- .pin_n = NRF_SAADC_INPUT_DISABLED, \
- .channel_index = _index, \
- }
- { \
- .channel_config = \
- { \
- .resistor_p = NRF_SAADC_RESISTOR_DISABLED, \
- .resistor_n = NRF_SAADC_RESISTOR_DISABLED, \
- .gain = NRF_SAADC_GAIN1_6, \
- .reference = NRF_SAADC_REFERENCE_INTERNAL, \
- .acq_time = NRF_SAADC_ACQTIME_10US, \
- .mode = NRF_SAADC_MODE_DIFFERENTIAL, \
- .burst = NRF_SAADC_BURST_DISABLED, \
- }, \
- .pin_p = (nrf_saadc_input_t)_pin_p, \
- .pin_n = (nrf_saadc_input_t)_pin_n, \
- .channel_index = _index, \
- }
- { \
- .oversampling = NRF_SAADC_OVERSAMPLE_DISABLED, \
- .burst = NRF_SAADC_BURST_DISABLED, \
- .internal_timer_cc = 0, \
- .start_on_end = false, \
- }
- typedef struct
- {
- nrf_saadc_channel_config_t channel_config;
- nrf_saadc_input_t pin_p;
- nrf_saadc_input_t pin_n;
- uint8_t channel_index;
- } nrfx_saadc_channel_t;
- typedef struct
- {
- nrf_saadc_oversample_t oversampling;
- nrf_saadc_burst_t burst;
- uint16_t internal_timer_cc;
- bool start_on_end;
- } nrfx_saadc_adv_config_t;
- typedef enum
- {
- NRFX_SAADC_EVT_DONE,
- NRFX_SAADC_EVT_LIMIT,
- NRFX_SAADC_EVT_CALIBRATEDONE,
- NRFX_SAADC_EVT_BUF_REQ,
- NRFX_SAADC_EVT_READY,
- NRFX_SAADC_EVT_FINISHED,
- } nrfx_saadc_evt_type_t;
- typedef struct
- {
- nrf_saadc_value_t * p_buffer;
- uint16_t size;
- } nrfx_saadc_done_evt_t;
- typedef struct
- {
- uint8_t channel;
- nrf_saadc_limit_t limit_type;
- } nrfx_saadc_limit_evt_t;
- typedef struct
- {
- nrfx_saadc_evt_type_t type;
- union
- {
- nrfx_saadc_done_evt_t done;
- nrfx_saadc_limit_evt_t limit;
- } data;
- } nrfx_saadc_evt_t;
- typedef void (* nrfx_saadc_event_handler_t)(nrfx_saadc_evt_t const * p_event);
- nrfx_err_t nrfx_saadc_init(uint8_t interrupt_priority);
- void nrfx_saadc_uninit(void);
- nrfx_err_t nrfx_saadc_channels_config(nrfx_saadc_channel_t const * p_channels,
- uint32_t channel_count);
- nrfx_err_t nrfx_saadc_simple_mode_set(uint32_t channel_mask,
- nrf_saadc_resolution_t resolution,
- nrf_saadc_oversample_t oversampling,
- nrfx_saadc_event_handler_t event_handler);
- nrfx_err_t nrfx_saadc_advanced_mode_set(uint32_t channel_mask,
- nrf_saadc_resolution_t resolution,
- nrfx_saadc_adv_config_t const * p_config,
- nrfx_saadc_event_handler_t event_handler);
- nrfx_err_t nrfx_saadc_buffer_set(nrf_saadc_value_t * p_buffer, uint16_t size);
- nrfx_err_t nrfx_saadc_mode_trigger(void);
- void nrfx_saadc_abort(void);
- nrfx_err_t nrfx_saadc_limits_set(uint8_t channel, int16_t limit_low, int16_t limit_high);
- nrfx_err_t nrfx_saadc_offset_calibrate(nrfx_saadc_event_handler_t event_handler);
|