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.
Revision 14:19e36b53e76a, committed 2016-12-20
- Comitter:
- skirmish
- Date:
- Tue Dec 20 09:03:13 2016 +0000
- Parent:
- 13:e3089b058fab
- Commit message:
- finally
Changed in this revision
--- a/model.cpp Mon Dec 19 18:54:01 2016 +0000 +++ b/model.cpp Tue Dec 20 09:03:13 2016 +0000 @@ -1,8 +1,9 @@ #include "model.h" - +#define TIME_OPEN_DOOR 3 +#define TIME_GO 4 Model::Model(Serial *pci):communication(pci) { - + cmd= new Commands(); cmd->MotorDown[0]=0x2; cmd->MotorDown[1]=0xff; @@ -19,11 +20,15 @@ cmd->LedOn[0]=0x01; cmd->LedOff[0]=0x00; cmd->ArrowDown[0]=0x02; - cmd->ArrowUp[0]=0x01; + cmd->ArrowsUp[0]=0x01; direction=0; - p4=1; p3=1; p2=1; p1=1; p0=1; + p4=1; + p3=1; + p2=1; + p1=1; + p0=1; -NVIC_SetPriority(LPTimer_IRQn, 255); + NVIC_SetPriority(LPTimer_IRQn, 255); } void Model::doSomething() @@ -49,8 +54,8 @@ sendPacket(0xa0,0x24,0x00,cmd->LedOff,1); sendPacket(0xa0,0x14,0x00,cmd->LedOff,1); stopMotor(); - tmOut.attach(this,&Model::TimeOutCallBack,4); - tmOut2.attach(this,&Model::DoorUnlock,3); + tmOut.attach(this,&Model::TimeOutCallBack,TIME_GO); + tmOut2.attach(this,&Model::DoorUnlock,TIME_OPEN_DOOR); }; break; case 0xe3: @@ -73,8 +78,8 @@ sendPacket(0xa0,0x13,0x00,cmd->LedOff,1); sendPacket(0xa0,0x23,0x00,cmd->LedOff,1); stopMotor(); - tmOut.attach(this,&Model::TimeOutCallBack,4); - tmOut2.attach(this,&Model::DoorUnlock,3); + tmOut.attach(this,&Model::TimeOutCallBack,TIME_GO); + tmOut2.attach(this,&Model::DoorUnlock,TIME_OPEN_DOOR); } break; case 0xe2: @@ -98,8 +103,8 @@ sendPacket(0xa0,0x12,0x00,cmd->LedOff,1); sendPacket(0xa0,0x22,0x00,cmd->LedOff,1); stopMotor(); - tmOut.attach(this,&Model::TimeOutCallBack,4); - tmOut2.attach(this,&Model::DoorUnlock,3); + tmOut.attach(this,&Model::TimeOutCallBack,TIME_GO); + tmOut2.attach(this,&Model::DoorUnlock,TIME_OPEN_DOOR); } break; @@ -123,11 +128,11 @@ sendPacket(0xa0,0x11,0x00,cmd->LedOff,1); sendPacket(0xa0,0x21,0x00,cmd->LedOff,1); stopMotor(); - tmOut.attach(this,&Model::TimeOutCallBack,4); - tmOut2.attach(this,&Model::DoorUnlock,3); + tmOut.attach(this,&Model::TimeOutCallBack,TIME_GO); + tmOut2.attach(this,&Model::DoorUnlock,TIME_OPEN_DOOR); } break; - + case 0xe0: poschodie=0; p0=1; @@ -148,8 +153,8 @@ sendPacket(0xa0,0x10,0x00,cmd->LedOff,1); sendPacket(0xa0,0x20,0x00,cmd->LedOff,1); stopMotor(); - tmOut.attach(this,&Model::TimeOutCallBack,4); - tmOut2.attach(this,&Model::DoorUnlock,3); + tmOut.attach(this,&Model::TimeOutCallBack,TIME_GO); + tmOut2.attach(this,&Model::DoorUnlock,TIME_OPEN_DOOR); } break; default:
--- a/model.h Mon Dec 19 18:54:01 2016 +0000 +++ b/model.h Tue Dec 20 09:03:13 2016 +0000 @@ -40,5 +40,6 @@ int direction; Timeout tmOut; Timeout tmOut2; + }; #endif \ No newline at end of file
--- a/structures.h Mon Dec 19 18:54:01 2016 +0000 +++ b/structures.h Tue Dec 20 09:03:13 2016 +0000 @@ -19,9 +19,6 @@ char LedOff[1]; char Lock[1];//0x00 unlock , 0x01 lock - - - };