bosko lekovic
/
IO_board
IO plocana FRDM K64
Diff: SPIprotokol/IOspiprotokol.cpp
- Revision:
- 15:3429cdc6e5f4
- Parent:
- 7:4aa3dac73b66
--- a/SPIprotokol/IOspiprotokol.cpp Sat Apr 24 21:26:03 2021 +0200 +++ b/SPIprotokol/IOspiprotokol.cpp Fri Apr 30 00:06:39 2021 +0200 @@ -3,13 +3,18 @@ #include <functional> // extern DigitalOut ioTest; + static DigitalOut ledB(LED2,1); + + + extern volatile char ext_command, ext_data; extern char verzija, reset_flag; void C_spiProtokol::do_writeCommand( const char command, const char data) { - +//ledB =!ledB; + //pc_data->set_validity(0x3f); //ioTest =! ioTest; switch( command ) @@ -31,7 +36,7 @@ case 13: pc_ledControl->set_ledView(aktuelna_indikacija);pc_ledControl->set_colorTemplate(); pc_ledControl->set_ledView(aktuelna_indikacija);/* set_byte(pc_data->get_raelIndication());*/ break; case 14: /* brisanje look-up tabele sijalica */ break; - case 15: /* reset ploce */ break; + case 15: /* reset ploce */NVIC_SystemReset(); break; } } @@ -59,12 +64,19 @@ return 15; } +Timeout tout; + + void C_spiProtokol::do_readGroupCommand( const char command) { + //ledB=!ledB; switch( command ) { - case 1: /* aktiviranje timera na 4 sekunde za gasenja IO */ break; - case 2: /* gasenje timera */ break; + case 1: /* aktiviranje timera na 4 sekunde za gasenja IO */ + ledB=!ledB; + tout.attach([this](){pc_data->set_command(0); NVIC_SystemReset();}, 4.0); + break; + case 2: /* gasenje timera */ tout.detach(); /*ledB=1;*/break; } }