Added missing (dummy) functions attach and detach interrupt to SPIClass (taken from SAM version), and added hooks.c for yield function. Note. use of yield() at the moment isn't possible, because the linker seems unable to find the function even though hooks.c is being compiled

This commit is contained in:
Roger Clark 2014-12-29 16:51:35 +11:00
parent 907db363d1
commit d188c06504
4 changed files with 45 additions and 0 deletions

View File

@ -31,5 +31,6 @@
void setup();
void loop();
void yield(void);
#endif

View File

@ -0,0 +1,31 @@
/*
Copyright (c) 2012 Arduino. All right reserved.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
/**
* Empty yield() hook.
*
* This function is intended to be used by library writers to build
* libraries or sketches that supports cooperative threads.
*
* Its defined as a weak symbol and it can be redefined to implement a
* real cooperative scheduler.
*/
static void __empty() {
// Empty
}
void yield(void) __attribute__ ((weak, alias("__empty")));

View File

@ -286,6 +286,14 @@ uint8 SPIClass::transfer(uint8 byte) {
return this->read();
}
void SPIClass::attachInterrupt(void) {
// Should be enableInterrupt()
}
void SPIClass::detachInterrupt(void) {
// Should be disableInterrupt()
}
/*
* Pin accessors
*/

View File

@ -191,6 +191,11 @@ public:
void setBitOrder(uint8_t bitOrder);
void setdataMode(uint8_t dataMode);
// SPI Configuration methods
void attachInterrupt(void);
void detachInterrupt(void);
/*
* I/O
*/