You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardexpand all lines: README.md
+47-41
Original file line number
Diff line number
Diff line change
@@ -18,7 +18,10 @@ If the module lays with the antenna connectors to the top, on the lower connecti
18
18
+ GDO0 (unused)
19
19
+ CS (or CSN)
20
20
21
-
The modules usually support voltages from 1.8V to 3.6V, so please use a level converter when connecting to a 5V CPU board. Also, be careful when soldering the connections, I have grilled several **CC1101** modules...
21
+
> [!IMPORTANT]
22
+
> The modules usually support voltages from 1.8V to 3.6V, so please use a level converter when connecting to a 5V CPU board.
23
+
24
+
Also, be careful when soldering the connections, I have grilled several **CC1101** modules...
22
25
23
26
### Processor boards
24
27
**Arduino Pro Mini (ATMega328p)**
@@ -45,10 +48,12 @@ The modules usually support voltages from 1.8V to 3.6V, so please use a level co
45
48
+ COPI 11
46
49
+ CS 10
47
50
48
-
For ESP32 and (to a limited extent) ESP8266 support custom SPI pinout. These differnt configurations need to be hardcoded in the library though. Later versions may support user-specified SPI configurations.
51
+
52
+
> [!NOTE]
53
+
> ESP32 and (to a limited extent) ESP8266 support custom SPI pinout. If, for some reason, you need a custom pin configurations, you have to edit the [library header file](src/SmartCC1101.h) directly for the time being. Later versions may support user-specified SPI configurations.
49
54
50
55
## Programming
51
-
The following code implements a simple sender and is available in the examples folder.
56
+
The following code implements a simple [sender](./examples/Sender/Sender.ino) and is available in the [examples folder](./examples/).
52
57
53
58
The settings are not limited to the `setup()` and may be changed anytime in the `loop()` if needed.
54
59
@@ -68,10 +73,10 @@ void setup() {
68
73
delay(20000);
69
74
}
70
75
71
-
SmartCC1101.setSymbolRate(100000); // Set the Data Rate in Baud. Value from 20 to 1621830 Default is 115051 Baud
SmartCC1101.setWhiteData(true); // Turn data whitening on / off. false = Whitening off (default). true = Whitening on.
111
-
SmartCC1101.setCRCCheck(true); // true = CRC calculation in TX and CRC check in RX enabled. false = CRC disabled for TX and RX (default).
112
+
SmartCC1101.setRXBandWitdth(SmartCC1101::bw_812kHz); // Set the Receive Bandwidth to 812 kHz
113
+
SmartCC1101.setSymbolRate(100000); // Set the Data Rate to 10 kBaud
114
+
SmartCC1101.setManchester(true); // Enables Manchester encoding/decoding.
115
+
SmartCC1101.setWhiteData(true); // Turn data whitening on.
116
+
SmartCC1101.setCRCCheck(true); // CRC calculation in TX and CRC check in RX enabled.
112
117
}
113
118
114
119
115
120
voidloop() {
116
121
uint8_t buffer[61]{ 0 }; // buffer for the data received by **CC1101**
117
122
118
-
int len = SmartCC1101.receiveData(buffer);
119
-
// len will be 0 if nothing is yet received.
123
+
int len = SmartCC1101.receiveData(buffer); // len will be 0 if nothing is yet received.
124
+
120
125
if (len > 0) {
121
126
Serial.print(len);
122
127
Serial.println(" bytes received.");
@@ -132,26 +137,25 @@ void loop() {
132
137
133
138
// check if crc is correct
134
139
if (CRC) {
135
-
Serial.println("CRC ok. RSSI: ");
136
-
Serial.print(RSSI);
137
-
Serial.print("dB, LQI ");
138
-
Serial.println(LQI);
140
+
Serial.println("CRC ok.");
139
141
Serial.println("Data:");
140
142
Serial.println((char *)buffer);
141
143
} else {
142
-
Serial.print("CRC Error. RSSI: ");
143
-
Serial.print(RSSI);
144
-
Serial.print("dB, LQI ");
145
-
Serial.println(LQI);
144
+
Serial.println("CRC Error.");
146
145
}
146
+
Serial.println("RSSI: ");
147
+
Serial.print(RSSI);
148
+
Serial.print("dB, LQI ");
149
+
Serial.println(LQI);
147
150
}
148
151
}
149
152
150
153
```
151
154
152
155
## Function reference
156
+
If you need more detailed information, please check the [CC1101 data sheet](https://www.ti.com/lit/ds/symlink/cc1101.pdf).
153
157
154
-
`void init(void)` must be called prior to using any other function. Will establish the necessary setup of the **CC1101** chip. Only exception: `getCC1101()` may be called prior to `init()`.
158
+
### Functions in alphabetic order:
155
159
156
160
`bool checkCRC(void)` Check if CRC is correct. Returns `true` if CRCs match in last transmission. Only meaningful after data is received via `receiveData()`.
157
161
@@ -161,6 +165,8 @@ void loop() {
161
165
162
166
`int8_t getRSSI(void)` Received Signal Strength Indicator. The value is the estimated signal strength in dBm. When called after data is received via `receiveData()`. RSSI corresponds to the data received. If called intermittently, returns the current signal strength.
163
167
168
+
`void init(void)` must be called prior to using any other function. Will establish the necessary setup of the **CC1101** chip. Only exception: `getCC1101()` may be called prior to `init()`.
169
+
164
170
`uint8_t receiveData(uint8_t *rxBuffer)` Check if data is received and copy it to rxBuffer. Returns 0 if no data is received yet, transmission is in progress or CRC wrong and `void setCRC_AF(true)`. If data was received, `setRX()`must be called again.
165
171
166
172
`void sendData(const char *txBuffer)` Sends the zero-terminated character string pointed to. Will return when data is sent. Must be max 61 characters including the trailing 0.
@@ -177,7 +183,7 @@ void loop() {
177
183
| adc_YES0BC | Address check and 0 (0x00) broadcast |
178
184
| adc_YES0FFBC | Address check and 0 (0x00) and 255 (0xFF) broadcast |
179
185
180
-
`void setCarrierFrequency(uint32_t freq)` Set tranmsision frequency in Hz. Default = 868.35 MHz). The **CC1101** can use the frequenciy ranges 300-348 MHZ, 387-464MHZ and 779-928MHZ.
186
+
`void setCarrierFrequency(uint32_t freq)` Set tranmsision frequency in Hz. Default = 868.35 MHz). The **CC1101** can use the frequenciy ranges 300-348 MHZ, 387-464 MHZ and 779-928 MHZ.
181
187
> [!WARNING]
182
188
> Please respect local regulations.
183
189
@@ -263,21 +269,21 @@ void loop() {
263
269
`void setRXBandWitdth(rx_BandWidth bw)` Set the Receive Bandwidth. Value can be cosen from predefined list of values:
264
270
| Bandwidth | Value |
265
271
|----------|---------|
266
-
|58KHz| bw_58kHz |
267
-
|68kHz| bw_68kHz |
268
-
|81kHz| bw_81kHz |
269
-
|102kHz| bw_102kHz |
270
-
|116kHz| bw_116kHz |
271
-
|135kHz| bw_135kHz |
272
-
|203kHz| bw_203kHz (default) |
273
-
|232kHz| bw_232kHz |
274
-
|270kHz| bw_270kHz |
275
-
|325kHz| bw_325kHz |
276
-
|406kHz| bw_406kHz |
277
-
|464kHz| bw_464kHz |
278
-
|541kHz| bw_541kHz |
279
-
|650kHz| bw_650kHz |
280
-
|812kHz| bw_812kHz |
272
+
|58 KHz| bw_58kHz |
273
+
|68 kHz| bw_68kHz |
274
+
|81 kHz| bw_81kHz |
275
+
|102 kHz| bw_102kHz |
276
+
|116 kHz| bw_116kHz |
277
+
|135 kHz| bw_135kHz |
278
+
|203 kHz| bw_203kHz (default) |
279
+
|232 kHz| bw_232kHz |
280
+
|270 kHz| bw_270kHz |
281
+
|325 kHz| bw_325kHz |
282
+
|406 kHz| bw_406kHz |
283
+
|464 kHz| bw_464kHz |
284
+
|541 kHz| bw_541kHz |
285
+
|650 kHz| bw_650kHz |
286
+
|812 kHz| bw_812kHz |
281
287
282
288
`void setSymbolRate(double symbolRate)` Data transmission rate in baud. Value from 20 to 1621830 Default is 115051 Baud.
0 commit comments