1234567891011121314151617181920212223242526272829303132333435363738 |
- // Mid Level Utility Function: cm_ReadCommand()
- //
- // Note: this module must be after all low level functions in the library and
- // before all high level user function to assure that any reference to
- // this function in this library are satistified.
- #include "CM_LIB.h"
- #include "CM_I2C.h"
- #include "CM_I2C_L.h"
- #include <unistd.h>
- #include <stdio.h>
- #include "linux/fcntl.h"
- #include "driver.h"
- #include <string.h>
- uint8_t cm_ReadCommand(uint8_t * pucInsBuff, uint8_t * pucRetVal, uint8_t ucLen)
- {
- uint8_t ucReturn;
-
- if(ucLen < 1)
- {
- printf("Invalid ucLen %d\n", ucLen);
- return -1;
- }
- if ((ucReturn = CM_LOW_LEVEL.SendCommand(pucInsBuff)) != SUCCESS) return ucReturn;
- ucReturn = CM_LOW_LEVEL.ReceiveRet(pucRetVal, ucLen);
- // printf("---> cm_ReadCommand: %#02x %#02x %#02x %#02x - ", pucInsBuff[0], pucInsBuff[1], pucInsBuff[2], pucInsBuff[3]);
- // int i;
- // for (i = 0; i < ucLen; i++)
- // {
- // printf("%#02x ", pucRetVal[i]);
- // }
- // printf("\n");
- return ucReturn;
- }
|