![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
Code for measuring the signal with a specified length and sampling rate, and saving it on a SD card.
Diff: Envelope/envSignal_emxutil.cpp
- Revision:
- 1:a514e4de034d
diff -r c05b00be2229 -r a514e4de034d Envelope/envSignal_emxutil.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Envelope/envSignal_emxutil.cpp Fri Jul 14 14:41:10 2017 +0000 @@ -0,0 +1,169 @@ +// +// Academic License - for use in teaching, academic research, and meeting +// course requirements at degree granting institutions only. Not for +// government, commercial, or other organizational use. +// File: envSignal_emxutil.cpp +// +// MATLAB Coder version : 3.3 +// C/C++ source code generated on : 13-Jul-2017 15:47:47 +// + +// Include Files +#include "envSignal.h" +#include "envSignal_emxutil.h" + +// Function Definitions + +// +// Arguments : emxArray__common *emxArray +// int oldNumel +// unsigned int elementSize +// Return Type : void +// +void emxEnsureCapacity(emxArray__common *emxArray, int oldNumel, unsigned int + elementSize) +{ + int newNumel; + int i; + void *newData; + if (oldNumel < 0) { + oldNumel = 0; + } + + newNumel = 1; + for (i = 0; i < emxArray->numDimensions; i++) { + newNumel *= emxArray->size[i]; + } + + if (newNumel > emxArray->allocatedSize) { + i = emxArray->allocatedSize; + if (i < 16) { + i = 16; + } + + while (i < newNumel) { + if (i > 1073741823) { + i = MAX_int32_T; + } else { + i <<= 1; + } + } + + newData = calloc((unsigned int)i, elementSize); + if (emxArray->data != NULL) { + memcpy(newData, emxArray->data, elementSize * oldNumel); + if (emxArray->canFreeData) { + free(emxArray->data); + } + } + + emxArray->data = newData; + emxArray->allocatedSize = i; + emxArray->canFreeData = true; + } +} + +// +// Arguments : emxArray_creal32_T **pEmxArray +// Return Type : void +// +void emxFree_creal32_T(emxArray_creal32_T **pEmxArray) +{ + if (*pEmxArray != (emxArray_creal32_T *)NULL) { + if (((*pEmxArray)->data != (creal32_T *)NULL) && (*pEmxArray)->canFreeData) + { + free((void *)(*pEmxArray)->data); + } + + free((void *)(*pEmxArray)->size); + free((void *)*pEmxArray); + *pEmxArray = (emxArray_creal32_T *)NULL; + } +} + +// +// Arguments : emxArray_real32_T **pEmxArray +// Return Type : void +// +void emxFree_real32_T(emxArray_real32_T **pEmxArray) +{ + if (*pEmxArray != (emxArray_real32_T *)NULL) { + if (((*pEmxArray)->data != (float *)NULL) && (*pEmxArray)->canFreeData) { + free((void *)(*pEmxArray)->data); + } + + free((void *)(*pEmxArray)->size); + free((void *)*pEmxArray); + *pEmxArray = (emxArray_real32_T *)NULL; + } +} + +// +// Arguments : emxArray_creal32_T **pEmxArray +// int numDimensions +// Return Type : void +// +void emxInit_creal32_T(emxArray_creal32_T **pEmxArray, int numDimensions) +{ + emxArray_creal32_T *emxArray; + int i; + *pEmxArray = (emxArray_creal32_T *)malloc(sizeof(emxArray_creal32_T)); + emxArray = *pEmxArray; + emxArray->data = (creal32_T *)NULL; + emxArray->numDimensions = numDimensions; + emxArray->size = (int *)malloc((unsigned int)(sizeof(int) * numDimensions)); + emxArray->allocatedSize = 0; + emxArray->canFreeData = true; + for (i = 0; i < numDimensions; i++) { + emxArray->size[i] = 0; + } +} + +// +// Arguments : emxArray_real32_T **pEmxArray +// int numDimensions +// Return Type : void +// +void emxInit_real32_T(emxArray_real32_T **pEmxArray, int numDimensions) +{ + emxArray_real32_T *emxArray; + int i; + *pEmxArray = (emxArray_real32_T *)malloc(sizeof(emxArray_real32_T)); + emxArray = *pEmxArray; + emxArray->data = (float *)NULL; + emxArray->numDimensions = numDimensions; + emxArray->size = (int *)malloc((unsigned int)(sizeof(int) * numDimensions)); + emxArray->allocatedSize = 0; + emxArray->canFreeData = true; + for (i = 0; i < numDimensions; i++) { + emxArray->size[i] = 0; + } +} + +// +// Arguments : emxArray_real32_T **pEmxArray +// int numDimensions +// Return Type : void +// +void emxInit_real32_T1(emxArray_real32_T **pEmxArray, int numDimensions) +{ + emxArray_real32_T *emxArray; + int i; + *pEmxArray = (emxArray_real32_T *)malloc(sizeof(emxArray_real32_T)); + emxArray = *pEmxArray; + emxArray->data = (float *)NULL; + emxArray->numDimensions = numDimensions; + emxArray->size = (int *)malloc((unsigned int)(sizeof(int) * numDimensions)); + emxArray->allocatedSize = 0; + emxArray->canFreeData = true; + for (i = 0; i < numDimensions; i++) { + emxArray->size[i] = 0; + } +} + +// +// File trailer for envSignal_emxutil.cpp +// +// [EOF] +// +