diff options
Diffstat (limited to 'stmhal/cc3k/cc3000_common.c')
-rw-r--r-- | stmhal/cc3k/cc3000_common.c | 62 |
1 files changed, 16 insertions, 46 deletions
diff --git a/stmhal/cc3k/cc3000_common.c b/stmhal/cc3k/cc3000_common.c index 400b56a9ca..51c299c446 100644 --- a/stmhal/cc3k/cc3000_common.c +++ b/stmhal/cc3k/cc3000_common.c @@ -3,14 +3,6 @@ * cc3000_common.c.c - CC3000 Host Driver Implementation. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/ * -* Adapted for use with the Arduino/AVR by KTOWN (Kevin Townsend) -* & Limor Fried for Adafruit Industries -* This library works with the Adafruit CC3000 breakout -* ----> https://www.adafruit.com/products/1469 -* Adafruit invests time and resources providing this open source code, -* please support Adafruit and open-source hardware by purchasing -* products from Adafruit! -* * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: @@ -60,7 +52,6 @@ #include "socket.h" #include "wlan.h" #include "evnt_handler.h" -#include "ccdebug.h" //***************************************************************************** // @@ -96,12 +87,12 @@ __error__(char *pcFilename, unsigned long ulLine) // //***************************************************************************** -uint8_t* UINT32_TO_STREAM_f (uint8_t *p, uint32_t u32) +unsigned char* UINT32_TO_STREAM_f (unsigned char *p, unsigned long u32) { - *(p)++ = (uint8_t)(u32); - *(p)++ = (uint8_t)((u32) >> 8); - *(p)++ = (uint8_t)((u32) >> 16); - *(p)++ = (uint8_t)((u32) >> 24); + *(p)++ = (unsigned char)(u32); + *(p)++ = (unsigned char)((u32) >> 8); + *(p)++ = (unsigned char)((u32) >> 16); + *(p)++ = (unsigned char)((u32) >> 24); return p; } @@ -119,10 +110,10 @@ uint8_t* UINT32_TO_STREAM_f (uint8_t *p, uint32_t u32) // //***************************************************************************** -uint8_t* UINT16_TO_STREAM_f (uint8_t *p, uint16_t u16) +unsigned char* UINT16_TO_STREAM_f (unsigned char *p, unsigned short u16) { - *(p)++ = (uint8_t)(u16); - *(p)++ = (uint8_t)((u16) >> 8); + *(p)++ = (unsigned char)(u16); + *(p)++ = (unsigned char)((u16) >> 8); return p; } @@ -140,20 +131,10 @@ uint8_t* UINT16_TO_STREAM_f (uint8_t *p, uint16_t u16) // //***************************************************************************** -uint16_t STREAM_TO_UINT16_f(char* cp, uint16_t offset) +unsigned short STREAM_TO_UINT16_f(char* p, unsigned short offset) { - uint8_t *p = (uint8_t *)cp; - /* - DEBUGPRINT_F("Stream2u16: "); - DEBUGPRINT_HEX(cp[offset+1]); - DEBUGPRINT_F(" + "); - DEBUGPRINT_HEX(cp[offset]); - DEBUGPRINT_F("\n\r"); - */ - - return (uint16_t)((uint16_t) - ((uint16_t)(*(p + offset + 1)) << 8) + - (uint16_t)(*(p + offset))); + return (unsigned short)((unsigned short)((unsigned short) + (*(p + offset + 1)) << 8) + (unsigned short)(*(p + offset))); } //***************************************************************************** @@ -170,23 +151,12 @@ uint16_t STREAM_TO_UINT16_f(char* cp, uint16_t offset) // //***************************************************************************** -uint32_t STREAM_TO_UINT32_f(char * cp, uint16_t offset) +unsigned long STREAM_TO_UINT32_f(char* p, unsigned short offset) { - uint8_t *p = (uint8_t *)cp; - - /* - DEBUGPRINT_F("\tStream2u32: "); - DEBUGPRINT_HEX(cp[offset+3]); DEBUGPRINT_F(" + "); - DEBUGPRINT_HEX(cp[offset+2]); DEBUGPRINT_F(" + "); - DEBUGPRINT_HEX(cp[offset+1]); DEBUGPRINT_F(" + "); - DEBUGPRINT_HEX(cp[offset]); - DEBUGPRINT_F("\n\r"); - */ - - return (uint32_t)((uint32_t)((uint32_t) - (*(p + offset + 3)) << 24) + (uint32_t)((uint32_t) - (*(p + offset + 2)) << 16) + (uint32_t)((uint32_t) - (*(p + offset + 1)) << 8) + (uint32_t)(*(p + offset))); + return (unsigned long)((unsigned long)((unsigned long) + (*(p + offset + 3)) << 24) + (unsigned long)((unsigned long) + (*(p + offset + 2)) << 16) + (unsigned long)((unsigned long) + (*(p + offset + 1)) << 8) + (unsigned long)(*(p + offset))); } |