29 lines
616 B
C
29 lines
616 B
C
//
|
|
// Created by dell on 24-11-29.
|
|
//
|
|
|
|
#include "RS485.h"
|
|
#include "gd32e23x.h"
|
|
#include "systick.h"
|
|
#include <stdio.h>
|
|
#include <stdlib.h>
|
|
|
|
#define MAX_CMD_SIZE 16
|
|
#define BUFSIZE 8
|
|
|
|
static char cmdbuffer[BUFSIZE][MAX_CMD_SIZE];
|
|
static char *strchr_pointer = NULL;
|
|
|
|
static int bufindr = 0;
|
|
static int bufindw = 0;
|
|
static int buflen = 0;
|
|
|
|
bool code_seen(char code)
|
|
{
|
|
strchr_pointer = strchr(cmdbuffer[bufindr], code);
|
|
return (strchr_pointer != NULL); //Return True if a character was found
|
|
}
|
|
float code_value(void)
|
|
{
|
|
return (strtod(&cmdbuffer[bufindr][strchr_pointer - cmdbuffer[bufindr] + 1], NULL));
|
|
} |