void frameGenerator() { uint8_t getByte,i=0,nbytes=0; if(isDataAvailable(&bufferOut)==1) { disableTxInterrupt; do { // getByte=getFromBuffer(&bufferOut); if(getByte<=FUNCTION_ID) { setToBuffer(FRAME_START,&bufferTx); txDataLength++; setToBuffer(getByte,&bufferTx); txDataLength++; getByte=getFromBuffer(&bufferOut); setToBuffer(getByte,&bufferTx); txDataLength++; } else { setToBuffer(FRAME_START,&bufferTx); txDataLength++; if(getByte==getMeasureResponse) { getByte=getMeasure; } setToBuffer(getByte,&bufferTx); txDataLength++; nbytes=getFromBuffer(&bufferOut); setToBuffer(nbytes,&bufferTx); txDataLength++; for(i=0; i<nbytes; i++) { getByte=getFromBuffer(&bufferOut); setToBuffer(getByte,&bufferTx); txDataLength++; } } } while(isDataAvailable(&bufferOut)==1); txDataLength=txDataLength-1; SendByte(getFromBuffer(&bufferTx)); } }
interrupt VectorNumber_Vsci1tx void TxInterrupt (void) { //rutina para enviar datos por interrupciones (void)statusSerialRegister1; //borra flags de interrupcion if(txDataLength>0&&isDataAvailable(&bufferTx)) { enableTxInterrupt; serialData=getFromBuffer(&bufferTx); txDataLength--; } else { disableTxInterrupt; } return; }
SidTuneBase* SidTuneBase::getFromStdIn() { buffer_t fileBuf; // We only read as much as fits in the buffer. // This way we avoid choking on huge data. char datb; while (std::cin.get(datb) && fileBuf.size() < MAX_FILELEN) { fileBuf.push_back((uint_least8_t)datb); } return getFromBuffer(&fileBuf.front(), fileBuf.size()); }
char *getFromSetup(char *pContentPtr, const char* pField, int *pReturnSize) { return getFromBuffer(pContentPtr, pField, 1, pReturnSize, ";\r\n"); }
char *getFromHeader(char *pHeaderPtr, const char *pField, int *pReturnSize) { return getFromBuffer(pHeaderPtr, pField, 2, pReturnSize, "\r\n"); }
static char *getFromContent(char *pContentPtr, const char* pField, int *pReturnSize) { return getFromBuffer(pContentPtr, pField, 1, pReturnSize, "\r\n"); }
SidTuneBase* SidTuneBase::read(const uint_least8_t* sourceBuffer, uint_least32_t bufferLen) { return getFromBuffer(sourceBuffer, bufferLen); }