Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Diff: Track.cpp
- Revision:
- 30:63a8a5cefc6b
- Parent:
- 21:31647d80614f
diff -r 6031227dcac9 -r 63a8a5cefc6b Track.cpp
--- a/Track.cpp Fri Jun 22 09:55:58 2018 +0000
+++ b/Track.cpp Mon Jun 25 14:57:17 2018 +0000
@@ -13,44 +13,6 @@
//dtor
}
-
-void Track::DCC_send_command(int repeat_count)
-{
- unsigned __int64 command = 0x0000000000000000; // __int64 is the 64-bit integer type
- unsigned __int64 temp_command = 0x0000000000000000;
- unsigned __int64 prefix = 0x3FFF; // 14 "1" bits needed at start
- unsigned int error = 0x00; //error byte
- //calculate error detection byte with xor
- error = address ^ inst;
- //combine packet bits in basic DCC format
- command = (prefix<<28)|(address<<19)|(inst<<10)|((error)<<1)|0x01;
- //printf("\n\r %llx \n\r",command);
- int i=0;
-//repeat DCC command lots of times
- while(i < repeat_count) {
- temp_command = command;
-//loops through packet bits encoding and sending out digital pulses for a DCC command
- for (int j=0; j<64; j++) {
- if((temp_command&0x8000000000000000)==0) { //test packet bit
- //send data for a "0" bit
- trackpin=0;
- wait_us(100);
- trackpin=1;
- wait_us(100);
- } else {
- //send data for a "1"bit
- trackpin=0;
- wait_us(58);
- trackpin=1;
- wait_us(58);
- }
- // next bit in packet
- temp_command = temp_command<<1;
- }
- i++;
- }
-}
-
void Track::DCC_send_command(unsigned int address, unsigned int inst, unsigned int repeat_count)
{
unsigned __int64 command = 0x0000000000000000; // __int64 is the 64-bit integer type
