• Main Page
  • Modules
  • Index
  • File List
  • Globals

hal/nrf24le1/hal_ancmp.c

Go to the documentation of this file.
00001 /* Copyright (c) 2009 Nordic Semiconductor. All Rights Reserved.
00002  *
00003  * The information contained herein is confidential property of Nordic 
00004  * Semiconductor ASA.Terms and conditions of usage are described in detail 
00005  * in NORDIC SEMICONDUCTOR STANDARD SOFTWARE LICENSE AGREEMENT. 
00006  *
00007  * Licensees are granted free, non-transferable use of the information. NO
00008  * WARRENTY of ANY KIND is provided. This heading must NOT be removed from
00009  * the file.
00010  *              
00011  * $LastChangedRevision: 133 $
00012  */
00013 
00018 #include <stdint.h>
00019 #include <stdbool.h>
00020 
00021 #include "nrf24le1.h"
00022 #include "nordic_common.h"
00023 #include "hal_ancmp.h"
00024 
00025 void hal_ancmp_set_polarity(hal_ancmp_pol_t polarity)
00026 { // Update "polarity" bit
00027   COMPCON = (COMPCON & 0xEF) | (((uint8_t)polarity << 4) & ~0xEF);   
00028 }
00029 
00030 void hal_ancmp_set_ref_voltage_scale(hal_ancmp_ref_scale_t scale)
00031 { // Update "refscale" bits
00032   COMPCON = (COMPCON & 0xF3) | (((uint8_t)scale << 2) & ~0xF3);   
00033 }
00034 
00035 void hal_ancmp_set_reference(hal_ancmp_ref_t ref)
00036 { // Update "cmpref" bit
00037   COMPCON = (COMPCON & 0xFD) | (((uint8_t)ref << 1) & ~0xFD);   
00038 }
00039 
00040 void hal_ancmp_set_input_channel(hal_ancmp_input_channel_t chsel)
00041 { 
00042   hal_adc_input_channel_t channel;
00043   channel = (hal_adc_input_channel_t)chsel;
00044   hal_adc_set_input_channel(channel);       
00045 }
00046 
00047 void hal_ancmp_enable(bool en)
00048 {
00049   if(en)
00050   {
00051     COMPCON = COMPCON | BIT_0;                // Set "enable" bit
00052   }
00053   else
00054   {
00055     COMPCON = COMPCON & ~BIT_0;               // Clear "enable" bit
00056   }
00057 }

Generated on Fri Apr 20 2012 14:11:44 for nRFGo SDK by  doxygen 1.7.2