diff options
author | Cristian Maglie <c.maglie@bug.st> | 2013-04-03 13:51:04 +0200 |
---|---|---|
committer | Cristian Maglie <c.maglie@bug.st> | 2013-04-03 13:51:04 +0200 |
commit | ee90e68e86dd61d86f5d17b69080338328765b22 (patch) | |
tree | e620c0edc2690ab789b665e567910640597aa6fe /libraries/WiFi/utility/spi_drv.h | |
parent | 0ecdc5ebc96ad4c7c548c438a03d9ce00679db8b (diff) | |
parent | f50c307be280dc6ece9e70c43b301c1db36291a0 (diff) |
Merged 1.0.5
Merge remote-tracking branch 'arduino/master' into ide-1.5.x
Conflicts:
app/src/processing/app/Base.java
build/shared/revisions.txt
hardware/arduino/avr/cores/arduino/malloc.c
hardware/arduino/cores/arduino/avr-libc/malloc.c
hardware/arduino/cores/arduino/malloc.c
todo.txt
Diffstat (limited to 'libraries/WiFi/utility/spi_drv.h')
-rw-r--r-- | libraries/WiFi/utility/spi_drv.h | 166 |
1 files changed, 83 insertions, 83 deletions
diff --git a/libraries/WiFi/utility/spi_drv.h b/libraries/WiFi/utility/spi_drv.h index 5c2e706..b7e4cb7 100644 --- a/libraries/WiFi/utility/spi_drv.h +++ b/libraries/WiFi/utility/spi_drv.h @@ -1,83 +1,83 @@ -#ifndef SPI_Drv_h
-#define SPI_Drv_h
-
-#include <inttypes.h>
-#include "wifi_spi.h"
-
-#define SPI_START_CMD_DELAY 12
-
-#define NO_LAST_PARAM 0
-#define LAST_PARAM 1
-
-#define DUMMY_DATA 0xFF
-
-#define WAIT_FOR_SLAVE_SELECT() \
- SpiDrv::waitForSlaveReady(); \
- SpiDrv::spiSlaveSelect();
-
-
-
-class SpiDrv
-{
-private:
- //static bool waitSlaveReady();
- static void waitForSlaveSign();
- static void getParam(uint8_t* param);
-public:
-
- static void begin();
-
- static void end();
-
- static void spiDriverInit();
-
- static void spiSlaveSelect();
-
- static void spiSlaveDeselect();
-
- static char spiTransfer(volatile char data);
-
- static void waitForSlaveReady();
-
- //static int waitSpiChar(char waitChar, char* readChar);
-
- static int waitSpiChar(unsigned char waitChar);
-
- static int readAndCheckChar(char checkChar, char* readChar);
-
- static char readChar();
-
- static int waitResponseParams(uint8_t cmd, uint8_t numParam, tParam* params);
-
- static int waitResponseCmd(uint8_t cmd, uint8_t numParam, uint8_t* param, uint8_t* param_len);
-
- static int waitResponseData8(uint8_t cmd, uint8_t* param, uint8_t* param_len);
-
- static int waitResponseData16(uint8_t cmd, uint8_t* param, uint16_t* param_len);
- /*
- static int waitResponse(uint8_t cmd, tParam* params, uint8_t* numParamRead, uint8_t maxNumParams);
-
- static int waitResponse(uint8_t cmd, uint8_t numParam, uint8_t* param, uint16_t* param_len);
-*/
- static int waitResponse(uint8_t cmd, uint8_t* numParamRead, uint8_t** params, uint8_t maxNumParams);
-
- static void sendParam(uint8_t* param, uint8_t param_len, uint8_t lastParam = NO_LAST_PARAM);
-
- static void sendParamLen8(uint8_t param_len);
-
- static void sendParamLen16(uint16_t param_len);
-
- static uint8_t readParamLen8(uint8_t* param_len = NULL);
-
- static uint16_t readParamLen16(uint16_t* param_len = NULL);
-
- static void sendBuffer(uint8_t* param, uint16_t param_len, uint8_t lastParam = NO_LAST_PARAM);
-
- static void sendParam(uint16_t param, uint8_t lastParam = NO_LAST_PARAM);
-
- static void sendCmd(uint8_t cmd, uint8_t numParam);
-};
-
-extern SpiDrv spiDrv;
-
-#endif
+#ifndef SPI_Drv_h +#define SPI_Drv_h + +#include <inttypes.h> +#include "wifi_spi.h" + +#define SPI_START_CMD_DELAY 10
+ +#define NO_LAST_PARAM 0 +#define LAST_PARAM 1 + +#define DUMMY_DATA 0xFF + +#define WAIT_FOR_SLAVE_SELECT() \ + SpiDrv::waitForSlaveReady(); \ + SpiDrv::spiSlaveSelect(); + + + +class SpiDrv +{ +private: + //static bool waitSlaveReady(); + static void waitForSlaveSign(); + static void getParam(uint8_t* param); +public: + + static void begin(); + + static void end(); + + static void spiDriverInit(); + + static void spiSlaveSelect(); + + static void spiSlaveDeselect(); + + static char spiTransfer(volatile char data); + + static void waitForSlaveReady(); + + //static int waitSpiChar(char waitChar, char* readChar); + + static int waitSpiChar(unsigned char waitChar); + + static int readAndCheckChar(char checkChar, char* readChar); + + static char readChar(); + + static int waitResponseParams(uint8_t cmd, uint8_t numParam, tParam* params); + + static int waitResponseCmd(uint8_t cmd, uint8_t numParam, uint8_t* param, uint8_t* param_len); + + static int waitResponseData8(uint8_t cmd, uint8_t* param, uint8_t* param_len); + + static int waitResponseData16(uint8_t cmd, uint8_t* param, uint16_t* param_len); + /* + static int waitResponse(uint8_t cmd, tParam* params, uint8_t* numParamRead, uint8_t maxNumParams); + + static int waitResponse(uint8_t cmd, uint8_t numParam, uint8_t* param, uint16_t* param_len); +*/ + static int waitResponse(uint8_t cmd, uint8_t* numParamRead, uint8_t** params, uint8_t maxNumParams); + + static void sendParam(uint8_t* param, uint8_t param_len, uint8_t lastParam = NO_LAST_PARAM); + + static void sendParamLen8(uint8_t param_len); + + static void sendParamLen16(uint16_t param_len); + + static uint8_t readParamLen8(uint8_t* param_len = NULL); + + static uint16_t readParamLen16(uint16_t* param_len = NULL); + + static void sendBuffer(uint8_t* param, uint16_t param_len, uint8_t lastParam = NO_LAST_PARAM); + + static void sendParam(uint16_t param, uint8_t lastParam = NO_LAST_PARAM); + + static void sendCmd(uint8_t cmd, uint8_t numParam); +}; + +extern SpiDrv spiDrv; + +#endif |