chiark / gitweb /
sort of before mangle things into nmra-packets.h
[trains.git] / hostside / nmra-packets.h
1
2
3 NMRA(speed28, Aint(addr) Aint(speed) Aint(reverse), {
4   int adj;
5   
6   assert(speed>=0 && speed<=28);
7   *c++= 0x40 | (reverse ? 0 : 0x20);
8   if (speed) {
9     adj= speed + 3;
10     *c |= adj & 1 ? 0x10 : 0;
11     *c |= adj >> 1;
12   }
13   c++;
14 });
15
16 NMRA(
17
18
19
20   /* Baseline Speed and Direction, S9.2 B (for short addresses
21    * only), which is also identical to Multi-Function Decoder
22    * Speed and Direction RP9.2.1 C l.215- (defined for both
23    * addresses), so actually the address format and instruction
24    * format are independent.
25    */
26   ADDR;
27
28   ENCD;
29 }