Skip to content

Commit 3d52fd7

Browse files
committed
Improved support for STM32. Patch from Bent Guldbjerg Christensen.
1 parent c8ef90e commit 3d52fd7

File tree

123 files changed

+27988
-335
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

123 files changed

+27988
-335
lines changed

LICENSE

+13-335
Large diffs are not rendered by default.

MANIFEST

+125
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,125 @@
1+
RadioHead/LICENSE
2+
RadioHead/MANIFEST
3+
RadioHead/project.cfg
4+
RadioHead/RadioHead.h
5+
RadioHead/RH_ASK.cpp
6+
RadioHead/RH_ASK.h
7+
RadioHead/RHCRC.cpp
8+
RadioHead/RHCRC.h
9+
RadioHead/RHDatagram.cpp
10+
RadioHead/RHDatagram.h
11+
RadioHead/RHGenericDriver.cpp
12+
RadioHead/RHGenericDriver.h
13+
RadioHead/RHGenericSPI.cpp
14+
RadioHead/RHGenericSPI.h
15+
RadioHead/RHHardwareSPI.cpp
16+
RadioHead/RHHardwareSPI.h
17+
RadioHead/RHMesh.cpp
18+
RadioHead/RHMesh.h
19+
RadioHead/RHReliableDatagram.cpp
20+
RadioHead/RHReliableDatagram.h
21+
RadioHead/RH_CC110.cpp
22+
RadioHead/RH_CC110.h
23+
RadioHead/RH_NRF24.cpp
24+
RadioHead/RH_NRF24.h
25+
RadioHead/RH_NRF51.cpp
26+
RadioHead/RH_NRF51.h
27+
RadioHead/RH_NRF905.cpp
28+
RadioHead/RH_NRF905.h
29+
RadioHead/RH_RF22.cpp
30+
RadioHead/RH_RF22.h
31+
RadioHead/RH_RF24.cpp
32+
RadioHead/RH_RF24.h
33+
RadioHead/radio_config_Si4460.h
34+
RadioHead/RH_RF69.cpp
35+
RadioHead/RH_RF69.h
36+
RadioHead/RH_MRF89.cpp
37+
RadioHead/RH_MRF89.h
38+
RadioHead/RH_RF95.cpp
39+
RadioHead/RH_RF95.h
40+
RadioHead/RH_TCP.cpp
41+
RadioHead/RH_TCP.h
42+
RadioHead/RHRouter.cpp
43+
RadioHead/RHRouter.h
44+
RadioHead/RH_Serial.cpp
45+
RadioHead/RH_Serial.h
46+
RadioHead/RHSoftwareSPI.cpp
47+
RadioHead/RHSoftwareSPI.h
48+
RadioHead/RHSPIDriver.cpp
49+
RadioHead/RHSPIDriver.h
50+
RadioHead/RHTcpProtocol.h
51+
RadioHead/RHNRFSPIDriver.cpp
52+
RadioHead/RHNRFSPIDriver.h
53+
RadioHead/RHutil
54+
RadioHead/RHutil/atomic.h
55+
RadioHead/RHutil/simulator.h
56+
RadioHead/RHutil/HardwareSerial.h
57+
RadioHead/RHutil/HardwareSerial.cpp
58+
RadioHead/RHutil/RasPi.cpp
59+
RadioHead/RHutil/RasPi.h
60+
RadioHead/examples/ask/ask_reliable_datagram_client/ask_reliable_datagram_client.pde
61+
RadioHead/examples/ask/ask_reliable_datagram_server/ask_reliable_datagram_server.pde
62+
RadioHead/examples/ask/ask_transmitter/ask_transmitter.pde
63+
RadioHead/examples/ask/ask_receiver/ask_receiver.pde
64+
RadioHead/examples/cc110/cc110_client/cc110_client.pde
65+
RadioHead/examples/cc110/cc110_server/cc110_server.pde
66+
RadioHead/examples/rf95/rf95_client/rf95_client.pde
67+
RadioHead/examples/rf95/rf95_reliable_datagram_client/rf95_reliable_datagram_client.pde
68+
RadioHead/examples/rf95/rf95_reliable_datagram_server/rf95_reliable_datagram_server.pde
69+
RadioHead/examples/rf95/rf95_server/rf95_server.pde
70+
RadioHead/examples/rf22/rf22_client/rf22_client.pde
71+
RadioHead/examples/rf22/rf22_mesh_client/rf22_mesh_client.pde
72+
RadioHead/examples/rf22/rf22_mesh_server1/rf22_mesh_server1.pde
73+
RadioHead/examples/rf22/rf22_mesh_server2/rf22_mesh_server2.pde
74+
RadioHead/examples/rf22/rf22_mesh_server3/rf22_mesh_server3.pde
75+
RadioHead/examples/rf22/rf22_reliable_datagram_client/rf22_reliable_datagram_client.pde
76+
RadioHead/examples/rf22/rf22_reliable_datagram_server/rf22_reliable_datagram_server.pde
77+
RadioHead/examples/rf22/rf22_router_client/rf22_router_client.pde
78+
RadioHead/examples/rf22/rf22_router_server1/rf22_router_server1.pde
79+
RadioHead/examples/rf22/rf22_router_server2/rf22_router_server2.pde
80+
RadioHead/examples/rf22/rf22_router_server3/rf22_router_server3.pde
81+
RadioHead/examples/rf22/rf22_router_test/rf22_router_test.pde
82+
RadioHead/examples/rf22/rf22_server/rf22_server.pde
83+
RadioHead/examples/rf24/rf24_client/rf24_client.pde
84+
RadioHead/examples/rf24/rf24_reliable_datagram_client/rf24_reliable_datagram_client.pde
85+
RadioHead/examples/rf24/rf24_reliable_datagram_server/rf24_reliable_datagram_server.pde
86+
RadioHead/examples/rf24/rf24_server/rf24_server.pde
87+
RadioHead/examples/rf69/rf69_client/rf69_client.pde
88+
RadioHead/examples/rf69/rf69_reliable_datagram_client/rf69_reliable_datagram_client.pde
89+
RadioHead/examples/rf69/rf69_reliable_datagram_server/rf69_reliable_datagram_server.pde
90+
RadioHead/examples/rf69/rf69_server/rf69_server.pde
91+
RadioHead/examples/mrf89/mrf89_client/mrf89_client.pde
92+
RadioHead/examples/mrf89/mrf89_server/mrf89_server.pde
93+
RadioHead/examples/nrf24/nrf24_client/nrf24_client.pde
94+
RadioHead/examples/nrf24/nrf24_reliable_datagram_client/nrf24_reliable_datagram_client.pde
95+
RadioHead/examples/nrf24/nrf24_reliable_datagram_server/nrf24_reliable_datagram_server.pde
96+
RadioHead/examples/nrf24/nrf24_server/nrf24_server.pde
97+
RadioHead/examples/nrf51/nrf51_client/nrf51_client.pde
98+
RadioHead/examples/nrf51/nrf51_reliable_datagram_client/nrf51_reliable_datagram_client.pde
99+
RadioHead/examples/nrf51/nrf51_reliable_datagram_server/nrf51_reliable_datagram_server.pde
100+
RadioHead/examples/nrf51/nrf51_server/nrf51_server.pde
101+
RadioHead/examples/nrf51/nrf51_audio_tx/nrf51_audio_tx.pde
102+
RadioHead/examples/nrf51/nrf51_audio_tx/nrf51_audio.pdf
103+
RadioHead/examples/nrf51/nrf51_audio_rx/nrf51_audio_rx.pde
104+
RadioHead/examples/nrf905/nrf905_client/nrf905_client.pde
105+
RadioHead/examples/nrf905/nrf905_reliable_datagram_client/nrf905_reliable_datagram_client.pde
106+
RadioHead/examples/nrf905/nrf905_reliable_datagram_server/nrf905_reliable_datagram_server.pde
107+
RadioHead/examples/nrf905/nrf905_server/nrf905_server.pde
108+
RadioHead/examples/serial/serial_reliable_datagram_client/serial_reliable_datagram_client.pde
109+
RadioHead/examples/serial/serial_reliable_datagram_server/serial_reliable_datagram_server.pde
110+
RadioHead/examples/simulator/simulator_reliable_datagram_client/simulator_reliable_datagram_client.pde
111+
RadioHead/examples/simulator/simulator_reliable_datagram_server/simulator_reliable_datagram_server.pde
112+
RadioHead/examples/raspi/RasPiRH.cpp
113+
RadioHead/examples/raspi/Makefile
114+
RadioHead/tools/etherSimulator.pl
115+
RadioHead/tools/chain.conf
116+
RadioHead/tools/simMain.cpp
117+
RadioHead/tools/simBuild
118+
RadioHead/doc
119+
RadioHead/STM32ArduinoCompat/HardwareSerial.cpp
120+
RadioHead/STM32ArduinoCompat/HardwareSerial.h
121+
RadioHead/STM32ArduinoCompat/HardwareSPI.cpp
122+
RadioHead/STM32ArduinoCompat/HardwareSPI.h
123+
RadioHead/STM32ArduinoCompat/wirish.cpp
124+
RadioHead/STM32ArduinoCompat/wirish.h
125+
RadioHead/STM32ArduinoCompat/README

RHCRC.cpp

+104
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,104 @@
1+
/* Copyright (c) 2002, 2003, 2004 Marek Michalkiewicz
2+
Copyright (c) 2005, 2007 Joerg Wunsch
3+
All rights reserved.
4+
5+
Redistribution and use in source and binary forms, with or without
6+
modification, are permitted provided that the following conditions are met:
7+
8+
* Redistributions of source code must retain the above copyright
9+
notice, this list of conditions and the following disclaimer.
10+
11+
* Redistributions in binary form must reproduce the above copyright
12+
notice, this list of conditions and the following disclaimer in
13+
the documentation and/or other materials provided with the
14+
distribution.
15+
16+
* Neither the name of the copyright holders nor the names of
17+
contributors may be used to endorse or promote products derived
18+
from this software without specific prior written permission.
19+
20+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
21+
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22+
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
23+
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
24+
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
25+
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
26+
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
27+
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
28+
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
29+
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
30+
POSSIBILITY OF SUCH DAMAGE. */
31+
32+
// Port to Energia / MPS430 by Yannick DEVOS XV4Y - (c) 2013
33+
// http://xv4y.radioclub.asia/
34+
//
35+
36+
// Adapted to RadioHead use by Mike McCauley 2014
37+
// This is to prevent name collisions with other similar library functions
38+
// and to provide a consistent API amonng all processors
39+
//
40+
41+
/* $Id: RHCRC.cpp,v 1.1 2014/06/24 02:40:12 mikem Exp $ */
42+
43+
#include <RHCRC.h>
44+
45+
#define lo8(x) ((x)&0xff)
46+
#define hi8(x) ((x)>>8)
47+
48+
uint16_t RHcrc16_update(uint16_t crc, uint8_t a)
49+
{
50+
int i;
51+
52+
crc ^= a;
53+
for (i = 0; i < 8; ++i)
54+
{
55+
if (crc & 1)
56+
crc = (crc >> 1) ^ 0xA001;
57+
else
58+
crc = (crc >> 1);
59+
}
60+
return crc;
61+
}
62+
63+
uint16_t RHcrc_xmodem_update (uint16_t crc, uint8_t data)
64+
{
65+
int i;
66+
67+
crc = crc ^ ((uint16_t)data << 8);
68+
for (i=0; i<8; i++)
69+
{
70+
if (crc & 0x8000)
71+
crc = (crc << 1) ^ 0x1021;
72+
else
73+
crc <<= 1;
74+
}
75+
76+
return crc;
77+
}
78+
79+
uint16_t RHcrc_ccitt_update (uint16_t crc, uint8_t data)
80+
{
81+
data ^= lo8 (crc);
82+
data ^= data << 4;
83+
84+
return ((((uint16_t)data << 8) | hi8 (crc)) ^ (uint8_t)(data >> 4)
85+
^ ((uint16_t)data << 3));
86+
}
87+
88+
uint8_t RHcrc_ibutton_update(uint8_t crc, uint8_t data)
89+
{
90+
uint8_t i;
91+
92+
crc = crc ^ data;
93+
for (i = 0; i < 8; i++)
94+
{
95+
if (crc & 0x01)
96+
crc = (crc >> 1) ^ 0x8C;
97+
else
98+
crc >>= 1;
99+
}
100+
101+
return crc;
102+
}
103+
104+

RHCRC.h

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
// RHCRC.h
2+
//
3+
// Definitions for RadioHead compatible CRC outines.
4+
//
5+
// These routines originally derived from Arduino source code. See RHCRC.cpp
6+
// for copyright information
7+
// $Id: RHCRC.h,v 1.1 2014/06/24 02:40:12 mikem Exp $
8+
9+
#ifndef RHCRC_h
10+
#define RHCRC_h
11+
12+
#include <RadioHead.h>
13+
14+
extern uint16_t RHcrc16_update(uint16_t crc, uint8_t a);
15+
extern uint16_t RHcrc_xmodem_update (uint16_t crc, uint8_t data);
16+
extern uint16_t RHcrc_ccitt_update (uint16_t crc, uint8_t data);
17+
extern uint8_t RHcrc_ibutton_update(uint8_t crc, uint8_t data);
18+
19+
#endif

RHDatagram.cpp

+123
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,123 @@
1+
// RHDatagram.cpp
2+
//
3+
// Copyright (C) 2011 Mike McCauley
4+
// $Id: RHDatagram.cpp,v 1.6 2014/05/23 02:20:17 mikem Exp $
5+
6+
#include <RHDatagram.h>
7+
8+
RHDatagram::RHDatagram(RHGenericDriver& driver, uint8_t thisAddress)
9+
:
10+
_driver(driver),
11+
_thisAddress(thisAddress)
12+
{
13+
}
14+
15+
////////////////////////////////////////////////////////////////////
16+
// Public methods
17+
bool RHDatagram::init()
18+
{
19+
bool ret = _driver.init();
20+
if (ret)
21+
setThisAddress(_thisAddress);
22+
return ret;
23+
}
24+
25+
void RHDatagram::setThisAddress(uint8_t thisAddress)
26+
{
27+
_driver.setThisAddress(thisAddress);
28+
// Use this address in the transmitted FROM header
29+
setHeaderFrom(thisAddress);
30+
_thisAddress = thisAddress;
31+
}
32+
33+
bool RHDatagram::sendto(uint8_t* buf, uint8_t len, uint8_t address)
34+
{
35+
setHeaderTo(address);
36+
return _driver.send(buf, len);
37+
}
38+
39+
bool RHDatagram::recvfrom(uint8_t* buf, uint8_t* len, uint8_t* from, uint8_t* to, uint8_t* id, uint8_t* flags)
40+
{
41+
if (_driver.recv(buf, len))
42+
{
43+
if (from) *from = headerFrom();
44+
if (to) *to = headerTo();
45+
if (id) *id = headerId();
46+
if (flags) *flags = headerFlags();
47+
return true;
48+
}
49+
return false;
50+
}
51+
52+
bool RHDatagram::available()
53+
{
54+
return _driver.available();
55+
}
56+
57+
void RHDatagram::waitAvailable()
58+
{
59+
_driver.waitAvailable();
60+
}
61+
62+
bool RHDatagram::waitPacketSent()
63+
{
64+
return _driver.waitPacketSent();
65+
}
66+
67+
bool RHDatagram::waitPacketSent(uint16_t timeout)
68+
{
69+
return _driver.waitPacketSent(timeout);
70+
}
71+
72+
bool RHDatagram::waitAvailableTimeout(uint16_t timeout)
73+
{
74+
return _driver.waitAvailableTimeout(timeout);
75+
}
76+
77+
uint8_t RHDatagram::thisAddress()
78+
{
79+
return _thisAddress;
80+
}
81+
82+
void RHDatagram::setHeaderTo(uint8_t to)
83+
{
84+
_driver.setHeaderTo(to);
85+
}
86+
87+
void RHDatagram::setHeaderFrom(uint8_t from)
88+
{
89+
_driver.setHeaderFrom(from);
90+
}
91+
92+
void RHDatagram::setHeaderId(uint8_t id)
93+
{
94+
_driver.setHeaderId(id);
95+
}
96+
97+
void RHDatagram::setHeaderFlags(uint8_t set, uint8_t clear)
98+
{
99+
_driver.setHeaderFlags(set, clear);
100+
}
101+
102+
uint8_t RHDatagram::headerTo()
103+
{
104+
return _driver.headerTo();
105+
}
106+
107+
uint8_t RHDatagram::headerFrom()
108+
{
109+
return _driver.headerFrom();
110+
}
111+
112+
uint8_t RHDatagram::headerId()
113+
{
114+
return _driver.headerId();
115+
}
116+
117+
uint8_t RHDatagram::headerFlags()
118+
{
119+
return _driver.headerFlags();
120+
}
121+
122+
123+

0 commit comments

Comments
 (0)