Main Page   Packages   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members   Search  

C:/temp/src/j2k/Deprecated/old_18mar_diff/nto/TrainDef.cpp File Reference

#include "TrainDef.hpp"

Go to the source code of this file.

Compounds

struct  _abcd_output_addr

Typedefs

typedef _abcd_output_addr abcd_output_addr_t

Functions

void KickStart ()
void ForwardTrim ()
void ReverseTrim ()
void SetSpeed (UCHAR step)
UCHAR PulseRate_to_CV_value (double rate)
UCHAR FlashRate_to_CV_value (double flash)
abcd_output_addr_t DecoderCard_to_ABCD_addresses (USHORT decoderNo)
void DisplayMemory (UCHAR line, USHORT memory)
void testDisplayMemory ()
void KillMainTrack ()
void EnableMainTrack ()
void DisplayVersionNumber ()
void QueuePakcet ()

Variables

char SpeedTable [28]


Typedef Documentation

typedef struct _abcd_output_addr abcd_output_addr_t
 


Function Documentation

abcd_output_addr_t DecoderCard_to_ABCD_addresses USHORT    decoderNo
 

Definition at line 149 of file TrainDef.cpp.

00150 {
00151   abcd_output_addr_t addr;
00152   memset( &addr, 0, sizeof( abcd_output_addr_t ) );
00153 
00154   register USHORT d = decoderNo;
00155 
00156   assert( d > 0   );
00157   assert( d < 512 );
00158 
00159   addr.decoder = d;
00160 
00161   addr.lsb = d & 0x3F;
00162   addr.msb = (d >> 6) & 0x07;
00163 
00164   d--;
00165   d = ( d * 4 ) + 1;
00166   addr.a   = d; d++;
00167   addr.b   = d; d++;
00168   addr.c   = d; d++;
00169   addr.d   = d;
00170 
00171   return addr;
00172 }

void DisplayMemory UCHAR    line,
USHORT    memory
 

Definition at line 174 of file TrainDef.cpp.

Referenced by testDisplayMemory().

00175 {
00176   // assert( line >= 0 );
00177   assert( line < 16 );
00178 
00179   char buf[ 10 ];
00180   memset( buf, 0, 10 );
00181 
00182   sprintf( buf, "F %01X %04X", line, memory );
00183   printf( "[%s]\n", buf );  
00184 
00185 
00186   // Send....
00187 }

void DisplayVersionNumber  
 

Definition at line 213 of file TrainDef.cpp.

00214 {
00215   char buf[2] = { 'V', '0' };
00216 
00217   // Send...
00218 }

void EnableMainTrack  
 

Definition at line 206 of file TrainDef.cpp.

00207 {
00208   char buf[2] = { 'E', '0' };
00209 
00210   // Send...
00211 }

UCHAR FlashRate_to_CV_value double    flash
 

Definition at line 100 of file TrainDef.cpp.

00101 {
00102   register UCHAR  val = 0;
00103   register double f = flash;
00104 
00105   if ( f <= FLASH_MIN  ) 
00106   { 
00107     f = FLASH_MIN;  
00108   }
00109 
00110 
00111   if ( f >  FLASH_MAX1 ) 
00112   { 
00113     f   = FLASH_MAX2; 
00114     val = FLASH_OFFSET;
00115     return val; 
00116   }
00117   
00118   f = ceil( f * 10 );
00119 
00120   val = (UCHAR)f + FLASH_OFFSET;
00121  
00122   return val;
00123 }

void ForwardTrim  
 

Definition at line 14 of file TrainDef.cpp.

00015 {
00016  USHORT CV  =  66;
00017  UCHAR  val = 128;
00018  
00019  // Send
00020 }

void KickStart  
 

Definition at line 6 of file TrainDef.cpp.

00007 {
00008  USHORT CV  = 65;
00009  UCHAR  val =  1;
00010  
00011  // Send
00012 }

void KillMainTrack  
 

Definition at line 199 of file TrainDef.cpp.

00200 {
00201   char buf[2] = { 'K', '0' };
00202 
00203   // Send...
00204 }

UCHAR PulseRate_to_CV_value double    rate
 

Definition at line 80 of file TrainDef.cpp.

00081 {
00082   register UCHAR  val = 0;
00083   register double r = rate;
00084 
00085   if ( r <= PULSE_CONSTANT ) { r = PULSE_CONSTANT; }
00086   if ( r >= PULSE_MAX      ) { r = PULSE_MAX;      }
00087   
00088   r = ceil( r * 10 );
00089 
00090   val = (UCHAR)r;
00091 
00092   return val;
00093 }

void QueuePakcet  
 

Definition at line 220 of file TrainDef.cpp.

00221 {
00222    char buf[160];
00223    memset( buf, 0, 160 );
00224 
00225    sprintf( buf, "Q %02X %02X %02X ... ", ... );
00226    
00227 }

void ReverseTrim  
 

Definition at line 22 of file TrainDef.cpp.

00023 {
00024  USHORT CV  =  80;
00025  UCHAR  val = 128;
00026  
00027  // Send
00028 }

void SetSpeed UCHAR    step
 

Definition at line 64 of file TrainDef.cpp.

00065 {
00066  assert ( step >= 1 && step <= 28 );
00067 
00068  register UCHAR s = step;
00069 
00070  USHORT CV  = 66 + step;
00071  UCHAR  val = SpeedTable[ step ];
00072  
00073  // Send
00074 }

void testDisplayMemory  
 

Definition at line 189 of file TrainDef.cpp.

00190 {
00191   for( int i = 0; i < 16; i++ )
00192     for( int j = 0x01; j < 0xffff; )
00193     {
00194    DisplayMemory( i, j );
00195    j = (j << 1) | 1;
00196     }
00197 }


Variable Documentation

char SpeedTable[ 28 ] [static]
 

Initial value:

 {
  10,
  14,
  18,
  22,
  24,
  28, 
  32, 
  36,
  40,
  44,
  50,
  54,
  60,
  64,
  70,
  76,
  82,
  90,
  96,
 106,
 114,
 126,
 136,
 148,
 162,
 178,
 198,
 212
}

Definition at line 31 of file TrainDef.cpp.


Generated on Sun Oct 14 18:47:24 2001 for Standard J2K Library by doxygen1.2.11.1 written by Dimitri van Heesch, © 1997-2001