aboutsummaryrefslogtreecommitdiffstats
path: root/demos/ARMCM4-STM32F407-DISCOVERY-G++/main.cpp
diff options
context:
space:
mode:
authorgdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4>2013-01-02 11:12:46 +0000
committergdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4>2013-01-02 11:12:46 +0000
commit8fa18b0b6b3f5640a2db179ec938f8962f65244c (patch)
treeb53c296ca94611820b6bede653b0e67545538bfd /demos/ARMCM4-STM32F407-DISCOVERY-G++/main.cpp
parent0d3c7da33152ace5422f79fae6ce757d7328c32c (diff)
downloadChibiOS-8fa18b0b6b3f5640a2db179ec938f8962f65244c.tar.gz
ChibiOS-8fa18b0b6b3f5640a2db179ec938f8962f65244c.tar.bz2
ChibiOS-8fa18b0b6b3f5640a2db179ec938f8962f65244c.zip
Updated C++ wrapper and STM32F4-Discovery C++ demo.
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@5015 35acf78f-673a-0410-8e92-d51de3d6d3f4
Diffstat (limited to 'demos/ARMCM4-STM32F407-DISCOVERY-G++/main.cpp')
-rw-r--r--demos/ARMCM4-STM32F407-DISCOVERY-G++/main.cpp49
1 files changed, 37 insertions, 12 deletions
diff --git a/demos/ARMCM4-STM32F407-DISCOVERY-G++/main.cpp b/demos/ARMCM4-STM32F407-DISCOVERY-G++/main.cpp
index 3851e1d29..0caee9bc4 100644
--- a/demos/ARMCM4-STM32F407-DISCOVERY-G++/main.cpp
+++ b/demos/ARMCM4-STM32F407-DISCOVERY-G++/main.cpp
@@ -21,7 +21,6 @@
#include "ch.hpp"
#include "hal.h"
#include "test.h"
-#include "evtimer.h"
using namespace chibios_rt;
@@ -42,25 +41,44 @@ typedef struct {
uint32_t value;
} seqop_t;
+// Flashing sequence for LED3.
+static const seqop_t LED3_sequence[] =
+{
+ {BITSET, PAL_PORT_BIT(GPIOD_LED3)},
+ {SLEEP, 800},
+ {BITCLEAR, PAL_PORT_BIT(GPIOD_LED3)},
+ {SLEEP, 200},
+ {GOTO, 0}
+};
+
// Flashing sequence for LED4.
static const seqop_t LED4_sequence[] =
{
- {BITCLEAR, PAL_PORT_BIT(GPIOD_LED4)},
- {SLEEP, 200},
- {BITSET, PAL_PORT_BIT(GPIOD_LED4)},
- {SLEEP, 1800},
+ {BITSET, PAL_PORT_BIT(GPIOD_LED4)},
+ {SLEEP, 600},
+ {BITCLEAR, PAL_PORT_BIT(GPIOD_LED4)},
+ {SLEEP, 400},
{GOTO, 0}
};
-// Flashing sequence for LED3.
-static const seqop_t LED3_sequence[] =
+// Flashing sequence for LED5.
+static const seqop_t LED5_sequence[] =
{
- {SLEEP, 1000},
- {BITCLEAR, PAL_PORT_BIT(GPIOD_LED3)},
- {SLEEP, 1800},
- {BITSET, PAL_PORT_BIT(GPIOD_LED3)},
+ {BITSET, PAL_PORT_BIT(GPIOD_LED5)},
+ {SLEEP, 400},
+ {BITCLEAR, PAL_PORT_BIT(GPIOD_LED5)},
+ {SLEEP, 600},
+ {GOTO, 0}
+};
+
+// Flashing sequence for LED6.
+static const seqop_t LED6_sequence[] =
+{
+ {BITSET, PAL_PORT_BIT(GPIOD_LED6)},
{SLEEP, 200},
- {GOTO, 1}
+ {BITCLEAR, PAL_PORT_BIT(GPIOD_LED6)},
+ {SLEEP, 800},
+ {GOTO, 0}
};
/*
@@ -127,6 +145,8 @@ public:
static TesterThread tester;
static SequencerThread blinker1(LED3_sequence);
static SequencerThread blinker2(LED4_sequence);
+static SequencerThread blinker3(LED5_sequence);
+static SequencerThread blinker4(LED6_sequence);
/*
* Application entry point.
@@ -145,8 +165,11 @@ int main(void) {
/*
* Activates the serial driver 2 using the driver default configuration.
+ * PA2(TX) and PA3(RX) are routed to USART2.
*/
sdStart(&SD2, NULL);
+ palSetPadMode(GPIOA, 2, PAL_MODE_ALTERNATE(7));
+ palSetPadMode(GPIOA, 3, PAL_MODE_ALTERNATE(7));
/*
* Starts several instances of the SequencerThread class, each one operating
@@ -154,6 +177,8 @@ int main(void) {
*/
blinker1.start(NORMALPRIO + 10);
blinker2.start(NORMALPRIO + 10);
+ blinker3.start(NORMALPRIO + 10);
+ blinker4.start(NORMALPRIO + 10);
/*
* Serves timer events.