Jasmine Karlsson
/
train_rail
New project
Embed:
(wiki syntax)
Show/hide line numbers
Switch.cpp
00001 #include "Switch.h" 00002 00003 Switch::Switch(const unsigned int newaddress, const unsigned int newinst) 00004 { 00005 //ctor 00006 address = newaddress; 00007 inst = newinst; 00008 nrPacket = 40; 00009 if(inst == 0x82) 00010 nrPacket = 50; 00011 if(inst == 0x84)// || inst == 0x81) 00012 switchOn(); 00013 //else 00014 switchOff(); 00015 00016 } 00017 00018 Switch::~Switch() 00019 { 00020 //dtor 00021 } 00022 00023 void Switch::switchOn(){ 00024 DCC_send_command(address, inst, nrPacket); 00025 } 00026 00027 void Switch::switchOff() { 00028 DCC_send_command(address, inst, nrPacket); 00029 unsigned int off = 0x80; 00030 DCC_send_command(address, off, nrPacket); 00031 }
Generated on Fri Jul 22 2022 17:31:31 by 1.7.2