Blame view

RIOT/boards/remote-pa/board.c 1.57 KB
fb11e647   vrobic   reseau statique a...
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
  /*
   * Copyright (C) 2014 Freie Universitรคt Berlin
   * Copyright (C) 2015 Zolertia SL
   *
   * This file is subject to the terms and conditions of the GNU Lesser General
   * Public License v2.1. See the file LICENSE in the top level directory for more
   * details.
   */
  
  /**
   * @ingroup     board_remote
   * @{
   *
   * @file
   * @brief       Board specific implementations for the Re-Mote board
   *
   * @author      Hauke Petersen <hauke.petersen@fu-berlin.de>
   *              Antonio Lignan <alinan@zolertia.com>
   *
   * @}
   */
  
  #include "board.h"
  #include "cpu.h"
  #include "fancy_leds.h"
  
  static inline void rf_switch_init(void);
  
  void board_init(void)
  {
      /* initialize the boards LEDs */
      gpio_init(LED0_PIN, GPIO_OUT);
      gpio_init(LED1_PIN, GPIO_OUT);
      gpio_init(LED2_PIN, GPIO_OUT);
  
      /* initialize the CPU */
      cpu_init();
  
      /* initialize the 2.4GHz RF switch */
      rf_switch_init();
  
      /* Shoot rainbows */
      LED_RAINBOW();
  }
  
  /**
   * @brief Initialize the 2.4GHz Radio Frequency SW-controlled Switch
   *
   * The Re-Mote features an on-board RF switch to programatically select to
   * enable either the internal ceramic antenna, or an external antenna over an
   * uFL connector.  As default we prefer to use the internal one.
   *
   */
  static void rf_switch_init(void)
  {
      /* set pins to be controlled by software */
      RF_SWITCH_PORT->AFSEL &= ~(1 << RF_SWITCH_PIN);
  
      /* configure pins as output */
      RF_SWITCH_PORT->DIR |= (1 << RF_SWITCH_PIN);
  
      /* configure io-mux for used pins */
      IOC->PC_OVER[RF_SWITCH_PIN] = IOC_OVERRIDE_OE;
  
      /* Set to default */
      RF_SWITCH_INTERNAL;
  }