New project

Dependencies:   mbed TextLCD

Switch.cpp

Committer:
jasminealice
Date:
2018-06-28
Revision:
31:9d973398554f
Parent:
25:90f7a34c253a

File content as of revision 31:9d973398554f:

#include "Switch.h"

Switch::Switch(const unsigned int newaddress, const unsigned int newinst)
{
    //ctor
    address = newaddress;
    inst = newinst;
    nrPacket = 40;
    if(inst == 0x82)
        nrPacket = 50;
    if(inst == 0x84)// || inst == 0x81)
        switchOn();
    //else
        switchOff(); 
    
}

Switch::~Switch()
{
    //dtor
}

void Switch::switchOn(){
    DCC_send_command(address, inst, nrPacket); 
}

void Switch::switchOff() {
    DCC_send_command(address, inst, nrPacket);
    unsigned int off = 0x80;
    DCC_send_command(address, off, nrPacket);
}