git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@7390 35acf78f-673a-0410-8e92-d51de3d6d3f4

This commit is contained in:
gdisirio 2014-10-12 17:18:42 +00:00
parent 6dde2094a0
commit fe6b914617
2 changed files with 15 additions and 22 deletions

View File

@ -15,17 +15,16 @@
*/ */
#include "ch.h" #include "ch.h"
//#include "hal.h" #include "hal.h"
//#include "test.h" #include "test.h"
#if 0
#define BOTH_BUTTONS (PAL_PORT_BIT(PA_BUTTON1) | PAL_PORT_BIT(PA_BUTTON2)) #define BOTH_BUTTONS (PAL_PORT_BIT(PA_BUTTON1) | PAL_PORT_BIT(PA_BUTTON2))
/* /*
* Red LEDs blinker thread, times are in milliseconds. * Red LEDs blinker thread, times are in milliseconds.
*/ */
static WORKING_AREA(waThread1, 128); static THD_WORKING_AREA(waThread1, 128);
static msg_t Thread1(void *arg) { static THD_FUNCTION(Thread1, arg) {
(void)arg; (void)arg;
chRegSetThreadName("blinker1"); chRegSetThreadName("blinker1");
@ -45,8 +44,8 @@ static msg_t Thread1(void *arg) {
/* /*
* Yellow LED blinker thread, times are in milliseconds. * Yellow LED blinker thread, times are in milliseconds.
*/ */
static WORKING_AREA(waThread2, 128); static THD_WORKING_AREA(waThread2, 128);
static msg_t Thread2(void *arg) { static THD_FUNCTION(Thread2, arg) {
(void)arg; (void)arg;
chRegSetThreadName("blinker2"); chRegSetThreadName("blinker2");
@ -58,7 +57,6 @@ static msg_t Thread2(void *arg) {
} }
return 0; return 0;
} }
#endif
/* /*
* Application entry point. * Application entry point.
@ -72,33 +70,27 @@ int main(void) {
* - Kernel initialization, the main() function becomes a thread and the * - Kernel initialization, the main() function becomes a thread and the
* RTOS is active. * RTOS is active.
*/ */
// halInit(); halInit();
chSysInit(); chSysInit();
/* /*
* Activates the serial driver 1 using the driver default configuration. * Activates the serial driver 1 using the driver default configuration.
*/ */
// sdStart(&SD1, NULL); sdStart(&SD1, NULL);
/* /*
* If a button is pressed during the reset then the blinking leds threads * Creating blinkers threads.
* are not started in order to make accurate benchmarks.
*/ */
// if ((palReadPort(IOPORT1) & BOTH_BUTTONS) == BOTH_BUTTONS) { chThdCreateStatic(waThread1, sizeof(waThread1), NORMALPRIO, Thread1, NULL);
// chThdCreateStatic(waThread1, sizeof(waThread1), NORMALPRIO, Thread1, NULL); chThdCreateStatic(waThread2, sizeof(waThread2), NORMALPRIO, Thread2, NULL);
// chThdCreateStatic(waThread2, sizeof(waThread2), NORMALPRIO, Thread2, NULL);
// }
/* /*
* Normal main() thread activity, in this demo it does nothing except * Normal main() thread activity, in this demo it does nothing except
* sleeping in a loop and check the buttons state and run test procedure * sleeping in a loop and check the buttons state and run test procedure.
* or print "Hello World!" on serial driver 1.
*/ */
while (TRUE) { while (TRUE) {
// if (!palReadPad(IOPORT1, PA_BUTTON1)) if (!palReadPad(IOPORT1, PA_BUTTON2))
// sdWrite(&SD1, (uint8_t *)"Hello World!\r\n", 14); TestThread(&SD1);
// if (!palReadPad(IOPORT1, PA_BUTTON2))
// TestThread(&SD1);
chThdSleepMilliseconds(500); chThdSleepMilliseconds(500);
} }
return 0; return 0;

View File

@ -3,6 +3,7 @@ PLATFORMSRC = ${CHIBIOS}/os/hal/ports/LPC/LPC214x/hal_lld.c \
${CHIBIOS}/os/hal/ports/LPC/LPC214x/pal_lld.c \ ${CHIBIOS}/os/hal/ports/LPC/LPC214x/pal_lld.c \
${CHIBIOS}/os/hal/ports/LPC/LPC214x/serial_lld.c \ ${CHIBIOS}/os/hal/ports/LPC/LPC214x/serial_lld.c \
${CHIBIOS}/os/hal/ports/LPC/LPC214x/spi_lld.c \ ${CHIBIOS}/os/hal/ports/LPC/LPC214x/spi_lld.c \
${CHIBIOS}/os/hal/ports/LPC/LPC214x/st_lld.c \
${CHIBIOS}/os/hal/ports/LPC/LPC214x/vic.c ${CHIBIOS}/os/hal/ports/LPC/LPC214x/vic.c
# Required include directories # Required include directories