bosko lekovic
/
IO_spi
IO spi
Diff: main.cpp
- Revision:
- 4:fce988d27938
- Parent:
- 3:71278c5b7c67
- Child:
- 6:12b2660d7dff
diff -r 71278c5b7c67 -r fce988d27938 main.cpp --- a/main.cpp Sun Aug 23 16:20:21 2020 +0200 +++ b/main.cpp Sun Sep 06 00:18:11 2020 +0200 @@ -6,8 +6,9 @@ #include "mbed.h" #include "platform/mbed_thread.h" -#include "IOtest.h" -#include "IOboard.h" +#include "IOspiLed.h" +#include "IOgpiospi.h" +#include "IOprotokol.h" // Blinking rate in milliseconds #define BLINKING_RATE_MS 200 @@ -22,32 +23,38 @@ void consolafun( void ); -Thread th_consola( consolafun ); +Thread th_consola; int main() { // Initialise the digital pin LED1 as an output -printf("\n\n\r ____________ POCETAK IOspi_______________\n\r"); +printf("\n\n\r ____________ POCETAK IOboard_______________\n\r"); - inic_IOspi( ); + inic_IOspiLed( ); // inicIOboard_spi( ); - inicIOboard_spi( ); + inicIO_gpiospi( ); + inicIO_protokol( ); + DigitalOut ledB(LED3,1); int b = b2; - + th_consola.start( consolafun); + while (true) { { - + + spiLed_mainfun(); + if( b!= b2) { b = b2; if( b ) { /*ledB = 1;*/} else { /*ledB = 0;*/ static char c = 0; /*writeIOspiData( 0xa0, c++ );*/ - transIOspiData( 1, 0xa, c++ ); } + // transIOspiData( 1, 0xa, c++ ); + } } ThisThread::yield(); @@ -91,6 +98,10 @@ // printf( "\n\rregistar %x ima vrednost %x\n\r", r, readMiWiReg(r)); } break; + case 's': case 'S': + set_shiftspi_signal( ); + break; + } ThisThread::yield(); thread_sleep_for(100);