Blame view

RIOT/cpu/nrf51/include/nrfmin.h 3.16 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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
  /*
   * Copyright (C) 2015 Freie Universitรคt Berlin
   *
   * 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.
   */
  
  /**
   * @defgroup        drivers_nrf51822_nrfmin NRF Minimal Radio Driver
   * @ingroup         drivers_netdev
   * @brief           Minimal driver for the NRF51822 radio
   *
   * This driver enables the use of the NRF51822 radio in a IEEE802.15.4 like
   * fashion. In the current state, the driver is only be meant to be used with
   * the netdev/netapi based network stack, while only being able to communicate
   * with other NRF51822 devices using the same driver.
   *
   * The driver is using a Nordic proprietary physical layer, configured to for a
   * bitrate of 2Mbit. The payload length is set to a maximum length of 250 byte.
   * The proprietary frame format used has the following format:
   *
   *    byte0 | byte1 - byte2 | byte3 - byte4 | byte5   byte6 | byte7 - byteN
   *   ------ | ------------- | ------------- | ------------- | -------------
   *   length |   src_addr    |   dst_addr    |    proto      |   payload...
   *
   * An IEEE802.15.4 like behavior is reflected in the following way: the driver
   * configures the radio device to use a fixed 5 byte addressing scheme. On this
   * addresses, the first byte is set to a constant value, the same for all
   * devices that use this driver. The next two bytes are set to the configured
   * PAN ID, hereby simulating the use of PAN IDs. The last two bytes are set to
   * a 16-bit short address, simulating IEEE802.15.4 short addresses.
   *
   * There is no support for EUIDs. Further there is no support for anything else
   * than IEEE802.15.4 data frames, so no PAN coordinators, etc.
   *
   * The driver supports:
   *   - short address (16-bit)
   *   - using CPU-ID for default address
   *   - address broadcast (broadcast address is ff:ff)
   *   - PAN IDs (0 to 0xffff), PAN ID broadcast is not supported
   *   - setting of channel (0 to 0x3f)
   *   - setting of TX power (+4dBm to -20dBm)
   *   - packet type labeling
   *   - setting device state (RX, SLEEP)
   *
   * @{
   *
   * @file
   * @brief           Interface definition for the nrfmin NRF51822 radio driver
   *
   * @author          Hauke Petersen <hauke.petersen@fu-berlin.de>
   */
  
  #ifndef NRFMIN_H_
  #define NRFMIN_H_
  
  #include "net/gnrc/netdev.h"
  
  #ifdef __cplusplus
  extern "C" {
  #endif
  
  /**
   * @brief   Default PAN ID used after initialization
   */
  #define NRFMIN_DEFAULT_PAN          (0x0550)
  
  /**
   * @brief   Default channel set after initialization
   */
  #define NRFMIN_DEFAULT_CHANNEL      (1U)                /* 2401MHz */
  
  /**
   * @brief   Default transmission power used
   */
  #define NRFMIN_DEFAULT_TXPOWER      (0)                 /* 0dBm */
  
  /**
   * @brief   Reference to the netdev driver interface
   */
  extern const gnrc_netdev_driver_t nrfmin_driver;
  
  /**
   * @brief   Initialize the NRF51822 radio
   *
   * The initialization uses static configuration values.
   *
   * @param[out] dev      pointer to the netdev device descriptor
   *
   * @return              0 on success
   * @return              -ENODEV if @p dev is invalid
   */
  int nrfmin_init(gnrc_netdev_t *dev);
  
  #ifdef __cplusplus
  }
  #endif
  
  #endif /* NRFMIN_H_ */
  /** @} */