bosko lekovic
/
IO_board_K22
K22 processor
main.cpp
- Committer:
- bosko001
- Date:
- 2020-08-15
- Revision:
- 2:b188a511819f
- Parent:
- 1:1052d6227111
- Child:
- 3:71278c5b7c67
File content as of revision 2:b188a511819f:
/* mbed Microcontroller Library * Copyright (c) 2019 ARM Limited * SPDX-License-Identifier: Apache-2.0 */ #include "mbed.h" #include "platform/mbed_thread.h" #include "IOspi.h" // Blinking rate in milliseconds #define BLINKING_RATE_MS 200 DigitalIn b2(SW2); char tx_niz[] = { 7,0,1,2,3, 4, 5 , 6, 7, 8}; void consolafun( void ); Thread th_consola( consolafun ); int main() { // Initialise the digital pin LED1 as an output printf("\n\n\r ____________ POCETAK IOspi_______________\n\r"); inic_IOspi( ); DigitalOut ledB(LED3,1); int b = b2; while (true) { { if( b!= b2) { b = b2; if( b ) { ledB = 1;} else { ledB = 0; static char c = 0; /*writeIOspiData( 0xa0, c++ );*/ transIOspiData( 1, 0xa, c++ ); } } } thread_sleep_for(BLINKING_RATE_MS); } } void consolafun( void ) { while( true ) { char uc = getchar( ); switch( (unsigned char) uc ) { case 'r': case 'R': printf("\n\rcitanje registra, unesi broj:\n\r"); int r; scanf("%x", &r); // printf( "\n\rregistar %x ima vrednost %x\n\r", r, readMiWiReg(r)); break; case 'w': case 'W': { printf("\n\rupis registra, unesi broj registra:"); int r; scanf("%x", &r); printf( " %x", r ); printf("\n\runesi vrednost registra:"); int v; scanf("%x", &v); printf( " %x", v ); // printf( "\n\rregistar %x ima vrednost %x\n\r", r, readMiWiReg(r)); } break; } } }