Skip to content

Commit

Permalink
Improved support for STM32. Patch from Bent Guldbjerg Christensen.
Browse files Browse the repository at this point in the history
  • Loading branch information
MFornander committed Mar 3, 2017
1 parent c8ef90e commit 3d52fd7
Show file tree
Hide file tree
Showing 123 changed files with 27,988 additions and 335 deletions.
348 changes: 13 additions & 335 deletions LICENSE

Large diffs are not rendered by default.

125 changes: 125 additions & 0 deletions MANIFEST
Original file line number Diff line number Diff line change
@@ -0,0 +1,125 @@
RadioHead/LICENSE
RadioHead/MANIFEST
RadioHead/project.cfg
RadioHead/RadioHead.h
RadioHead/RH_ASK.cpp
RadioHead/RH_ASK.h
RadioHead/RHCRC.cpp
RadioHead/RHCRC.h
RadioHead/RHDatagram.cpp
RadioHead/RHDatagram.h
RadioHead/RHGenericDriver.cpp
RadioHead/RHGenericDriver.h
RadioHead/RHGenericSPI.cpp
RadioHead/RHGenericSPI.h
RadioHead/RHHardwareSPI.cpp
RadioHead/RHHardwareSPI.h
RadioHead/RHMesh.cpp
RadioHead/RHMesh.h
RadioHead/RHReliableDatagram.cpp
RadioHead/RHReliableDatagram.h
RadioHead/RH_CC110.cpp
RadioHead/RH_CC110.h
RadioHead/RH_NRF24.cpp
RadioHead/RH_NRF24.h
RadioHead/RH_NRF51.cpp
RadioHead/RH_NRF51.h
RadioHead/RH_NRF905.cpp
RadioHead/RH_NRF905.h
RadioHead/RH_RF22.cpp
RadioHead/RH_RF22.h
RadioHead/RH_RF24.cpp
RadioHead/RH_RF24.h
RadioHead/radio_config_Si4460.h
RadioHead/RH_RF69.cpp
RadioHead/RH_RF69.h
RadioHead/RH_MRF89.cpp
RadioHead/RH_MRF89.h
RadioHead/RH_RF95.cpp
RadioHead/RH_RF95.h
RadioHead/RH_TCP.cpp
RadioHead/RH_TCP.h
RadioHead/RHRouter.cpp
RadioHead/RHRouter.h
RadioHead/RH_Serial.cpp
RadioHead/RH_Serial.h
RadioHead/RHSoftwareSPI.cpp
RadioHead/RHSoftwareSPI.h
RadioHead/RHSPIDriver.cpp
RadioHead/RHSPIDriver.h
RadioHead/RHTcpProtocol.h
RadioHead/RHNRFSPIDriver.cpp
RadioHead/RHNRFSPIDriver.h
RadioHead/RHutil
RadioHead/RHutil/atomic.h
RadioHead/RHutil/simulator.h
RadioHead/RHutil/HardwareSerial.h
RadioHead/RHutil/HardwareSerial.cpp
RadioHead/RHutil/RasPi.cpp
RadioHead/RHutil/RasPi.h
RadioHead/examples/ask/ask_reliable_datagram_client/ask_reliable_datagram_client.pde
RadioHead/examples/ask/ask_reliable_datagram_server/ask_reliable_datagram_server.pde
RadioHead/examples/ask/ask_transmitter/ask_transmitter.pde
RadioHead/examples/ask/ask_receiver/ask_receiver.pde
RadioHead/examples/cc110/cc110_client/cc110_client.pde
RadioHead/examples/cc110/cc110_server/cc110_server.pde
RadioHead/examples/rf95/rf95_client/rf95_client.pde
RadioHead/examples/rf95/rf95_reliable_datagram_client/rf95_reliable_datagram_client.pde
RadioHead/examples/rf95/rf95_reliable_datagram_server/rf95_reliable_datagram_server.pde
RadioHead/examples/rf95/rf95_server/rf95_server.pde
RadioHead/examples/rf22/rf22_client/rf22_client.pde
RadioHead/examples/rf22/rf22_mesh_client/rf22_mesh_client.pde
RadioHead/examples/rf22/rf22_mesh_server1/rf22_mesh_server1.pde
RadioHead/examples/rf22/rf22_mesh_server2/rf22_mesh_server2.pde
RadioHead/examples/rf22/rf22_mesh_server3/rf22_mesh_server3.pde
RadioHead/examples/rf22/rf22_reliable_datagram_client/rf22_reliable_datagram_client.pde
RadioHead/examples/rf22/rf22_reliable_datagram_server/rf22_reliable_datagram_server.pde
RadioHead/examples/rf22/rf22_router_client/rf22_router_client.pde
RadioHead/examples/rf22/rf22_router_server1/rf22_router_server1.pde
RadioHead/examples/rf22/rf22_router_server2/rf22_router_server2.pde
RadioHead/examples/rf22/rf22_router_server3/rf22_router_server3.pde
RadioHead/examples/rf22/rf22_router_test/rf22_router_test.pde
RadioHead/examples/rf22/rf22_server/rf22_server.pde
RadioHead/examples/rf24/rf24_client/rf24_client.pde
RadioHead/examples/rf24/rf24_reliable_datagram_client/rf24_reliable_datagram_client.pde
RadioHead/examples/rf24/rf24_reliable_datagram_server/rf24_reliable_datagram_server.pde
RadioHead/examples/rf24/rf24_server/rf24_server.pde
RadioHead/examples/rf69/rf69_client/rf69_client.pde
RadioHead/examples/rf69/rf69_reliable_datagram_client/rf69_reliable_datagram_client.pde
RadioHead/examples/rf69/rf69_reliable_datagram_server/rf69_reliable_datagram_server.pde
RadioHead/examples/rf69/rf69_server/rf69_server.pde
RadioHead/examples/mrf89/mrf89_client/mrf89_client.pde
RadioHead/examples/mrf89/mrf89_server/mrf89_server.pde
RadioHead/examples/nrf24/nrf24_client/nrf24_client.pde
RadioHead/examples/nrf24/nrf24_reliable_datagram_client/nrf24_reliable_datagram_client.pde
RadioHead/examples/nrf24/nrf24_reliable_datagram_server/nrf24_reliable_datagram_server.pde
RadioHead/examples/nrf24/nrf24_server/nrf24_server.pde
RadioHead/examples/nrf51/nrf51_client/nrf51_client.pde
RadioHead/examples/nrf51/nrf51_reliable_datagram_client/nrf51_reliable_datagram_client.pde
RadioHead/examples/nrf51/nrf51_reliable_datagram_server/nrf51_reliable_datagram_server.pde
RadioHead/examples/nrf51/nrf51_server/nrf51_server.pde
RadioHead/examples/nrf51/nrf51_audio_tx/nrf51_audio_tx.pde
RadioHead/examples/nrf51/nrf51_audio_tx/nrf51_audio.pdf
RadioHead/examples/nrf51/nrf51_audio_rx/nrf51_audio_rx.pde
RadioHead/examples/nrf905/nrf905_client/nrf905_client.pde
RadioHead/examples/nrf905/nrf905_reliable_datagram_client/nrf905_reliable_datagram_client.pde
RadioHead/examples/nrf905/nrf905_reliable_datagram_server/nrf905_reliable_datagram_server.pde
RadioHead/examples/nrf905/nrf905_server/nrf905_server.pde
RadioHead/examples/serial/serial_reliable_datagram_client/serial_reliable_datagram_client.pde
RadioHead/examples/serial/serial_reliable_datagram_server/serial_reliable_datagram_server.pde
RadioHead/examples/simulator/simulator_reliable_datagram_client/simulator_reliable_datagram_client.pde
RadioHead/examples/simulator/simulator_reliable_datagram_server/simulator_reliable_datagram_server.pde
RadioHead/examples/raspi/RasPiRH.cpp
RadioHead/examples/raspi/Makefile
RadioHead/tools/etherSimulator.pl
RadioHead/tools/chain.conf
RadioHead/tools/simMain.cpp
RadioHead/tools/simBuild
RadioHead/doc
RadioHead/STM32ArduinoCompat/HardwareSerial.cpp
RadioHead/STM32ArduinoCompat/HardwareSerial.h
RadioHead/STM32ArduinoCompat/HardwareSPI.cpp
RadioHead/STM32ArduinoCompat/HardwareSPI.h
RadioHead/STM32ArduinoCompat/wirish.cpp
RadioHead/STM32ArduinoCompat/wirish.h
RadioHead/STM32ArduinoCompat/README
104 changes: 104 additions & 0 deletions RHCRC.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
/* Copyright (c) 2002, 2003, 2004 Marek Michalkiewicz
Copyright (c) 2005, 2007 Joerg Wunsch
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in
the documentation and/or other materials provided with the
distribution.
* Neither the name of the copyright holders nor the names of
contributors may be used to endorse or promote products derived
from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE. */

// Port to Energia / MPS430 by Yannick DEVOS XV4Y - (c) 2013
// http://xv4y.radioclub.asia/
//

// Adapted to RadioHead use by Mike McCauley 2014
// This is to prevent name collisions with other similar library functions
// and to provide a consistent API amonng all processors
//

/* $Id: RHCRC.cpp,v 1.1 2014/06/24 02:40:12 mikem Exp $ */

#include <RHCRC.h>

#define lo8(x) ((x)&0xff)
#define hi8(x) ((x)>>8)

uint16_t RHcrc16_update(uint16_t crc, uint8_t a)
{
int i;

crc ^= a;
for (i = 0; i < 8; ++i)
{
if (crc & 1)
crc = (crc >> 1) ^ 0xA001;
else
crc = (crc >> 1);
}
return crc;
}

uint16_t RHcrc_xmodem_update (uint16_t crc, uint8_t data)
{
int i;

crc = crc ^ ((uint16_t)data << 8);
for (i=0; i<8; i++)
{
if (crc & 0x8000)
crc = (crc << 1) ^ 0x1021;
else
crc <<= 1;
}

return crc;
}

uint16_t RHcrc_ccitt_update (uint16_t crc, uint8_t data)
{
data ^= lo8 (crc);
data ^= data << 4;

return ((((uint16_t)data << 8) | hi8 (crc)) ^ (uint8_t)(data >> 4)
^ ((uint16_t)data << 3));
}

uint8_t RHcrc_ibutton_update(uint8_t crc, uint8_t data)
{
uint8_t i;

crc = crc ^ data;
for (i = 0; i < 8; i++)
{
if (crc & 0x01)
crc = (crc >> 1) ^ 0x8C;
else
crc >>= 1;
}

return crc;
}


19 changes: 19 additions & 0 deletions RHCRC.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
// RHCRC.h
//
// Definitions for RadioHead compatible CRC outines.
//
// These routines originally derived from Arduino source code. See RHCRC.cpp
// for copyright information
// $Id: RHCRC.h,v 1.1 2014/06/24 02:40:12 mikem Exp $

#ifndef RHCRC_h
#define RHCRC_h

#include <RadioHead.h>

extern uint16_t RHcrc16_update(uint16_t crc, uint8_t a);
extern uint16_t RHcrc_xmodem_update (uint16_t crc, uint8_t data);
extern uint16_t RHcrc_ccitt_update (uint16_t crc, uint8_t data);
extern uint8_t RHcrc_ibutton_update(uint8_t crc, uint8_t data);

#endif
123 changes: 123 additions & 0 deletions RHDatagram.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,123 @@
// RHDatagram.cpp
//
// Copyright (C) 2011 Mike McCauley
// $Id: RHDatagram.cpp,v 1.6 2014/05/23 02:20:17 mikem Exp $

#include <RHDatagram.h>

RHDatagram::RHDatagram(RHGenericDriver& driver, uint8_t thisAddress)
:
_driver(driver),
_thisAddress(thisAddress)
{
}

////////////////////////////////////////////////////////////////////
// Public methods
bool RHDatagram::init()
{
bool ret = _driver.init();
if (ret)
setThisAddress(_thisAddress);
return ret;
}

void RHDatagram::setThisAddress(uint8_t thisAddress)
{
_driver.setThisAddress(thisAddress);
// Use this address in the transmitted FROM header
setHeaderFrom(thisAddress);
_thisAddress = thisAddress;
}

bool RHDatagram::sendto(uint8_t* buf, uint8_t len, uint8_t address)
{
setHeaderTo(address);
return _driver.send(buf, len);
}

bool RHDatagram::recvfrom(uint8_t* buf, uint8_t* len, uint8_t* from, uint8_t* to, uint8_t* id, uint8_t* flags)
{
if (_driver.recv(buf, len))
{
if (from) *from = headerFrom();
if (to) *to = headerTo();
if (id) *id = headerId();
if (flags) *flags = headerFlags();
return true;
}
return false;
}

bool RHDatagram::available()
{
return _driver.available();
}

void RHDatagram::waitAvailable()
{
_driver.waitAvailable();
}

bool RHDatagram::waitPacketSent()
{
return _driver.waitPacketSent();
}

bool RHDatagram::waitPacketSent(uint16_t timeout)
{
return _driver.waitPacketSent(timeout);
}

bool RHDatagram::waitAvailableTimeout(uint16_t timeout)
{
return _driver.waitAvailableTimeout(timeout);
}

uint8_t RHDatagram::thisAddress()
{
return _thisAddress;
}

void RHDatagram::setHeaderTo(uint8_t to)
{
_driver.setHeaderTo(to);
}

void RHDatagram::setHeaderFrom(uint8_t from)
{
_driver.setHeaderFrom(from);
}

void RHDatagram::setHeaderId(uint8_t id)
{
_driver.setHeaderId(id);
}

void RHDatagram::setHeaderFlags(uint8_t set, uint8_t clear)
{
_driver.setHeaderFlags(set, clear);
}

uint8_t RHDatagram::headerTo()
{
return _driver.headerTo();
}

uint8_t RHDatagram::headerFrom()
{
return _driver.headerFrom();
}

uint8_t RHDatagram::headerId()
{
return _driver.headerId();
}

uint8_t RHDatagram::headerFlags()
{
return _driver.headerFlags();
}



Loading

0 comments on commit 3d52fd7

Please sign in to comment.