initial commit with at least some code that does something

This commit is contained in:
prozessorkern
2019-06-10 22:34:12 +02:00
parent 3d60361bc5
commit f15b7473a9
3 changed files with 133 additions and 0 deletions

41
api/shellmatta.h Normal file
View File

@@ -0,0 +1,41 @@
#include <stdint.h>
typedef enum
{
SHELLMATTA_OK = 0u
, SHELLMATTA_ERROR
, SHELLMATTA_CONTINUE
, SHELLMATTA_USE_FAULT
} shellmatta_retCode_t;
typedef shellmatta_retCode_t (*shellmatta_cmdFct_t)(int argc, char *argv[]);
typedef struct shellmatta_cmd
{
char *cmd;
char *cmdAlias;
char *helpText;
char *usageText;
shellmatta_cmdFct_t cmdFct;
struct shellmatta_cmd *next;
} shellmatta_cmd_t;
typedef struct
{
uint8_t *buffer;
uint32_t bufferSize;
uint32_t bufferWritePointer;
uint32_t bufferReadPointer;
uint8_t *historyBuffer;
uint32_t historyBufferSize;
shellmatta_cmd_t *cmdList;
} shellmatta_instance_t;
extern void shellmatta_doInit(shellmatta_instance_t *inst, uint8_t *buffer, uint32_t bufferSize, uint8_t *historyBuffer, uint32_t historyBufferSize);
extern void shellmatta_addCmd(shellmatta_instance_t *inst, shellmatta_cmd_t *cmd);
extern void shellmatta_doTask(shellmatta_instance_t *inst, uint32_t time);
extern void shellmatta_processData(shellmatta_instance_t *inst, char *data, uint32_t size);
extern void shellmatta_printf(shellmatta_instance_t *inst, const char *fmt, ...);
extern void shellmatta_getArg(uint32_t cnt, uint8_t *arg);