/* Copyright (c) 2014, Nordic Semiconductor ASA * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in all * copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ #ifndef PLATFORM_H__ #define PLATFORM_H__ /** @file * @brief */ //Board dependent defines #if defined (__AVR__) //For Arduino this AVR specific library has to be used for reading from Flash memory #include #include "Arduino.h" #ifdef PROGMEM #undef PROGMEM #define PROGMEM __attribute__(( section(".progmem.data") )) #endif #elif defined(__PIC32MX__) //For Chipkit add the following libraries. #include #include #include #include #include #else /* GCC */ #include #include #include #include #include #include #include #include "syssvc/serial.h" #include "syssvc/syslog.h" #include "device.h" #include "pinmode.h" #include "spi.h" #define delay dly_tsk #define noInterrupts loc_cpu #define interrupts unl_cpu #define sil_orw_mem(a, b) sil_wrw_mem((a), sil_rew_mem(a) | (b)) #define PORT_HIGH 1 #define PORT_LOW 0 #define LOW PORT_LOW #define HIGH PORT_HIGH #define INPUT 0 #define INPUT_PULLUP 1 #define OUTPUT 2 #endif //For making the Serial.Print compatible between Arduino and Chipkit #define F(X) (X) //For ChipKit neither PROGMEM or PSTR are needed for PIC32 #define PROGMEM #define PSTR(s) (s) #define pgm_read_byte(x) (*((char *)x)) #define pgm_read_byte_near(x) (*((char *)x)) #define pgm_read_byte_far(x) (*((char *)x)) #define pgm_read_word(x) (*((short *)x)) #define pgm_read_word_near(x) (*((short *)x)) #define pgm_read_workd_far(x) (*((short *)x)) #define prog_void const void #define prog_char const char #define prog_uchar const unsigned char #define prog_int8_t const int8_t #define prog_uint8_t const uint8_t #define prog_int16_t const int16_t #define prog_uint16_t const uint16_t #define prog_int32_t const int32_t #define prog_uint32_t const uint32_t #define prog_int64_t const int64_t #define prog_uint64_t const uint64_t //Redefine the function for reading from flash in ChipKit #define memcpy_P memcpy #endif /* PLATFORM_H__ */