gcode-interpreter

A gcode interpreter I use to control lasers.
git clone git://git.christianermann.dev/gcode-interpreter
Log | Files | Refs | README | LICENSE

command.h (717B)


      1 #ifndef COMMAND_H
      2 #define COMMAND_H
      3 
      4 #include "token.h"
      5 
      6 #include <stdbool.h>
      7 
      8 typedef enum {
      9     CODE_G = TOKEN_G_CODE,
     10     CODE_M = TOKEN_M_CODE,
     11 } CodeType;
     12 
     13 typedef struct {
     14     bool is_set;
     15     CodeType type;
     16     unsigned int value;
     17 } Code;
     18 
     19 typedef struct {
     20     bool is_set;
     21     float value;
     22 } Param;
     23 
     24 typedef struct {
     25     Code code;
     26     Param param_s;
     27     Param param_x;
     28     Param param_y;
     29     Param param_z;
     30     Param param_e;
     31     Param param_f;
     32 } Command;
     33 
     34 typedef enum {
     35     COMMAND_STATUS__UNRECOGNIZED_TOKEN,
     36     COMMAND_STATUS__NOT_READY,
     37     COMMAND_STATUS__READY,
     38 } CommandStatus;
     39 
     40 void command_init(Command* command);
     41 CommandStatus command_process_token(Command* command, const Token* token);
     42 
     43 #endif