// Generated by HASHGEN (https://github.com/eddyem/eddys_snippets/tree/master/stringHash4MCU_)
// Licensed by GPLv3
#include <stdint.h>
#include <stddef.h>
#include "hdr.h"

#ifndef WAL
#define WAL __attribute__ ((weak, alias ("__f1")))
#endif

static int __f1(uint32_t _U_ h, char _U_ *a){return 1;}

char lastcmd[CMD_MAXLEN + 1];

int fn_abspos(uint32_t _U_ hash, char _U_ *args) WAL; // "abspos" (3056382221)

int fn_accel(uint32_t _U_ hash, char _U_ *args) WAL; // "accel" (1490521981)

int fn_adc(uint32_t _U_ hash, char _U_ *args) WAL; // "adc" (2963026093)

int fn_button(uint32_t _U_ hash, char _U_ *args) WAL; // "button" (1093508897)

int fn_canerrcodes(uint32_t _U_ hash, char _U_ *args) WAL; // "canerrcodes" (1736697870)

int fn_canfilter(uint32_t _U_ hash, char _U_ *args) WAL; // "canfilter" (3964416573)

int fn_canflood(uint32_t _U_ hash, char _U_ *args) WAL; // "canflood" (1235816779)

int fn_canfloodt(uint32_t _U_ hash, char _U_ *args) WAL; // "canfloodT" (506574623)

int fn_canid(uint32_t _U_ hash, char _U_ *args) WAL; // "canid" (2040257924)

int fn_canignore(uint32_t _U_ hash, char _U_ *args) WAL; // "canignore" (3209755195)

int fn_canincrflood(uint32_t _U_ hash, char _U_ *args) WAL; // "canincrflood" (3987155959)

int fn_canpause(uint32_t _U_ hash, char _U_ *args) WAL; // "canpause" (3981532373)

int fn_canreinit(uint32_t _U_ hash, char _U_ *args) WAL; // "canreinit" (2030075842)

int fn_canresume(uint32_t _U_ hash, char _U_ *args) WAL; // "canresume" (2051659720)

int fn_cansend(uint32_t _U_ hash, char _U_ *args) WAL; // "cansend" (237136225)

int fn_canspeed(uint32_t _U_ hash, char _U_ *args) WAL; // "canspeed" (549265992)

int fn_canstat(uint32_t _U_ hash, char _U_ *args) WAL; // "canstat" (237384179)

int fn_diagn(uint32_t _U_ hash, char _U_ *args) WAL; // "diagn" (2334137736)

int fn_drvtype(uint32_t _U_ hash, char _U_ *args) WAL; // "drvtype" (3930242451)

int fn_dumpcmd(uint32_t _U_ hash, char _U_ *args) WAL; // "dumpcmd" (1223955823)

int fn_dumpconf(uint32_t _U_ hash, char _U_ *args) WAL; // "dumpconf" (3271513185)

int fn_dumperr(uint32_t _U_ hash, char _U_ *args) WAL; // "dumperr" (1223989764)

int fn_dumpmot(uint32_t _U_ hash, char _U_ *args) WAL; // "dumpmot" (1224122507)

int fn_dumpmotflags(uint32_t _U_ hash, char _U_ *args) WAL; // "dumpmotflags" (36159640)

int fn_dumpstates(uint32_t _U_ hash, char _U_ *args) WAL; // "dumpstates" (4235564367)

int fn_emstop(uint32_t _U_ hash, char _U_ *args) WAL; // "emstop" (2965919005)

int fn_eraseflash(uint32_t _U_ hash, char _U_ *args) WAL; // "eraseflash" (3177247267)

int fn_esw(uint32_t _U_ hash, char _U_ *args) WAL; // "esw" (2963094612)

int fn_eswreact(uint32_t _U_ hash, char _U_ *args) WAL; // "eswreact" (1614224995)

int fn_goto(uint32_t _U_ hash, char _U_ *args) WAL; // "goto" (4286309438)

int fn_gotoz(uint32_t _U_ hash, char _U_ *args) WAL; // "gotoz" (3178103736)

int fn_gpio(uint32_t _U_ hash, char _U_ *args) WAL; // "gpio" (4286324660)

int fn_gpioconf(uint32_t _U_ hash, char _U_ *args) WAL; // "gpioconf" (1309721562)

int fn_help(uint32_t _U_ hash, char _U_ *args) WAL; // "help" (4288288686)

int fn_maxspeed(uint32_t _U_ hash, char _U_ *args) WAL; // "maxspeed" (1498078812)

int fn_maxsteps(uint32_t _U_ hash, char _U_ *args) WAL; // "maxsteps" (1506667002)

int fn_mcut(uint32_t _U_ hash, char _U_ *args) WAL; // "mcut" (4022718)

int fn_mcuvdd(uint32_t _U_ hash, char _U_ *args) WAL; // "mcuvdd" (2517587080)

int fn_microsteps(uint32_t _U_ hash, char _U_ *args) WAL; // "microsteps" (3974395854)

int fn_minspeed(uint32_t _U_ hash, char _U_ *args) WAL; // "minspeed" (3234848090)

int fn_motcurrent(uint32_t _U_ hash, char _U_ *args) WAL; // "motcurrent" (1926997848)

int fn_motflags(uint32_t _U_ hash, char _U_ *args) WAL; // "motflags" (2153634658)

int fn_motmul(uint32_t _U_ hash, char _U_ *args) WAL; // "motmul" (1543400099)

int fn_motno(uint32_t _U_ hash, char _U_ *args) WAL; // "motno" (544673586)

int fn_motreinit(uint32_t _U_ hash, char _U_ *args) WAL; // "motreinit" (199682784)

int fn_pdn(uint32_t _U_ hash, char _U_ *args) WAL; // "pdn" (2963275719)

int fn_ping(uint32_t _U_ hash, char _U_ *args) WAL; // "ping" (10561715)

int fn_relpos(uint32_t _U_ hash, char _U_ *args) WAL; // "relpos" (1278646042)

int fn_relslow(uint32_t _U_ hash, char _U_ *args) WAL; // "relslow" (1742971917)

int fn_reset(uint32_t _U_ hash, char _U_ *args) WAL; // "reset" (1907803304)

int fn_saveconf(uint32_t _U_ hash, char _U_ *args) WAL; // "saveconf" (141102426)

int fn_screen(uint32_t _U_ hash, char _U_ *args) WAL; // "screen" (2100809349)

int fn_speedlimit(uint32_t _U_ hash, char _U_ *args) WAL; // "speedlimit" (1654184245)

int fn_state(uint32_t _U_ hash, char _U_ *args) WAL; // "state" (2216628902)

int fn_stop(uint32_t _U_ hash, char _U_ *args) WAL; // "stop" (17184971)

int fn_time(uint32_t _U_ hash, char _U_ *args) WAL; // "time" (19148340)

int fn_tmcbus(uint32_t _U_ hash, char _U_ *args) WAL; // "tmcbus" (1906135955)

int fn_udata(uint32_t _U_ hash, char _U_ *args) WAL; // "udata" (2736127636)

int fn_usartstatus(uint32_t _U_ hash, char _U_ *args) WAL; // "usartstatus" (4007098968)

int fn_vdrive(uint32_t _U_ hash, char _U_ *args) WAL; // "vdrive" (2172773525)

int fn_vfive(uint32_t _U_ hash, char _U_ *args) WAL; // "vfive" (3017477285)

static uint32_t hashf(const char *str){
    uint32_t hash = 5381;
    uint32_t c;
    while((c = (uint32_t)*str++))
        hash = ((hash << 7) + hash) + c;
    return hash;
}

int parsecmd(const char *str){
        if(!str || !*str) return RET_CMDNOTFOUND;
        int i = 0;
        while(*str > '@' && i < CMD_MAXLEN){ lastcmd[i++] = *str++; }
        lastcmd[i] = 0;
        while(*str && *str <= ' ') ++str;
        char *args = (char*) str;
        uint32_t h = hashf(lastcmd);
        switch(h){

        case CMD_ABSPOS:
            return fn_abspos(h, args);
        break;
        case CMD_ACCEL:
            return fn_accel(h, args);
        break;
        case CMD_ADC:
            return fn_adc(h, args);
        break;
        case CMD_BUTTON:
            return fn_button(h, args);
        break;
        case CMD_CANERRCODES:
            return fn_canerrcodes(h, args);
        break;
        case CMD_CANFILTER:
            return fn_canfilter(h, args);
        break;
        case CMD_CANFLOOD:
            return fn_canflood(h, args);
        break;
        case CMD_CANFLOODT:
            return fn_canfloodt(h, args);
        break;
        case CMD_CANID:
            return fn_canid(h, args);
        break;
        case CMD_CANIGNORE:
            return fn_canignore(h, args);
        break;
        case CMD_CANINCRFLOOD:
            return fn_canincrflood(h, args);
        break;
        case CMD_CANPAUSE:
            return fn_canpause(h, args);
        break;
        case CMD_CANREINIT:
            return fn_canreinit(h, args);
        break;
        case CMD_CANRESUME:
            return fn_canresume(h, args);
        break;
        case CMD_CANSEND:
            return fn_cansend(h, args);
        break;
        case CMD_CANSPEED:
            return fn_canspeed(h, args);
        break;
        case CMD_CANSTAT:
            return fn_canstat(h, args);
        break;
        case CMD_DIAGN:
            return fn_diagn(h, args);
        break;
        case CMD_DRVTYPE:
            return fn_drvtype(h, args);
        break;
        case CMD_DUMPCMD:
            return fn_dumpcmd(h, args);
        break;
        case CMD_DUMPCONF:
            return fn_dumpconf(h, args);
        break;
        case CMD_DUMPERR:
            return fn_dumperr(h, args);
        break;
        case CMD_DUMPMOT:
            return fn_dumpmot(h, args);
        break;
        case CMD_DUMPMOTFLAGS:
            return fn_dumpmotflags(h, args);
        break;
        case CMD_DUMPSTATES:
            return fn_dumpstates(h, args);
        break;
        case CMD_EMSTOP:
            return fn_emstop(h, args);
        break;
        case CMD_ERASEFLASH:
            return fn_eraseflash(h, args);
        break;
        case CMD_ESW:
            return fn_esw(h, args);
        break;
        case CMD_ESWREACT:
            return fn_eswreact(h, args);
        break;
        case CMD_GOTO:
            return fn_goto(h, args);
        break;
        case CMD_GOTOZ:
            return fn_gotoz(h, args);
        break;
        case CMD_GPIO:
            return fn_gpio(h, args);
        break;
        case CMD_GPIOCONF:
            return fn_gpioconf(h, args);
        break;
        case CMD_HELP:
            return fn_help(h, args);
        break;
        case CMD_MAXSPEED:
            return fn_maxspeed(h, args);
        break;
        case CMD_MAXSTEPS:
            return fn_maxsteps(h, args);
        break;
        case CMD_MCUT:
            return fn_mcut(h, args);
        break;
        case CMD_MCUVDD:
            return fn_mcuvdd(h, args);
        break;
        case CMD_MICROSTEPS:
            return fn_microsteps(h, args);
        break;
        case CMD_MINSPEED:
            return fn_minspeed(h, args);
        break;
        case CMD_MOTCURRENT:
            return fn_motcurrent(h, args);
        break;
        case CMD_MOTFLAGS:
            return fn_motflags(h, args);
        break;
        case CMD_MOTMUL:
            return fn_motmul(h, args);
        break;
        case CMD_MOTNO:
            return fn_motno(h, args);
        break;
        case CMD_MOTREINIT:
            return fn_motreinit(h, args);
        break;
        case CMD_PDN:
            return fn_pdn(h, args);
        break;
        case CMD_PING:
            return fn_ping(h, args);
        break;
        case CMD_RELPOS:
            return fn_relpos(h, args);
        break;
        case CMD_RELSLOW:
            return fn_relslow(h, args);
        break;
        case CMD_RESET:
            return fn_reset(h, args);
        break;
        case CMD_SAVECONF:
            return fn_saveconf(h, args);
        break;
        case CMD_SCREEN:
            return fn_screen(h, args);
        break;
        case CMD_SPEEDLIMIT:
            return fn_speedlimit(h, args);
        break;
        case CMD_STATE:
            return fn_state(h, args);
        break;
        case CMD_STOP:
            return fn_stop(h, args);
        break;
        case CMD_TIME:
            return fn_time(h, args);
        break;
        case CMD_TMCBUS:
            return fn_tmcbus(h, args);
        break;
        case CMD_UDATA:
            return fn_udata(h, args);
        break;
        case CMD_USARTSTATUS:
            return fn_usartstatus(h, args);
        break;
        case CMD_VDRIVE:
            return fn_vdrive(h, args);
        break;
        case CMD_VFIVE:
            return fn_vfive(h, args);
        break;
        default: break;
    }
    return RET_CMDNOTFOUND;
}

