X-Git-Url: http://git.rot13.org/?p=goodfet;a=blobdiff_plain;f=firmware%2Fplatforms%2Fnhbadgeb.h;h=771d28844336db012f97127ac0840096a394f4f7;hp=895df8a99a8b5077d124e51fdfefbc920e110c7a;hb=bf49109a5835ae36bac4d114825ec70b73ea8fd1;hpb=d3411f7280aa79a5d83298c6843091c2bfa5b9c0 diff --git a/firmware/platforms/nhbadgeb.h b/firmware/platforms/nhbadgeb.h index 895df8a..771d288 100644 --- a/firmware/platforms/nhbadgeb.h +++ b/firmware/platforms/nhbadgeb.h @@ -8,19 +8,25 @@ #include #endif +//This nonsense is deprecated. +//Remove as soon as is convenient. #define P5OUT P4OUT #define P5DIR P4DIR #define P5IN P4IN #define P5REN P4REN +#define SPIOUT P4OUT +#define SPIDIR P4DIR +#define SPIIN P4IN +#define SPIREN P4REN + + //LED on P1.0 #define PLEDOUT P1OUT #define PLEDDIR P1DIR #define PLEDPIN BIT0 - -//No longer works for Hope badge. #define SETSS P4OUT|=BIT4 #define CLRSS P4OUT&=~BIT4 #define DIRSS P4DIR|=BIT4; @@ -31,3 +37,14 @@ #define SETCE P4OUT|=BIT5 #define CLRCE P4OUT&=~BIT5 #define DIRCE P4DIR|=BIT5 + +// network byte order converters +#define htons(x) ((((uint16_t)(x) & 0xFF00) >> 8) | \ + (((uint16_t)(x) & 0x00FF) << 8)) +#define htonl(x) ((((uint32_t)(x) & 0xFF000000) >> 24) | \ + (((uint32_t)(x) & 0x00FF0000) >> 8) | \ + (((uint32_t)(x) & 0x0000FF00) << 8) | \ + (((uint32_t)(x) & 0x000000FF) << 24)) + +#define ntohs htons +#define ntohl htonl