Initial commit for SAMD compatability
This commit is contained in:
@@ -107,22 +107,22 @@ bool gatewayTransportInit() {
|
||||
while (WiFi.status() != WL_CONNECTED)
|
||||
{
|
||||
delay(500);
|
||||
Serial.print(".");
|
||||
SERIALDEVICE.print(".");
|
||||
yield();
|
||||
}
|
||||
Serial.print(F("IP: "));
|
||||
Serial.println(WiFi.localIP());
|
||||
SERIALDEVICE.print(F("IP: "));
|
||||
SERIALDEVICE.println(WiFi.localIP());
|
||||
|
||||
#else
|
||||
#ifdef MY_IP_ADDRESS
|
||||
Ethernet.begin(_ethernetGatewayMAC, _ethernetGatewayIP);
|
||||
Serial.print(F("IP: "));
|
||||
Serial.println(Ethernet.localIP());
|
||||
SERIALDEVICE.print(F("IP: "));
|
||||
SERIALDEVICE.println(Ethernet.localIP());
|
||||
#else
|
||||
// Get IP address from DHCP
|
||||
Ethernet.begin(_ethernetGatewayMAC);
|
||||
Serial.print(F("IP: "));
|
||||
Serial.println(Ethernet.localIP());
|
||||
SERIALDEVICE.print(F("IP: "));
|
||||
SERIALDEVICE.println(Ethernet.localIP());
|
||||
#endif /* IP_ADDRESS_DHCP */
|
||||
// give the Ethernet interface a second to initialize
|
||||
// TODO: use HW delay
|
||||
|
||||
@@ -144,21 +144,21 @@ bool gatewayTransportInit() {
|
||||
while (WiFi.status() != WL_CONNECTED)
|
||||
{
|
||||
delay(500);
|
||||
Serial.print(".");
|
||||
SERIALDEVICE.print(".");
|
||||
yield();
|
||||
}
|
||||
Serial.print(F("IP: "));
|
||||
Serial.println(WiFi.localIP());
|
||||
SERIALDEVICE.print(F("IP: "));
|
||||
SERIALDEVICE.println(WiFi.localIP());
|
||||
#else
|
||||
#ifdef MY_IP_ADDRESS
|
||||
Ethernet.begin(_clientMAC, _clientIp);
|
||||
Serial.print(F("IP: "));
|
||||
Serial.println(Ethernet.localIP());
|
||||
SERIALDEVICE.print(F("IP: "));
|
||||
SERIALDEVICE.println(Ethernet.localIP());
|
||||
#else
|
||||
// Get IP address from DHCP
|
||||
Ethernet.begin(_clientMAC);
|
||||
Serial.print(F("IP: "));
|
||||
Serial.println(Ethernet.localIP());
|
||||
SERIALDEVICE.print(F("IP: "));
|
||||
SERIALDEVICE.println(Ethernet.localIP());
|
||||
#endif /* IP_ADDRESS_DHCP */
|
||||
// give the Ethernet interface a second to initialize
|
||||
// TODO: use HW delay
|
||||
|
||||
@@ -31,7 +31,7 @@ MyMessage _serialMsg;
|
||||
|
||||
|
||||
bool gatewayTransportSend(MyMessage &message) {
|
||||
Serial.print(protocolFormat(message));
|
||||
SERIALDEVICE.print(protocolFormat(message));
|
||||
// Serial print is always successful
|
||||
return true;
|
||||
}
|
||||
@@ -45,9 +45,9 @@ bool gatewayTransportInit() {
|
||||
bool gatewayTransportAvailable() {
|
||||
bool available = false;
|
||||
|
||||
while (Serial.available()) {
|
||||
while (SERIALDEVICE.available()) {
|
||||
// get the new byte:
|
||||
char inChar = (char) Serial.read();
|
||||
char inChar = (char) SERIALDEVICE.read();
|
||||
// if the incoming character is a newline, set a flag
|
||||
// so the main loop can do something about it:
|
||||
if (_serialInputPos < MY_GATEWAY_MAX_RECEIVE_LENGTH - 1 && !available) {
|
||||
|
||||
@@ -36,6 +36,7 @@
|
||||
#include <Arduino.h>
|
||||
#endif
|
||||
|
||||
#define SERIALDEVICE Serial
|
||||
#if defined __AVR_ATmega328P__
|
||||
#ifndef sleep_bod_disable
|
||||
#define sleep_bod_disable() \
|
||||
|
||||
@@ -30,7 +30,7 @@
|
||||
//#include <SPI.h>
|
||||
#endif
|
||||
|
||||
|
||||
#define SERIALDEVICE Serial
|
||||
#define min(a,b) ((a)<(b)?(a):(b))
|
||||
#define max(a,b) ((a)>(b)?(a):(b))
|
||||
|
||||
|
||||
@@ -0,0 +1,151 @@
|
||||
/**
|
||||
* The MySensors Arduino library handles the wireless radio link and protocol
|
||||
* between your home built sensors/actuators and HA controller of choice.
|
||||
* The sensors forms a self healing radio network with optional repeaters. Each
|
||||
* repeater and gateway builds a routing tables in EEPROM which keeps track of the
|
||||
* network topology allowing messages to be routed to nodes.
|
||||
*
|
||||
* Created by Henrik Ekblad <henrik.ekblad@mysensors.org>
|
||||
* Copyright (C) 2013-2015 Sensnology AB
|
||||
* Full contributor list: https://github.com/mysensors/Arduino/graphs/contributors
|
||||
*
|
||||
* Documentation: http://www.mysensors.org
|
||||
* Support Forum: http://forum.mysensors.org
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* version 2 as published by the Free Software Foundation.
|
||||
*/
|
||||
|
||||
#include "MyHwSAMD.h"
|
||||
|
||||
|
||||
/*
|
||||
int8_t pinIntTrigger = 0;
|
||||
void wakeUp() //place to send the interrupts
|
||||
{
|
||||
pinIntTrigger = 1;
|
||||
}
|
||||
void wakeUp2() //place to send the second interrupts
|
||||
{
|
||||
pinIntTrigger = 2;
|
||||
}
|
||||
|
||||
// Watchdog Timer interrupt service routine. This routine is required
|
||||
// to allow automatic WDIF and WDIE bit clearance in hardware.
|
||||
ISR (WDT_vect)
|
||||
{
|
||||
// WDIE & WDIF is cleared in hardware upon entering this ISR
|
||||
wdt_disable();
|
||||
}
|
||||
*/
|
||||
|
||||
static void hwInitConfigBlock( size_t length = 1024)
|
||||
{
|
||||
static bool initDone = false;
|
||||
if (!initDone)
|
||||
{
|
||||
initDone = true;
|
||||
}
|
||||
}
|
||||
|
||||
void hwReadConfigBlock(void* buf, void* adr, size_t length)
|
||||
{
|
||||
hwInitConfigBlock();
|
||||
uint8_t* dst = static_cast<uint8_t*>(buf);
|
||||
int offs = reinterpret_cast<int>(adr);
|
||||
while (length-- > 0)
|
||||
{
|
||||
*dst++ = configBlock[offs++];
|
||||
}
|
||||
}
|
||||
|
||||
void hwWriteConfigBlock(void* buf, void* adr, size_t length)
|
||||
{
|
||||
hwInitConfigBlock();
|
||||
uint8_t* src = static_cast<uint8_t*>(buf);
|
||||
int offs = reinterpret_cast<int>(adr);
|
||||
while (length-- > 0)
|
||||
{
|
||||
configBlock[offs++] = *src++;
|
||||
}
|
||||
}
|
||||
|
||||
uint8_t hwReadConfig(int adr)
|
||||
{
|
||||
uint8_t value;
|
||||
hwReadConfigBlock(&value, reinterpret_cast<void*>(adr), 1);
|
||||
return value;
|
||||
}
|
||||
|
||||
void hwWriteConfig(int adr, uint8_t value)
|
||||
{
|
||||
uint8_t curr = hwReadConfig(adr);
|
||||
if (curr != value)
|
||||
{
|
||||
hwWriteConfigBlock(&value, reinterpret_cast<void*>(adr), 1);
|
||||
}
|
||||
}
|
||||
|
||||
void hwInit() {
|
||||
SERIALDEVICE.begin(MY_BAUD_RATE);
|
||||
while (!SERIALDEVICE) {}
|
||||
}
|
||||
|
||||
void hwWatchdogReset() {
|
||||
// TODO: Not supported!
|
||||
}
|
||||
|
||||
void hwReboot() {
|
||||
// TODO: Not supported!
|
||||
}
|
||||
|
||||
void hwSleep(unsigned long ms) {
|
||||
// TODO: Not supported!
|
||||
ms = ms + 1;
|
||||
}
|
||||
|
||||
bool hwSleep(uint8_t interrupt, uint8_t mode, unsigned long ms) {
|
||||
// TODO: Not supported!
|
||||
interrupt = interrupt;
|
||||
mode = mode;
|
||||
ms = ms;
|
||||
return false;
|
||||
}
|
||||
|
||||
uint8_t hwSleep(uint8_t interrupt1, uint8_t mode1, uint8_t interrupt2, uint8_t mode2, unsigned long ms) {
|
||||
// TODO: Not supported!
|
||||
interrupt1 = interrupt1;
|
||||
mode1 = mode1;
|
||||
interrupt2 = interrupt2;
|
||||
mode2 = mode2;
|
||||
ms = ms;
|
||||
return 0;
|
||||
}
|
||||
|
||||
#ifdef MY_DEBUG
|
||||
void hwDebugPrint(const char *fmt, ... ) {
|
||||
char fmtBuffer[300];
|
||||
#ifdef MY_GATEWAY_FEATURE
|
||||
// prepend debug message to be handled correctly by controller (C_INTERNAL, I_LOG_MESSAGE)
|
||||
snprintf(fmtBuffer, 299, PSTR("0;0;%d;0;%d;"), C_INTERNAL, I_LOG_MESSAGE);
|
||||
SERIALDEVICE.print(fmtBuffer);
|
||||
#endif
|
||||
va_list args;
|
||||
va_start (args, fmt );
|
||||
va_end (args);
|
||||
#ifdef MY_GATEWAY_FEATURE
|
||||
// Truncate message if this is gateway node
|
||||
vsnprintf(fmtBuffer, 60, fmt, args);
|
||||
fmtBuffer[59] = '\n';
|
||||
fmtBuffer[60] = '\0';
|
||||
#else
|
||||
vsnprintf(fmtBuffer, 299, fmt, args);
|
||||
#endif
|
||||
va_end (args);
|
||||
SERIALDEVICE.print(fmtBuffer);
|
||||
// SERIALDEVICE.flush();
|
||||
|
||||
//Serial.write(freeRam());
|
||||
}
|
||||
#endif
|
||||
@@ -0,0 +1,64 @@
|
||||
/**
|
||||
* The MySensors Arduino library handles the wireless radio link and protocol
|
||||
* between your home built sensors/actuators and HA controller of choice.
|
||||
* The sensors forms a self healing radio network with optional repeaters. Each
|
||||
* repeater and gateway builds a routing tables in EEPROM which keeps track of the
|
||||
* network topology allowing messages to be routed to nodes.
|
||||
*
|
||||
* Created by Henrik Ekblad <henrik.ekblad@mysensors.org>
|
||||
* Copyright (C) 2013-2015 Sensnology AB
|
||||
* Full contributor list: https://github.com/mysensors/Arduino/graphs/contributors
|
||||
*
|
||||
* Documentation: http://www.mysensors.org
|
||||
* Support Forum: http://forum.mysensors.org
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* version 2 as published by the Free Software Foundation.
|
||||
*/
|
||||
#ifndef MyHwSAMD_h
|
||||
#define MyHwSAMD_h
|
||||
|
||||
#include "MyHw.h"
|
||||
#include "MyConfig.h"
|
||||
|
||||
#include "MyMessage.h"
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
#include <Arduino.h>
|
||||
//#include <SPI.h>
|
||||
#endif
|
||||
|
||||
#include <avr/dtostrf.h>
|
||||
|
||||
#define min(a,b) ((a)<(b)?(a):(b))
|
||||
#define max(a,b) ((a)>(b)?(a):(b))
|
||||
|
||||
|
||||
// Define these as macros to save valuable space
|
||||
|
||||
uint8_t configBlock[1024];
|
||||
#define hwDigitalWrite(__pin, __value) (digitalWrite(__pin, __value))
|
||||
void hwInit();
|
||||
void hwWatchdogReset();
|
||||
void hwReboot();
|
||||
#define hwMillis() millis()
|
||||
|
||||
void hwReadConfigBlock(void* buf, void* adr, size_t length);
|
||||
void hwWriteConfigBlock(void* buf, void* adr, size_t length);
|
||||
void hwWriteConfig(int adr, uint8_t value);
|
||||
uint8_t hwReadConfig(int adr);
|
||||
|
||||
#define SERIALDEVICE SerialUSB
|
||||
|
||||
|
||||
/*
|
||||
#define hwReadConfigBlock(__buf, __adr, __length) ( __length = __length)
|
||||
#define hwWriteConfigBlock(__buf, __adr, __length) ( __length = __length)
|
||||
#define hwWriteConfig(__adr, __value) ( __value = __value)
|
||||
#define hwReadConfig(__adr) (0)
|
||||
*/
|
||||
SPIClass _SPI( &sercom1, PIN_SPI_MISO, PIN_SPI_SCK, PIN_SPI_MOSI );
|
||||
#define USBCON
|
||||
#endif // #ifdef ARDUINO_ARCH_SAMD
|
||||
@@ -37,7 +37,7 @@ void inclusionModeSet(boolean newMode) {
|
||||
if (newMode != _inclusionMode) {
|
||||
_inclusionMode = newMode;
|
||||
// Send back mode change to controller
|
||||
gatewayTransportSend(buildGw(_msg, I_INCLUSION_MODE).set(_inclusionMode?1:0));
|
||||
gatewayTransportSend(buildGw(_msg, I_INCLUSION_MODE).set((uint8_t)(_inclusionMode?1:0)));
|
||||
if (_inclusionMode) {
|
||||
_inclusionStartTime = hwMillis();
|
||||
}
|
||||
|
||||
@@ -3,7 +3,8 @@
|
||||
int main(void) {
|
||||
init();
|
||||
#if defined(USBCON)
|
||||
USBDevice.attach();
|
||||
USBDevice.init();
|
||||
USBDevice.attach();
|
||||
#endif
|
||||
_begin(); // Startup MySensors library
|
||||
|
||||
|
||||
@@ -64,7 +64,7 @@ static void DEBUG_SIGNING_PRINTBUF(const __FlashStringHelper* str, uint8_t* buf,
|
||||
#ifdef MY_GATEWAY_FEATURE
|
||||
// prepend debug message to be handled correctly by controller (C_INTERNAL, I_LOG_MESSAGE)
|
||||
snprintf_P(printBuffer, 299, PSTR("0;0;%d;0;%d;"), C_INTERNAL, I_LOG_MESSAGE);
|
||||
Serial.print(printBuffer);
|
||||
SERIALDEVICE.print(printBuffer);
|
||||
#endif
|
||||
for (int i=0; i<sz; i++)
|
||||
{
|
||||
@@ -76,12 +76,12 @@ static void DEBUG_SIGNING_PRINTBUF(const __FlashStringHelper* str, uint8_t* buf,
|
||||
// Truncate message if this is gateway node
|
||||
printBuffer[59-strlen_P((const char*)str)] = '\0';
|
||||
#endif
|
||||
Serial.print(str);
|
||||
SERIALDEVICE.print(str);
|
||||
if (sz > 0)
|
||||
{
|
||||
Serial.print(printBuffer);
|
||||
SERIALDEVICE.print(printBuffer);
|
||||
}
|
||||
Serial.println("");
|
||||
SERIALDEVICE.println("");
|
||||
}
|
||||
#else
|
||||
#define DEBUG_SIGNING_PRINTBUF(str, buf, sz)
|
||||
|
||||
@@ -66,7 +66,7 @@ static void DEBUG_SIGNING_PRINTBUF(const __FlashStringHelper* str, uint8_t* buf,
|
||||
#ifdef MY_GATEWAY_FEATURE
|
||||
// prepend debug message to be handled correctly by controller (C_INTERNAL, I_LOG_MESSAGE)
|
||||
snprintf_P(printBuffer, 299, PSTR("0;0;%d;0;%d;"), C_INTERNAL, I_LOG_MESSAGE);
|
||||
Serial.print(printBuffer);
|
||||
SERIALDEVICE.print(printBuffer);
|
||||
#endif
|
||||
for (int i=0; i<sz; i++)
|
||||
{
|
||||
@@ -78,12 +78,12 @@ static void DEBUG_SIGNING_PRINTBUF(const __FlashStringHelper* str, uint8_t* buf,
|
||||
// Truncate message if this is gateway node
|
||||
printBuffer[59-strlen_P((const char*)str)] = '\0';
|
||||
#endif
|
||||
Serial.print(str);
|
||||
SERIALDEVICE.print(str);
|
||||
if (sz > 0)
|
||||
{
|
||||
Serial.print(printBuffer);
|
||||
SERIALDEVICE.print(printBuffer);
|
||||
}
|
||||
Serial.println("");
|
||||
SERIALDEVICE.println("");
|
||||
}
|
||||
#else
|
||||
#define DEBUG_SIGNING_PRINTBUF(str, buf, sz)
|
||||
|
||||
@@ -51,7 +51,7 @@ void RF24::csn(bool mode)
|
||||
delayMicroseconds(11); // allow csn to settle
|
||||
}
|
||||
}
|
||||
#elif !defined (__arm__) || defined (CORE_TEENSY)
|
||||
#elif !defined (__arm__) || defined (CORE_TEENSY) || defined(ARDUINO_ARCH_SAMD)
|
||||
digitalWrite(csn_pin,mode);
|
||||
#endif
|
||||
|
||||
@@ -71,7 +71,7 @@ uint8_t RF24::read_register(uint8_t reg, uint8_t* buf, uint8_t len)
|
||||
{
|
||||
uint8_t status;
|
||||
|
||||
#if defined (__arm__) && !defined ( CORE_TEENSY )
|
||||
#if defined (__arm__) && !defined ( CORE_TEENSY ) && !defined (ARDUINO_ARCH_SAMD)
|
||||
status = _SPI.transfer(csn_pin, R_REGISTER | ( REGISTER_MASK & reg ), SPI_CONTINUE );
|
||||
while ( len-- > 1 ){
|
||||
*buf++ = _SPI.transfer(csn_pin,0xff, SPI_CONTINUE);
|
||||
@@ -96,7 +96,7 @@ uint8_t RF24::read_register(uint8_t reg, uint8_t* buf, uint8_t len)
|
||||
uint8_t RF24::read_register(uint8_t reg)
|
||||
{
|
||||
|
||||
#if defined (__arm__) && !defined ( CORE_TEENSY )
|
||||
#if defined (__arm__) && !defined ( CORE_TEENSY ) && !defined (ARDUINO_ARCH_SAMD)
|
||||
_SPI.transfer(csn_pin, R_REGISTER | ( REGISTER_MASK & reg ) , SPI_CONTINUE);
|
||||
uint8_t result = _SPI.transfer(csn_pin,0xff);
|
||||
#else
|
||||
@@ -116,7 +116,7 @@ uint8_t RF24::write_register(uint8_t reg, const uint8_t* buf, uint8_t len)
|
||||
{
|
||||
uint8_t status;
|
||||
|
||||
#if defined (__arm__) && !defined ( CORE_TEENSY )
|
||||
#if defined (__arm__) && !defined ( CORE_TEENSY ) && !defined (ARDUINO_ARCH_SAMD)
|
||||
status = _SPI.transfer(csn_pin, W_REGISTER | ( REGISTER_MASK & reg ), SPI_CONTINUE );
|
||||
while ( --len){
|
||||
_SPI.transfer(csn_pin,*buf++, SPI_CONTINUE);
|
||||
@@ -146,7 +146,7 @@ uint8_t RF24::write_register(uint8_t reg, uint8_t value)
|
||||
Serial.print(F("write_register(")); print_hex(reg, true); Serial.print(F(",")); print_hex(value, true); Serial.println(F(")"));
|
||||
#endif
|
||||
|
||||
#if defined (__arm__) && !defined ( CORE_TEENSY )
|
||||
#if defined (__arm__) && !defined ( CORE_TEENSY ) && !defined (ARDUINO_ARCH_SAMD)
|
||||
status = _SPI.transfer(csn_pin, W_REGISTER | ( REGISTER_MASK & reg ), SPI_CONTINUE);
|
||||
_SPI.transfer(csn_pin,value);
|
||||
#else
|
||||
@@ -171,7 +171,7 @@ uint8_t RF24::write_payload(const void* buf, uint8_t data_len, const uint8_t wri
|
||||
|
||||
//printf("[Writing %u bytes %u blanks]",data_len,blank_len);
|
||||
|
||||
#if defined (__arm__) && !defined ( CORE_TEENSY )
|
||||
#if defined (__arm__) && !defined ( CORE_TEENSY ) && !defined (ARDUINO_ARCH_SAMD)
|
||||
|
||||
status = _SPI.transfer(csn_pin, writeType , SPI_CONTINUE);
|
||||
|
||||
@@ -220,7 +220,7 @@ uint8_t RF24::read_payload(void* buf, uint8_t data_len)
|
||||
//printf("[Reading %u bytes %u blanks]",data_len,blank_len);
|
||||
|
||||
|
||||
#if defined (__arm__) && !defined ( CORE_TEENSY )
|
||||
#if defined (__arm__) && !defined ( CORE_TEENSY ) && !defined (ARDUINO_ARCH_SAMD)
|
||||
|
||||
status = _SPI.transfer(csn_pin, R_RX_PAYLOAD, SPI_CONTINUE );
|
||||
|
||||
@@ -276,7 +276,7 @@ uint8_t RF24::flush_tx(void)
|
||||
uint8_t RF24::spiTrans(uint8_t cmd){
|
||||
|
||||
uint8_t status;
|
||||
#if defined (__arm__) && !defined ( CORE_TEENSY )
|
||||
#if defined (__arm__) && !defined ( CORE_TEENSY ) && !defined (ARDUINO_ARCH_SAMD)
|
||||
status = _SPI.transfer(csn_pin, cmd );
|
||||
#else
|
||||
|
||||
@@ -481,7 +481,7 @@ void RF24::begin(void)
|
||||
// Initialize pins
|
||||
if (ce_pin != csn_pin) pinMode(ce_pin,OUTPUT);
|
||||
|
||||
#if defined(__arm__) && ! defined( CORE_TEENSY )
|
||||
#if defined(__arm__) && ! defined( CORE_TEENSY ) && !defined (ARDUINO_ARCH_SAMD)
|
||||
_SPI.begin(csn_pin); // Using the extended SPI features of the DUE
|
||||
_SPI.setClockDivider(csn_pin, 9); // Set the bus speed to 8.4mhz on Due
|
||||
_SPI.setBitOrder(csn_pin,MSBFIRST); // Set the bit order and mode specific to this device
|
||||
@@ -888,7 +888,7 @@ uint8_t RF24::getDynamicPayloadSize(void)
|
||||
{
|
||||
uint8_t result = 0;
|
||||
|
||||
#if defined (__arm__) && ! defined( CORE_TEENSY )
|
||||
#if defined (__arm__) && ! defined( CORE_TEENSY ) && !defined (ARDUINO_ARCH_SAMD)
|
||||
_SPI.transfer(csn_pin, R_RX_PL_WID, SPI_CONTINUE );
|
||||
result = _SPI.transfer(csn_pin,0xff);
|
||||
#else
|
||||
@@ -1079,7 +1079,7 @@ void RF24::closeReadingPipe( uint8_t pipe )
|
||||
void RF24::toggle_features(void)
|
||||
{
|
||||
|
||||
#if defined (__arm__) && ! defined( CORE_TEENSY )
|
||||
#if defined (__arm__) && ! defined( CORE_TEENSY ) && !defined (ARDUINO_ARCH_SAMD)
|
||||
_SPI.transfer(csn_pin, ACTIVATE, SPI_CONTINUE );
|
||||
_SPI.transfer(csn_pin, 0x73 );
|
||||
#else
|
||||
@@ -1145,7 +1145,7 @@ void RF24::writeAckPayload(uint8_t pipe, const void* buf, uint8_t len)
|
||||
|
||||
uint8_t data_len = min(len,32);
|
||||
|
||||
#if defined (__arm__) && ! defined( CORE_TEENSY )
|
||||
#if defined (__arm__) && ! defined( CORE_TEENSY ) && !defined (ARDUINO_ARCH_SAMD)
|
||||
_SPI.transfer(csn_pin, W_ACK_PAYLOAD | ( pipe & B111 ), SPI_CONTINUE);
|
||||
while ( data_len-- > 1 ){
|
||||
_SPI.transfer(csn_pin,*current++, SPI_CONTINUE);
|
||||
|
||||
@@ -28,12 +28,11 @@
|
||||
/**********************/
|
||||
|
||||
// Define _BV for non-Arduino platforms and for Arduino DUE
|
||||
#if defined (ARDUINO) && !defined (__arm__)
|
||||
#if defined (ARDUINO) && !defined (__arm__) && !defined(_SPI)
|
||||
#if defined(__AVR_ATtiny25__) || defined(__AVR_ATtiny45__) || defined(__AVR_ATtiny85__) || defined(__AVR_ATtiny24__) || defined(__AVR_ATtiny44__) || defined(__AVR_ATtiny84__)
|
||||
#define RF24_TINY
|
||||
#define _SPI SPI
|
||||
#else
|
||||
#if defined SPI_UART
|
||||
#elif defined SPI_UART
|
||||
#include <SPI_UART.h>
|
||||
#define _SPI uspi
|
||||
#elif defined MY_SOFTSPI
|
||||
@@ -46,11 +45,12 @@
|
||||
|
||||
const uint8_t SPI_MODE = 0;
|
||||
#define _SPI spi
|
||||
|
||||
#elif defined(ARDUINO_ARCH_SAMD)
|
||||
#include <SPI.h>
|
||||
#define _SPI SPI1
|
||||
#else
|
||||
#include <SPI.h>
|
||||
#define _SPI SPI
|
||||
#endif
|
||||
#endif
|
||||
#else
|
||||
#include <stdint.h>
|
||||
@@ -70,10 +70,10 @@
|
||||
#else
|
||||
#define printf Serial.printf
|
||||
#endif
|
||||
|
||||
#if ! defined(_SPI)
|
||||
#define _SPI SPI
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
// Avoid spurious warnings
|
||||
// Arduino DUE is arm and uses traditional PROGMEM constructs
|
||||
@@ -101,7 +101,7 @@
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if !defined ( CORE_TEENSY ) && ! defined(ESP8266)
|
||||
#if !defined ( CORE_TEENSY ) && ! defined(ESP8266) && ! defined(ARDUINO_ARCH_SAMD)
|
||||
typedef uint16_t prog_uint16_t;
|
||||
#define PSTR(x) (x)
|
||||
#define printf_P printf
|
||||
|
||||
Reference in New Issue
Block a user