add defines for samd (maybe wrong)

This commit is contained in:
Thomas Kunze 2018-06-04 23:06:42 +02:00
parent d710ec327b
commit 3f0016a0bd

10
bits.h
View File

@ -7,6 +7,16 @@
#define lowByte(val) ((val) & 255) #define lowByte(val) ((val) & 255)
#define highByte(val) (((val) >> ((sizeof(val) - 1) << 3)) & 255) #define highByte(val) (((val) >> ((sizeof(val) - 1) << 3)) & 255)
#define bitRead(val, bitno) (((val) >> (bitno)) & 1) #define bitRead(val, bitno) (((val) >> (bitno)) & 1)
#elif ARDUINO_ARCH_SAMD
#include <Arduino.h>
#define htons(x) ( ((x)<<8) | (((x)>>8)&0xFF) )
#define ntohs(x) htons(x)
#define htonl(x) ( ((x)<<24 & 0xFF000000UL) | \
((x)<< 8 & 0x00FF0000UL) | \
((x)>> 8 & 0x0000FF00UL) | \
((x)>>24 & 0x000000FFUL) )
#define ntohl(x) htonl(x)
#define printf
#else #else
#include <Arduino.h> #include <Arduino.h>
#include <user_interface.h> #include <user_interface.h>