Skip to content

Instantly share code, notes, and snippets.

@zarya
Created October 13, 2014 13:25
Show Gist options
  • Save zarya/eeb2220e1b3e20ff5684 to your computer and use it in GitHub Desktop.
Save zarya/eeb2220e1b3e20ff5684 to your computer and use it in GitHub Desktop.
#include "ets_sys.h"
#include "driver/uart.h"
#include "osapi.h"
#include "os_type.h"
#include "user_interface.h"
#include "functions.h"
int8_t ICACHE_FLASH_ATTR
dataStrCpy(void *pDest, const void *pSrc, int8_t maxLen)
{
char *pTempD = pDest;
const char *pTempS = pSrc;
int8_t len;
if(*pTempS != '\"')
{
return -1;
}
pTempS++;
for(len=0; len<maxLen; len++)
{
if(*pTempS == '\"')
{
*pTempD = '\0';
break;
}
else
{
*pTempD++ = *pTempS++;
}
}
if(len == maxLen)
{
return -1;
}
return len;
}
int8_t dataStrCpy(void *pDest, const void *pSrc, int8_t maxLen);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment