![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
An ANT Shared Bidirectional Slave sample implementation.
see http://mbed.org/users/MRSa/notebook/bc-ant_receiver/ .
Revision 3:ce23e131fdbd, committed 2013-06-05
- Comitter:
- MRSa
- Date:
- Wed Jun 05 15:39:59 2013 +0000
- Parent:
- 2:691ccdef6f1e
- Commit message:
- reformat
Changed in this revision
main.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- a/main.cpp Sun May 26 13:39:31 2013 +0000 +++ b/main.cpp Wed Jun 05 15:39:59 2013 +0000 @@ -23,10 +23,7 @@ #define ANT_CH 0 #define DEVICE_NUMBER 65 #define ANT_NETWORK_NUMBER 0 // Network Number -#define TRANS_TYPE_WILDCARD 0 // Wild Card -#define TRANS_TYPE_INDEPENDENT 1 // Independent Channel #define TRANS_TYPE_SHARED_2BYTES 3 // Shared Channel using 2byte address -#define DEVICE_TYPE_WILDCARD 0 #define DEVICE_TYPE_ID 3 // Device Type ID /** DIP-SWITCH ASSIGN **/ @@ -92,7 +89,7 @@ { led0 = 0; } - if ((command & 0x08) != 0) + if ((command & 0x04) != 0) { led1 = 1; } @@ -114,6 +111,7 @@ executeAction(receivedBuffer[2], receivedBuffer[4], receivedBuffer[6]); + // Dump received message to USB printf("RX(%3d):", receivedLength); for (int index = 0; index < receivedLength; index++) { @@ -123,17 +121,9 @@ } /** - * Moving command received from HOST - */ -void sendToAnt(uint8_t *buffer) -{ - antPort.ANT_SendAcknowledgedData(ANT_CH, buffer); -} - -/** * initializes ANT port */ -int initialize_ANTport(bool isReceive) +int initialize_ANTport() { antPort.ANT_ResetSystem(); antPort.ANT_AssignChannel(ANT_CH, ANT_Shared_Bidirectional_Slave, ANT_NETWORK_NUMBER); @@ -158,10 +148,10 @@ */ int main() { + pc.baud(9600); // set serial speed between PC and mbed. printf("--- INITIALIZE (ID:%d) ----\r\n", check_DipSw()); int statusLamp = getLampId(check_DipSw()); - pc.baud(9600); // set serial speed between PC and mbed. - initialize_ANTport(true); // initialize BC-ANT-SERIAL + initialize_ANTport(); // initialize BC-ANT-SERIAL printf("--- READY ----\r\n"); while(1)