Intelligent Systems / mbed-src

Fork of mbed-src by mbed official

Revision:
227:7bd0639b8911
Parent:
217:d0ccc61c1fd4
--- a/targets/hal/TARGET_NORDIC/TARGET_NRF51822/analogin_api.c	Wed Jun 11 09:45:09 2014 +0100
+++ b/targets/hal/TARGET_NORDIC/TARGET_NRF51822/analogin_api.c	Wed Jun 11 16:00:09 2014 +0100
@@ -13,10 +13,10 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
+#include "mbed_assert.h"
 #include "analogin_api.h"
 #include "cmsis.h"
 #include "pinmap.h"
-#include "error.h"
 
 #define ANALOGIN_MEDIAN_FILTER      1
 #define ADC_10BIT_RANGE             0x3FF
@@ -37,9 +37,7 @@
     const PinMap *map = PinMap_ADC;
     
     obj->adc = (ADCName)pinmap_peripheral(pin, PinMap_ADC); //(NRF_ADC_Type *)
-    if (obj->adc == (ADCName)NC) {
-        error("ADC pin mapping failed");
-    }
+    MBED_ASSERT(obj->adc != (ADCName)NC);
         
     while (map->pin != NC) {
         if (map->pin == pin){
@@ -50,12 +48,12 @@
     }
     obj->adc_pin = (uint8_t)analogInputPin;
     
-    NRF_ADC->ENABLE = ADC_ENABLE_ENABLE_Enabled; 
+    NRF_ADC->ENABLE = ADC_ENABLE_ENABLE_Enabled;
     NRF_ADC->CONFIG = (ADC_CONFIG_RES_10bit << ADC_CONFIG_RES_Pos) |
                       (ADC_CONFIG_INPSEL_AnalogInputOneThirdPrescaling<< ADC_CONFIG_INPSEL_Pos) |
                       (ADC_CONFIG_REFSEL_SupplyOneThirdPrescaling << ADC_CONFIG_REFSEL_Pos) |
                       (analogInputPin << ADC_CONFIG_PSEL_Pos) |
-                      (ADC_CONFIG_EXTREFSEL_None << ADC_CONFIG_EXTREFSEL_Pos);    
+                      (ADC_CONFIG_EXTREFSEL_None << ADC_CONFIG_EXTREFSEL_Pos);
 }
 
 uint16_t analogin_read_u16(analogin_t *obj) {