Blame view

RIOT/drivers/mrf24j40/include/mrf24j40_internal.h 3.36 KB
a752c7ab   elopes   add first test an...
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
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
  /*
   * Copyright (C) 2017 Neo Nenaco <neo@nenaco.de>
   * Copyright (C) 2017 Koen Zandberg <koen@bergzand.net>
   *
   * 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 drivers_mrf24j40
   * @{
   *
   * @file
   * @brief Internal interfaces for MRF24J40 drivers
   *
   * @author      Neo Nenaco <neo@nenaco.de>
   * @author      Koen Zandberg <koen@bergzand.net>
   */
  
  #ifndef MRF24J40_INTERNAL_H
  #define MRF24J40_INTERNAL_H
  
  #include <stdint.h>
  
  #include "mrf24j40.h"
  
  #ifdef __cplusplus
  extern "C" {
  #endif
  
  
  /**
   * @brief initialization as decribed in datasheet
   */
  void mrf24j40_init(mrf24j40_t *dev);
  
  /**
   * @brief Read from a register with a  at address `addr` from device `dev`. Register with 8bit address
   *
   * @param[in] dev device to read from
   * @param[in] addr address of the register to read
   *
   * @return the value of the specified register
   */
  uint8_t mrf24j40_reg_read_short(mrf24j40_t *dev, const uint8_t addr);
  
  /**
   * @brief Write to a register at address `addr` from device `dev`. Register with 8bit address
   *
   * @param[in] dev device to write to
   * @param[in] addr address of the register to write
   * @param[in] value value to write to the given register
   */
  void mrf24j40_reg_write_short(mrf24j40_t *dev, const uint8_t addr, const uint8_t value);
  
  /**
   * @brief Read from a register with a  at address `addr` from device `dev`. Register with 10bit address
   *
   * @param[in] dev device to read from
   * @param[in] addr address of the register to read
   *
   * @return the value of the specified register
   */
  uint8_t mrf24j40_reg_read_long(mrf24j40_t *dev, const uint16_t addr);
  
  /**
   * @brief Write to a register at address `addr` from device `dev`. Register with 10bit address
   *
   * @param[in] dev device to write to
   * @param[in] addr address of the register to write
   * @param[in] value value to write to the given register
   */
  void mrf24j40_reg_write_long(mrf24j40_t *dev, const uint16_t addr, const uint8_t value);
  
  /**
   * @brief   Write a chunk of data into the TX Normal FIFO area of the given device
   *
   * @param[in] dev       device to write to
   * @param[in] offset    address in the TX Normal FIFO to write to [valid 0x00-0x1ff]
   * @param[in] data      data to copy into FIFO
   * @param[in] len       number of bytes to write to FIFO
   */
  void mrf24j40_tx_normal_fifo_write(mrf24j40_t *dev, const uint16_t offset, const uint8_t *data, const size_t len);
  
  /**
   * @brief   Read a chunk of data from the RX_FIFO area of the given device
   *
   * @param[in]  dev      device to read from
   * @param[in]  offset   starting address to read from [valid 0x00-0x1ff]
   * @param[out] data     buffer to read data into
   * @param[in]  len      number of bytes to read from FIFO
   */
  void mrf24j40_rx_fifo_read(mrf24j40_t *dev, const uint16_t offset, uint8_t *data, const size_t len);
  
  /**
   * @brief   Reset the pending task list of a device
   *
   * @param[in] dev       device to reset tasks of
   */
  void mrf24j40_reset_tasks(mrf24j40_t *dev);
  
  /**
   * @brief   Check for pending interrupts and update task list
   *
   * @param[in] dev       device to read
   */
  void mrf24j40_update_tasks(mrf24j40_t *dev);
  
  /**
   * @brief   Trigger a hardware reset
   *
   * @param[in] dev       device to reset
   */
  void mrf24j40_hardware_reset(mrf24j40_t *dev);
  
  #ifdef __cplusplus
  }
  #endif
  
  #endif /* MRF24J40_INTERNAL_H */
  /** @} */