RFM12 library/en: Unterschied zwischen den Versionen
KKeine Bearbeitungszusammenfassung |
KKeine Bearbeitungszusammenfassung |
||
Zeile 31: | Zeile 31: | ||
=== Collision | === Collision Prevention === | ||
Before a packet is actually sent, the RFM12's status register is read in order to measure the current signal strength. When the signal strength is above a treshold, it is assumed that there's a transmission underway. The library then waits some time until the "ether" is free and starts the transmission when the module hasn't seen any traffic for some time. | Before a packet is actually sent, the RFM12's status register is read in order to measure the current signal strength. When the signal strength is above a treshold, it is assumed that there's a transmission underway. The library then waits some time until the "ether" is free and starts the transmission when the module hasn't seen any traffic for some time. | ||
Zeile 37: | Zeile 37: | ||
=== Integrity | === Integrity Checking === | ||
The library already provides a very small protocol to provide integrity for your transmissions. There are two additional bytes sent in per packet that contain the '''length''' of the payload and a "checksum" field, that simply is the byte-per-byte XOR'ed payload. | The library already provides a very small protocol to provide integrity for your transmissions. There are two additional bytes sent in per packet that contain the '''length''' of the payload and a "checksum" field, that simply is the byte-per-byte XOR'ed payload. | ||
Zeile 53: | Zeile 53: | ||
== Using the Library == | == Using the Library == | ||
The file '''rfm12_config.h''' contains all the configuration as well as a pin assignment table. | The file '''rfm12_config.h''' contains all the configuration as well as a pin assignment table. See the documentation for more info. | ||
Here's an example how to use the library: | Here's an example how to use the library: |
Version vom 8. Oktober 2009, 23:13 Uhr
rfm12lib Release status: stable [box doku] | |
---|---|
Description | The rfm12 library provides the ability to use RFM12(B) modules in conjunction with Atmel AVR microcontrollers |
Author(s) | Hansinator, Tixiv, Soeren |
Last Version | 0.9.0 () |
Platform | AVR |
License | GPLv2 or later |
Download | SVN browse |
Library Features
- Basic packet format, including:
- An 8-bit (0..255) packet type or address field
- Packet length up to 255 bytes
- A simple header checksum
- Interrupt or polling based packet transfer handling
- Multiple frequency bands, depending on the used module (433, 868 and 915 MHz)
- Collision avoidance (carrier sense)
- Usage of synchronization patterns to start data reception
- Hardware or software SPI support
- Transmit only mode, to reduce the size of the binary
- Basic ASK (amplitude shift keying) receive and transmit functionality (for radio controlled outlets and the like)
- Low-battery detection feature (using the RFM12)
- Low-power Wakeup timer feature (using the RFM12)
Collision Prevention
Before a packet is actually sent, the RFM12's status register is read in order to measure the current signal strength. When the signal strength is above a treshold, it is assumed that there's a transmission underway. The library then waits some time until the "ether" is free and starts the transmission when the module hasn't seen any traffic for some time.
Collision prevention is enabled by default. You can disable it by defining this#define RFM12_NOCOLLISIONDETECTION 1 in your rfm12_config.h.
Integrity Checking
The library already provides a very small protocol to provide integrity for your transmissions. There are two additional bytes sent in per packet that contain the length of the payload and a "checksum" field, that simply is the byte-per-byte XOR'ed payload.
Documentation
Here's a beta release of the documentation:
http://www.hansinator.de/rfm12lib/
Download
The library is hosted in our subversion repository. You can browse the repository or directly check out the sources with the command:
svn co https://www.das-labor.org/storage/LaborLib/rfm12/
Using the Library
The file rfm12_config.h contains all the configuration as well as a pin assignment table. See the documentation for more info.
Here's an example how to use the library:
uint8_t teststring[] = "teststring\r\n"; uint8_t packettype = 0xEE; rfm12_init(); /* initialize the library */ sei(); while (23) { /* ... */ rfm12_tx (sizeof(teststring), packettype, teststring); rfm12_tick(); /* periodic tick function - call that one once in a while */ }