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

gazell/nrf24le1/gzll_mcu.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: 2685 $
00012  */
00013 
00018 #include "gzll.h"
00019 #include "hal_clk.h"
00020 #include "hal_rtc.h"
00021 
00022 void mcu_init(void)
00023 {  
00024   hal_clklf_set_source(HAL_CLKLF_XOSC16M_SYNTH);    // Synthesize 32 KHz from 16 MHz clock  
00025   hal_rtc_set_compare_mode(HAL_RTC_COMPARE_MODE_0); // Use 32 KHz timer mode 0
00026   hal_clk_regret_xosc16m_on(true);                  // Keep XOSC16M on in register retention
00027   while (hal_clk_get_16m_source() != HAL_CLK_XOSC16M) {}
00028 }
00029 
00030 void gzll_set_timer_period(uint16_t period)
00031 {
00032   hal_rtc_start(false);                             
00033   hal_rtc_start(true);                              // Start/stop to reset counter  
00034 
00035   period = (int)((float)period * 32768 / 1000000 + 0.5);
00036 
00037   hal_rtc_set_compare_value(period - 1);
00038 }

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