first boilerplate

This commit is contained in:
Tonton Th
2026-05-27 06:45:41 +02:00
parent 57242eaec0
commit e893a6d068
11 changed files with 101 additions and 35 deletions

4
Code/Lien.md Normal file
View File

@@ -0,0 +1,4 @@
# Le lien avec le Rover
Bonne question !

20
Code/Makefile Normal file
View File

@@ -0,0 +1,20 @@
#
# MYRYS ROVER BUILD CONTROLER
#
COPT = -g -Wall -DDEBUG_LEVEL=0
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
protocol.o: protocol.c protocol.h Makefile
gcc -c $(COPT) $< -o $@
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
mcp: mcp.c protocol.o Makefile
gcc $(COPT) $< protocol.o -o $@
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

0
Code/README.md Normal file
View File

23
Code/mcp.c Normal file
View File

@@ -0,0 +1,23 @@
/*
* MYRYS ROVER
* MASTER CONTROL PROGRAM
*/
#include <stdio.h>
#include <unistd.h>
#include "protocol.h"
/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
int main(int argc, char *argv[])
{
int foo;
fprintf(stderr, "******* hello from Myrys Rover MCP\n");
fprintf(stderr, "\tyour pid is %ld\n", (long)getpid());
foo = send_a_ping(0, "wtf bro ?", 42);
fprintf(stderr, "\tpong return value is $%06x\n", foo);
return 0;
}
/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */

29
Code/protocol.c Normal file
View File

@@ -0,0 +1,29 @@
/*
* MYRYS ROVER
* Low level communication protocol
*
* new Wed May 27 03:58.27 AM UTC 2026
*/
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include "protocol.h"
int send_a_ping(int code, char *texte, int k)
{
unsigned int foo, bar;
fprintf(stderr, "\tpid %ld is sending \"%s\"\n", (long)getpid(), texte);
foo = 3 + (rand() % 8);
#if DEBUG_LEVEL
fprintf(stderr, "+++ in %s, foo is %u\n", __func__, foo);
#endif
bar = sleep(foo);
return bar;
}

8
Code/protocol.h Normal file
View File

@@ -0,0 +1,8 @@
/*
* MYRYS ROVER
* Low level communication protocol
*
* new Wed May 27 03:51.45 AM UTC 2026
*/
int send_a_ping(int, char *, int);