AnalogIn for nRF51 Fixes

multiinstances was not suported for nrf51
made nrf_saadc SDK hal private for nRF52
pull/2234/head
Andrzej Puzdrowski 2016-06-29 12:29:38 +02:00
parent 44bef4100e
commit f19efb6a43
3 changed files with 11 additions and 1 deletions

View File

@ -53,7 +53,7 @@ void analogin_init(analogin_t *obj, PinName pin)
ret_code_t ret_code;
// p_config, event_handler
ret_code = nrf_drv_adc_init(NULL , NULL); // select blocking mode
MBED_ASSERT(ret_code == NRF_SUCCESS);
MBED_ASSERT((ret_code == NRF_SUCCESS) || (ret_code == NRF_ERROR_INVALID_STATE)); //NRF_ERROR_INVALID_STATE expected for multiple channels used.
}
uint16_t analogin_read_u16(analogin_t *obj)

View File

@ -10,6 +10,7 @@
*
*/
#ifdef NRF52
/**
* @file
* @brief SAADC HAL implementation
@ -29,3 +30,6 @@ void nrf_saadc_channel_init(uint8_t channel, nrf_saadc_channel_config_t const *
nrf_saadc_channel_input_set(channel, config->pin_p, config->pin_n);
return;
}
#endif //NRF52

View File

@ -14,6 +14,8 @@
#ifndef NRF_SAADC_H_
#define NRF_SAADC_H_
#ifdef NRF52
/**
* @defgroup nrf_saadc_hal SAADC HAL
* @{
@ -27,6 +29,8 @@
#include "nrf.h"
#include "nrf_assert.h"
#define NRF_SAADC_CHANNEL_COUNT 8
/**
@ -550,5 +554,7 @@ void nrf_saadc_channel_init(uint8_t channel, nrf_saadc_channel_config_t const *
/**
*@}
**/
#endif // NRF52
#endif /* NRF_SAADC_H_ */