grosse flemme aujouird'hui
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
#
|
||||
# dd2 monitoring
|
||||
#
|
||||
# buil the core functions, use with care
|
||||
# build the core functions, use with care
|
||||
#
|
||||
|
||||
|
||||
|
||||
@@ -9,12 +9,14 @@ typedef struct {
|
||||
int valid;
|
||||
|
||||
char *input_device;
|
||||
int input_speed;
|
||||
|
||||
|
||||
} Configuration;
|
||||
|
||||
/* ---------------------------------------------------------------- */
|
||||
|
||||
int set_default_config(Configuration *cfg);
|
||||
int parse_config(char *fname, int flags);
|
||||
int show_config(char *title);
|
||||
|
||||
|
||||
@@ -1,10 +1,12 @@
|
||||
#
|
||||
#
|
||||
# experimental config file
|
||||
#
|
||||
|
||||
# --------------------------------------------------
|
||||
# serial input from the control cpu
|
||||
|
||||
input_device s /dev/ttyACM0
|
||||
input_speed s 9600
|
||||
|
||||
|
||||
|
||||
input_speed i 9600
|
||||
|
||||
# --------------------------------------------------
|
||||
# --------------------------------------------------
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "config.h"
|
||||
@@ -74,6 +75,15 @@ while (fgets(line, SZ_STRINGS, fp))
|
||||
config.input_device = strdup(strtok(NULL, " \t"));
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
if (CMP("input_speed")) {
|
||||
config.input_speed = atoi(strtok(NULL, " \t"));
|
||||
#if DEBUG_LEVEL
|
||||
fprintf(stderr, "input speed = %d\n", config.input_speed);
|
||||
#endif
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
fclose(fp);
|
||||
@@ -90,6 +100,7 @@ if (verbosity) {
|
||||
|
||||
printf("valid : %d\n", config.valid);
|
||||
printf("input device : %s\n", config.input_device);
|
||||
printf("input speed : %d\n", config.input_speed);
|
||||
|
||||
puts("");
|
||||
return 0;
|
||||
|
||||
Reference in New Issue
Block a user