summaryrefslogtreecommitdiff
path: root/digital/zigbit/bitcloud/stack/Components/HAL/avr/atmega1281/common/src/halInit.c
blob: 593e62578d9c49020c4959f42835231a3db0384d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
/**************************************************************************//**
  \file  halInit.c

  \brief HAL start up module.

  \author
      Atmel Corporation: http://www.atmel.com \n
      Support email: avr@atmel.com

    Copyright (c) 2008-2011, Atmel Corporation. All rights reserved.
    Licensed under Atmel's Limited License Agreement (BitCloudTM).

  \internal
    History:
      29/06/07 E. Ivanov - Created
 ******************************************************************************/
/******************************************************************************
 *   WARNING: CHANGING THIS FILE MAY AFFECT CORE FUNCTIONALITY OF THE STACK.  *
 *   EXPERT USERS SHOULD PROCEED WITH CAUTION.                                *
 ******************************************************************************/

/******************************************************************************
                   Includes section
******************************************************************************/
#include <halAppClock.h>
#include <halSleepTimerClock.h>
#include <halRfSpi.h>
#include <halIrq.h>
#include <halInterrupt.h>

/******************************************************************************
                   Prototypes section
******************************************************************************/
/******************************************************************************
 Reads uid from external devices.
******************************************************************************/
void halReadUid(void);

/******************************************************************************
                   Implementations section
******************************************************************************/
/******************************************************************************
Performs start up HAL initialization.
Parameters:
  none.
Returns:
  none.
******************************************************************************/
void HAL_Init(void)
{
   /* Init first diagnostic timer */
#ifdef MEASURE
  TCCR5B = (1 << CS50);
#endif

  HAL_InitRfSpi();
  /* start sleep time */
  halStartSleepTimerClock();
  /* initialization work frequency &
   *  start calibration */
  halInitFreq();
  /* Reads unique ID */
  halReadUid();
  /* initialization and start application timer */
  halInitAppClock();
  /* initialization dtr interrupt */
  halSetIrqConfig(IRQ_4, IRQ_LOW_LEVEL);
  /* global enable interrupt*/
  HAL_EnableInterrupts();
}
// eof halInit.c