Stefan Kiegerl
/
FuncGen
Function Generator for TINF 2021
src/FuncGenMain_21.cpp@0:464b401734fd, 2021-03-09 (annotated)
- Committer:
- stkiegerl
- Date:
- Tue Mar 09 20:46:10 2021 +0000
- Revision:
- 0:464b401734fd
- Child:
- 1:dbd814e65f1d
initial commit
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
stkiegerl | 0:464b401734fd | 1 | #include "mbed.h" |
stkiegerl | 0:464b401734fd | 2 | #include "Serial_HL.h" |
stkiegerl | 0:464b401734fd | 3 | #include "FuncGenFSST.h" |
stkiegerl | 0:464b401734fd | 4 | |
stkiegerl | 0:464b401734fd | 5 | SerialBLK pc(USBTX, USBRX); |
stkiegerl | 0:464b401734fd | 6 | SvProtocol ua0(&pc); |
stkiegerl | 0:464b401734fd | 7 | |
stkiegerl | 0:464b401734fd | 8 | void CommandHandler(); |
stkiegerl | 0:464b401734fd | 9 | |
stkiegerl | 0:464b401734fd | 10 | int main(void) |
stkiegerl | 0:464b401734fd | 11 | { |
stkiegerl | 0:464b401734fd | 12 | pc.format(8,SerialBLK::None,1); |
stkiegerl | 0:464b401734fd | 13 | pc.baud(115200); // 115200 |
stkiegerl | 0:464b401734fd | 14 | ua0.SvMessage("FuncGen"); // Meldung zum PC senden |
stkiegerl | 0:464b401734fd | 15 | |
stkiegerl | 0:464b401734fd | 16 | Timer stw; stw.start(); |
stkiegerl | 0:464b401734fd | 17 | while(1) { |
stkiegerl | 0:464b401734fd | 18 | CommandHandler(); |
stkiegerl | 0:464b401734fd | 19 | ua0.SvMessage("FuncGen is communicating"); // send test message - delete this line |
stkiegerl | 0:464b401734fd | 20 | ThisThread::sleep_for(1000); // delete this line |
stkiegerl | 0:464b401734fd | 21 | if( stw.read_ms()>10 ) { // 100Hz |
stkiegerl | 0:464b401734fd | 22 | stw.reset(); |
stkiegerl | 0:464b401734fd | 23 | if( ua0.acqON ) { |
stkiegerl | 0:464b401734fd | 24 | } |
stkiegerl | 0:464b401734fd | 25 | } |
stkiegerl | 0:464b401734fd | 26 | } |
stkiegerl | 0:464b401734fd | 27 | return 1; |
stkiegerl | 0:464b401734fd | 28 | } |
stkiegerl | 0:464b401734fd | 29 | |
stkiegerl | 0:464b401734fd | 30 | void CommandHandler() |
stkiegerl | 0:464b401734fd | 31 | { |
stkiegerl | 0:464b401734fd | 32 | uint8_t cmd; |
stkiegerl | 0:464b401734fd | 33 | if( !pc.IsDataAvail() ) |
stkiegerl | 0:464b401734fd | 34 | return; |
stkiegerl | 0:464b401734fd | 35 | } |