LT8900 Arduino Library
LT8900.h
1 /*
2  Copyright (C) 2015 Rob van der Veer, <rob.c.veer@gmail.com>
3 
4  This program is free software; you can redistribute it and/or
5  modify it under the terms of the GNU General Public License
6  version 2 as published by the Free Software Foundation.
7  */
8 
9 #ifndef LT8900_H
10 #define LT8900_H
11 
12 class LT8900
13 {
14 
15  public:
20  enum DataRate
21  {
22  LT8900_1MBPS,
26  };
27 
28  private:
29  uint8_t _pin_chipselect;
30  uint8_t _pin_pktflag;
31  uint8_t _pin_reset;
32  uint8_t _channel;
33  bool _isLT8910;
34 
35  public:
41  LT8900(const uint8_t cs, const uint8_t pkt, const uint8_t rst);
42 
44  void begin();
45 
49  void setChannel(uint8_t channel);
51  uint8_t getChannel();
52 
57  void setCurrentControl(uint8_t power, uint8_t gain);
58 
63  bool setDataRate(DataRate rate);
64 
69 
73  uint16_t readRegister(uint8_t reg);
74 
78  uint8_t writeRegister(uint8_t reg, uint16_t data);
79 
85  uint8_t writeRegister2(uint8_t reg, uint8_t high, uint8_t low);
86 
90  void sleep();
91 
95  void whatsUp(Stream &stream);
96 
98  bool available();
99 
105  bool getIs8910();
106 
112  int read(uint8_t *buffer, size_t maxBuffer);
113 
115  void startListening();
116 
120  void setClock(uint8_t clock);
121 
128  bool sendPacket(uint8_t *data, size_t packetSize);
129 
134  void setSyncWord(uint64_t syncWord);
135 
141  void setSyncWordLength(uint8_t length);
142 
149  void scanRSSI(uint16_t *buffer, uint8_t start_channel, uint8_t num_channels);
150 
152  uint8_t getRSSI();
153 };
154 
155 
156 #endif //LT8900_H
uint16_t readRegister(uint8_t reg)
Definition: LT8900.cpp:207
Definition: LT8900.h:24
void setChannel(uint8_t channel)
Definition: LT8900.cpp:140
void sleep()
Definition: LT8900.cpp:249
bool getIs8910()
Definition: LT8900.cpp:151
DataRate
Definition: LT8900.h:20
DataRate getDataRate()
Definition: LT8900.cpp:191
uint8_t getChannel()
Definition: LT8900.cpp:146
bool available()
Definition: LT8900.cpp:292
void scanRSSI(uint16_t *buffer, uint8_t start_channel, uint8_t num_channels)
Definition: LT8900.cpp:415
int read(uint8_t *buffer, size_t maxBuffer)
Definition: LT8900.cpp:304
void startListening()
Definition: LT8900.cpp:337
bool setDataRate(DataRate rate)
Definition: LT8900.cpp:163
uint8_t getRSSI()
Definition: LT8900.cpp:407
void whatsUp(Stream &stream)
Definition: LT8900.cpp:255
Definition: LT8900.h:23
Definition: LT8900.h:12
void setSyncWordLength(uint8_t length)
Definition: LT8900.cpp:399
LT8900(const uint8_t cs, const uint8_t pkt, const uint8_t rst)
Definition: LT8900.cpp:56
uint8_t writeRegister2(uint8_t reg, uint8_t high, uint8_t low)
Definition: LT8900.cpp:231
void begin()
Definition: LT8900.cpp:70
void setCurrentControl(uint8_t power, uint8_t gain)
Definition: LT8900.cpp:156
void setSyncWord(uint64_t syncWord)
Definition: LT8900.cpp:391
void setClock(uint8_t clock)
Definition: LT8900.cpp:347
bool sendPacket(uint8_t *data, size_t packetSize)
Definition: LT8900.cpp:357
uint8_t writeRegister(uint8_t reg, uint16_t data)
Definition: LT8900.cpp:223
Definition: LT8900.h:25