Bayley Wang
/
pyroflex_AND
control the laser with the MBED
Diff: CommandProcessor/cmd_helpers.cpp
- Revision:
- 1:d42ef49f54df
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/CommandProcessor/cmd_helpers.cpp Mon Nov 11 03:38:40 2019 +0000 @@ -0,0 +1,31 @@ +#include "mbed.h" + +#include "CommandProcessor.h" +#include "prefs.h" + +int tokenize(char *buf, char **out, int max) { + char* tok; + int k = 0; + + tok = strtok(buf, " "); + + while(tok != NULL && k < max) { + out[k] = tok; + k++; + tok = strtok(NULL, " "); + } + return k; +} + +#define __check(x) if(strcmp(s, #x) == 0) return &_##x +#define __check2(x) if (strcmp(s, #x) == 0) return &x + +float* checkf(char *s) { + return NULL; +} + +int* checkn(char *s) { + __check(PULSE_WIDTH); + __check(PULSE_FREQ); + return NULL; +} \ No newline at end of file