mirror of https://github.com/ARMmbed/mbed-os.git
AnalogIn for nRF51 Fixes
multiinstances was not suported for nrf51 made nrf_saadc SDK hal private for nRF52pull/2234/head
parent
44bef4100e
commit
f19efb6a43
|
@ -53,7 +53,7 @@ void analogin_init(analogin_t *obj, PinName pin)
|
||||||
ret_code_t ret_code;
|
ret_code_t ret_code;
|
||||||
// p_config, event_handler
|
// p_config, event_handler
|
||||||
ret_code = nrf_drv_adc_init(NULL , NULL); // select blocking mode
|
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)
|
uint16_t analogin_read_u16(analogin_t *obj)
|
||||||
|
|
|
@ -10,6 +10,7 @@
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#ifdef NRF52
|
||||||
/**
|
/**
|
||||||
* @file
|
* @file
|
||||||
* @brief SAADC HAL implementation
|
* @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);
|
nrf_saadc_channel_input_set(channel, config->pin_p, config->pin_n);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endif //NRF52
|
||||||
|
|
||||||
|
|
|
@ -14,6 +14,8 @@
|
||||||
#ifndef NRF_SAADC_H_
|
#ifndef NRF_SAADC_H_
|
||||||
#define NRF_SAADC_H_
|
#define NRF_SAADC_H_
|
||||||
|
|
||||||
|
#ifdef NRF52
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @defgroup nrf_saadc_hal SAADC HAL
|
* @defgroup nrf_saadc_hal SAADC HAL
|
||||||
* @{
|
* @{
|
||||||
|
@ -27,6 +29,8 @@
|
||||||
#include "nrf.h"
|
#include "nrf.h"
|
||||||
#include "nrf_assert.h"
|
#include "nrf_assert.h"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#define NRF_SAADC_CHANNEL_COUNT 8
|
#define NRF_SAADC_CHANNEL_COUNT 8
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -551,4 +555,6 @@ void nrf_saadc_channel_init(uint8_t channel, nrf_saadc_channel_config_t const *
|
||||||
*@}
|
*@}
|
||||||
**/
|
**/
|
||||||
|
|
||||||
|
#endif // NRF52
|
||||||
|
|
||||||
#endif /* NRF_SAADC_H_ */
|
#endif /* NRF_SAADC_H_ */
|
||||||
|
|
Loading…
Reference in New Issue