From b64207597a7cfa6a3c0474068b881f58a4d20695 Mon Sep 17 00:00:00 2001 From: Rocco Marco Guglielmi Date: Sun, 17 Sep 2017 17:12:26 +0000 Subject: Edited RT-SAMA5D2-XPLAINED demo to be compliant with default demos (still uncomplete) git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@10624 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- demos/ATSAMA5D2/RT-SAMA5D2-XPLAINED/Makefile | 3 +- .../RT-SAMA5D2-XPLAINED (Load and Run).launch | 108 ++++++++++----------- demos/ATSAMA5D2/RT-SAMA5D2-XPLAINED/main.c | 48 ++------- 3 files changed, 64 insertions(+), 95 deletions(-) (limited to 'demos') diff --git a/demos/ATSAMA5D2/RT-SAMA5D2-XPLAINED/Makefile b/demos/ATSAMA5D2/RT-SAMA5D2-XPLAINED/Makefile index b2b020c35..175f0b081 100755 --- a/demos/ATSAMA5D2/RT-SAMA5D2-XPLAINED/Makefile +++ b/demos/ATSAMA5D2/RT-SAMA5D2-XPLAINED/Makefile @@ -137,7 +137,6 @@ CSRC = $(STARTUPSRC) \ $(PLATFORMSRC) \ $(BOARDSRC) \ $(TESTSRC) \ - $(CHIBIOS)/os/hal/lib/streams/chprintf.c \ main.c # C++ sources that can be compiled in ARM or THUMB mode depending on the global @@ -171,7 +170,7 @@ ASMXSRC = $(STARTUPASM) $(PORTASM) $(OSALASM) INCDIR = $(CHIBIOS)/os/license \ $(STARTUPINC) $(KERNINC) $(PORTINC) $(OSALINC) \ $(HALINC) $(PLATFORMINC) $(BOARDINC) $(TESTINC) \ - $(CHIBIOS)/os/hal/lib/streams $(CHIBIOS)/os/various + $(CHIBIOS)/os/various # # Project, sources and paths diff --git a/demos/ATSAMA5D2/RT-SAMA5D2-XPLAINED/debug/RT-SAMA5D2-XPLAINED (Load and Run).launch b/demos/ATSAMA5D2/RT-SAMA5D2-XPLAINED/debug/RT-SAMA5D2-XPLAINED (Load and Run).launch index 5fcdb7cf0..e65e369ac 100644 --- a/demos/ATSAMA5D2/RT-SAMA5D2-XPLAINED/debug/RT-SAMA5D2-XPLAINED (Load and Run).launch +++ b/demos/ATSAMA5D2/RT-SAMA5D2-XPLAINED/debug/RT-SAMA5D2-XPLAINED (Load and Run).launch @@ -1,54 +1,54 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/demos/ATSAMA5D2/RT-SAMA5D2-XPLAINED/main.c b/demos/ATSAMA5D2/RT-SAMA5D2-XPLAINED/main.c index efb9af267..c0fa19e5f 100755 --- a/demos/ATSAMA5D2/RT-SAMA5D2-XPLAINED/main.c +++ b/demos/ATSAMA5D2/RT-SAMA5D2-XPLAINED/main.c @@ -16,30 +16,20 @@ #include "ch.h" #include "hal.h" -#include "chprintf.h" - -#define AICREDIR_KEY 0x5B6C0E26u /* - * Blinker thread. + * LED blinker thread, times are in milliseconds. */ -static THD_WORKING_AREA(waThread1, 128); +static THD_WORKING_AREA(waThread1, 512); static THD_FUNCTION(Thread1, arg) { (void)arg; - bool ld = true; chRegSetThreadName("blinker"); while (true) { - /* TODO: Replace with toggle function of GPIO */ - if(ld){ - PIOA->PIO_PIO_[1].S_PIO_CODR = S_PIO_CODR_P5; - ld = false; - } - else{ - PIOA->PIO_PIO_[1].S_PIO_SODR = S_PIO_SODR_P5; - ld = true; - } + PIOA->PIO_PIO_[1].S_PIO_CODR = S_PIO_CODR_P5; + chThdSleepMilliseconds(500); + PIOA->PIO_PIO_[1].S_PIO_SODR = S_PIO_SODR_P5; chThdSleepMilliseconds(500); } } @@ -59,39 +49,19 @@ int main(void) { halInit(); chSysInit(); - /* Redirect interrupts */ - uint32_t aicredir = SFR_AICREDIR_AICREDIRKEY((uint32_t)(AICREDIR_KEY)); - SFR->SFR_AICREDIR = (aicredir ^ SFR->SFR_SN1); - - /* - * TODO: Replace with PAL functions - * Led green - */ - PIOA->PIO_PIO_[1].S_PIO_SIOSR |= S_PIO_SIOSR_P5; - PIOA->PIO_PIO_[1].S_PIO_MSKR = S_PIO_MSKR_MSK5_ENABLED; - PIOA->PIO_PIO_[1].S_PIO_CFGR = S_PIO_CFGR_DIR_OUTPUT; - PIOA->PIO_PIO_[1].S_PIO_SODR = S_PIO_SODR_P5 ; - /* - * TODO: Replace with PAL functions - * Uart0 pins PB26 rx and PB27 tx (J18) + * Activates the serial driver 0 using the driver default configuration. */ - PIOA->PIO_PIO_[1].S_PIO_SIOSR |= S_PIO_SIOSR_P26 | S_PIO_SIOSR_P27; - /* select pins */ - PIOA->PIO_PIO_[1].S_PIO_MSKR = S_PIO_MSKR_MSK26 | S_PIO_MSKR_MSK27; - /* pins are driven by func_periph_c (uart0 mode) */ - PIOA->PIO_PIO_[1].S_PIO_CFGR = S_PIO_CFGR_FUNC_PERIPH_C; - sdStart(&SD0, NULL); - chprintf((BaseSequentialStream *)&SD0, "ChibiOS is running!\r\n\n"); + /* - * Creates the example thread. + * Creates the blinker thread. */ chThdCreateStatic(waThread1, sizeof(waThread1), NORMALPRIO, Thread1, NULL); /* * Normal main() thread activity, in this demo it does nothing except - * increasing the minutes counter. + * sleeping in a loop and check the button state. */ while (true) { chThdSleepMilliseconds(500); -- cgit v1.2.3