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.
Fork of BertlTemplate2 by
Revision 3:b00b6fca5c41, committed 2016-04-18
- Comitter:
- hollegha2
- Date:
- Mon Apr 18 16:30:58 2016 +0000
- Parent:
- 2:d24a3d2438a4
- Commit message:
- V1.0
Changed in this revision
BertlTemplate.cpp | Show diff for this revision Revisions of this file |
DistSensTest.cpp | Show annotated file Show diff for this revision Revisions of this file |
diff -r d24a3d2438a4 -r b00b6fca5c41 BertlTemplate.cpp --- a/BertlTemplate.cpp Mon Feb 22 10:55:46 2016 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,24 +0,0 @@ - -#include "mbed.h" -#include "Serial_HL.h" -#include "Bertl14.h" -#include "BertlObjects.h" - -// main=2^0 LS ENC 2^2 -BusOut boardPow(p30, P1_6, P1_7); - -int main(void) -{ - boardPow=1; wait_ms(10); - InitBertl(); - pex.useISR=0; leds=9; - pex.ClearLeds(); - - while(1) - { - } - - return 1; -} - -
diff -r d24a3d2438a4 -r b00b6fca5c41 DistSensTest.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/DistSensTest.cpp Mon Apr 18 16:30:58 2016 +0000 @@ -0,0 +1,49 @@ +#include "mbed.h" +#include "Serial_HL.h" +#include "Bertl14.h" +#include "BertlObjects.h" + +SerialBLK pc(USBTX, USBRX); +SvProtocol ua0(&pc); + +void CommandHandler(); + +// main=2^0 LS ENC 2^2 +BusOut boardPow(p30, P1_6, P1_7); + +int main(void) +{ + boardPow=1; + pc.format(8,SerialBLK::None,1); + pc.baud(115200); + InitBertl(); + pex.useISR=0; + leds=9; + wait(1.0); + leds=6; + + ua0.SvMessage("DistSensTest_4"); + + Timer stw; + stw.start(); + while(1) { + CommandHandler(); + if( ua0.acqON && (stw.read_ms()>10) ) { + stw.reset(); + if( ua0.acqON ) { + us.StartMeas(); // for next cycle + ua0.WriteSvI16(1, us.distCM*100.0); + } + } + } + return 1; +} + +void CommandHandler() +{ + uint8_t cmd; + if( !pc.IsDataAvail() ) + return; + cmd = ua0.GetCommand(); +} +