diff options
author | gdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4> | 2013-02-03 10:29:01 +0000 |
---|---|---|
committer | gdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4> | 2013-02-03 10:29:01 +0000 |
commit | 92bf9bdac3071fc6586f3bb2f2445e3e7c5cefd0 (patch) | |
tree | 7137b92e04fff3e94c0db7318dd9611d3c22d45d /testhal | |
parent | 184a71345c6a36a9a8664eda8fbcc3ea728267a8 (diff) | |
download | ChibiOS-92bf9bdac3071fc6586f3bb2f2445e3e7c5cefd0.tar.gz ChibiOS-92bf9bdac3071fc6586f3bb2f2445e3e7c5cefd0.tar.bz2 ChibiOS-92bf9bdac3071fc6586f3bb2f2445e3e7c5cefd0.zip |
Added CAN2 support. Tested on the STM32F4xx only.
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@5105 35acf78f-673a-0410-8e92-d51de3d6d3f4
Diffstat (limited to 'testhal')
-rw-r--r-- | testhal/STM32F4xx/CAN/main.c | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/testhal/STM32F4xx/CAN/main.c b/testhal/STM32F4xx/CAN/main.c index 5f32d868c..e7a10247b 100644 --- a/testhal/STM32F4xx/CAN/main.c +++ b/testhal/STM32F4xx/CAN/main.c @@ -27,7 +27,7 @@ struct can_instance { };
static const struct can_instance can1 = {&CAND1, GPIOD_LED5};
-//static const struct can_instance can2 = {&CAND2, GPIOD_LED3};
+static const struct can_instance can2 = {&CAND2, GPIOD_LED3};
/*
* Internal loopback mode, 500KBaud, automatic wakeup, automatic recover
@@ -37,16 +37,14 @@ static const struct can_instance can1 = {&CAND1, GPIOD_LED5}; static const CANConfig cancfg = {
CAN_MCR_ABOM | CAN_MCR_AWUM | CAN_MCR_TXFP,
CAN_BTR_LBKM | CAN_BTR_SJW(0) | CAN_BTR_TS2(1) |
- CAN_BTR_TS1(8) | CAN_BTR_BRP(6),
- 0,
- NULL
+ CAN_BTR_TS1(8) | CAN_BTR_BRP(6)
};
/*
* Receiver thread.
*/
static WORKING_AREA(can_rx1_wa, 256);
-//static WORKING_AREA(can_rx2_wa, 256);
+static WORKING_AREA(can_rx2_wa, 256);
static msg_t can_rx(void *p) {
struct can_instance *cip = p;
EventListener el;
@@ -85,6 +83,7 @@ static msg_t can_tx(void * p) { while (!chThdShouldTerminate()) {
canTransmit(&CAND1, &txmsg, MS2ST(100));
+ canTransmit(&CAND2, &txmsg, MS2ST(100));
chThdSleepMilliseconds(500);
}
return 0;
@@ -106,17 +105,18 @@ int main(void) { chSysInit();
/*
- * Activates the CAN driver 1.
+ * Activates the CAN drivers 1 and 2.
*/
canStart(&CAND1, &cancfg);
+ canStart(&CAND2, &cancfg);
/*
* Starting the transmitter and receiver threads.
*/
chThdCreateStatic(can_rx1_wa, sizeof(can_rx1_wa), NORMALPRIO + 7,
can_rx, (void *)&can1);
-// chThdCreateStatic(can_rx2_wa, sizeof(can_rx2_wa), NORMALPRIO + 7,
-// can_rx, (void *)&can2);
+ chThdCreateStatic(can_rx2_wa, sizeof(can_rx2_wa), NORMALPRIO + 7,
+ can_rx, (void *)&can2);
chThdCreateStatic(can_tx_wa, sizeof(can_tx_wa), NORMALPRIO + 7,
can_tx, NULL);
|