From: Mart Lubbers Date: Mon, 20 Mar 2017 10:55:28 +0000 (+0100) Subject: add ifdefs to interface.h X-Git-Url: https://git.martlubbers.net/?a=commitdiff_plain;h=2b50c2537dbb28d062938a6c217f5ba27fed23d9;p=mTask.git add ifdefs to interface.h --- diff --git a/client/Makefile b/client/Makefile index d0f5454..0ca27f1 100644 --- a/client/Makefile +++ b/client/Makefile @@ -118,6 +118,8 @@ CSRC = $(STARTUPSRC) \ $(PLATFORMSRC) \ $(BOARDSRC) \ $(TESTSRC) \ + $(CHIBIOS)/os/hal/lib/streams/memstreams.c \ + $(CHIBIOS)/os/hal/lib/streams/chprintf.c \ $(filter-out interface_linux.c,$(wildcard *.c)) # C++ sources that can be compiled in ARM or THUMB mode depending on the global diff --git a/client/interface.c b/client/interface.c index 9ddd214..fae81db 100644 --- a/client/interface.c +++ b/client/interface.c @@ -86,6 +86,9 @@ void setup(void) halInit(); chSysInit(); sdStart(&SD3, NULL); + sdStart(&SD1, NULL); + + } void debug(char *fmt, ...) diff --git a/client/interface.h b/client/interface.h index eee3457..9e81810 100644 --- a/client/interface.h +++ b/client/interface.h @@ -36,14 +36,20 @@ uint8_t read_byte(void); void write_byte(uint8_t b); /* Analog and digital pins */ +#if HAVEDIO == 1 void write_dpin(uint8_t i, bool b); bool read_dpin(uint8_t i); +#endif +#if HAVEAIO == 1 void write_apin(uint8_t i, uint8_t a); uint8_t read_apin(uint8_t i); +#endif /* UserLED */ +#if HAVELED == 1 void led_on(uint8_t i); void led_off(uint8_t i); +#endif /* Delay and communication */ long millis(void); diff --git a/client/interpret.c b/client/interpret.c index 51e2951..b9d0c88 100644 --- a/client/interpret.c +++ b/client/interpret.c @@ -138,6 +138,7 @@ void run_task(struct task *t) break; case BCSERIALPARSEINT: trace("SerialParseInt()"); break; +#if HAVEAIO == 1 case BCANALOGREAD: trace("AnalogRead(%d)", program[pc]); stack[sp++] = read_apin(program[pc++]); break; @@ -145,6 +146,8 @@ void run_task(struct task *t) write_apin(program[pc++], stack[sp-1]); sp--; break; +#endif +#if HAVEDIO == 1 case BCDIGITALREAD: trace("DigitalRead(%d)", program[pc]); stack[sp++] = read_dpin(program[pc++]); break; @@ -152,6 +155,8 @@ void run_task(struct task *t) write_dpin(program[pc++], stack[sp-1]); sp--; break; +#endif +#if HAVELED == 1 case BCLEDON: trace("LedOn(%d)", program[pc]); led_on(stack[sp-1]); sp--; @@ -160,6 +165,7 @@ void run_task(struct task *t) led_off(stack[sp-1]); sp--; break; +#endif default: trace("unrecognized"); die("Unrecognized command: %d", program[pc-1]); diff --git a/client/mcuconf.h b/client/mcuconf.h index 2886487..b01b315 100644 --- a/client/mcuconf.h +++ b/client/mcuconf.h @@ -264,7 +264,7 @@ /* * SERIAL driver system settings. */ -#define STM32_SERIAL_USE_USART1 FALSE +#define STM32_SERIAL_USE_USART1 TRUE #define STM32_SERIAL_USE_USART2 FALSE #define STM32_SERIAL_USE_USART3 TRUE #define STM32_SERIAL_USE_UART4 FALSE