TSMD Tester Nucleo controller code

Dependencies:   mbed

Committer:
renemagrit
Date:
Wed Jul 29 21:24:29 2020 +0000
Revision:
0:760ab96ff048
TSMD Tester Nucleo controller code

Who changed what in which revision?

UserRevisionLine numberNew contents of line
renemagrit 0:760ab96ff048 1 #include "mbed.h"
renemagrit 0:760ab96ff048 2 /*
renemagrit 0:760ab96ff048 3 * Datum: 29.07.2020.
renemagrit 0:760ab96ff048 4 * Napomena: Za rad TSMD TESTER GUI Aplikacije potrebno je ucitati ovaj kod
renemagrit 0:760ab96ff048 5 * u kontroler koji se koristi za testiranje.
renemagrit 0:760ab96ff048 6 * NE MENJATI KOD UKOLIKO ZELITE ISPRAVAN RAD APLIKACIJE!
renemagrit 0:760ab96ff048 7 *
renemagrit 0:760ab96ff048 8 * Board: Nucleo F476RE, ili bilo koja druga ploca koja ima kompatabilne
renemagrit 0:760ab96ff048 9 * DigitalOut pinout kao Nucleo F466RE.
renemagrit 0:760ab96ff048 10 *
renemagrit 0:760ab96ff048 11 * Autor: Marta Avramovic
renemagrit 0:760ab96ff048 12 */
renemagrit 0:760ab96ff048 13
renemagrit 0:760ab96ff048 14 Serial pc(USBTX, USBRX); // tx, rx
renemagrit 0:760ab96ff048 15
renemagrit 0:760ab96ff048 16 //.Inicijalizacija
renemagrit 0:760ab96ff048 17 DigitalOut _D15(PB_8);
renemagrit 0:760ab96ff048 18 DigitalOut _D14(PB_9);
renemagrit 0:760ab96ff048 19 DigitalOut _D13(PA_5);
renemagrit 0:760ab96ff048 20 DigitalOut _D12(PA_6);
renemagrit 0:760ab96ff048 21 DigitalOut _D11(PA_7);
renemagrit 0:760ab96ff048 22 DigitalOut _D10(PB_6);
renemagrit 0:760ab96ff048 23 DigitalOut _D9(PC_7);
renemagrit 0:760ab96ff048 24 DigitalOut _D8(PA_9);
renemagrit 0:760ab96ff048 25 DigitalOut _D7(PA_8);
renemagrit 0:760ab96ff048 26 DigitalOut _D6(PB_10);
renemagrit 0:760ab96ff048 27 DigitalOut _D5(PB_4);
renemagrit 0:760ab96ff048 28 DigitalOut _D4(PB_5);
renemagrit 0:760ab96ff048 29 DigitalOut _D3(PB_3);
renemagrit 0:760ab96ff048 30 DigitalOut _D2(PA_10);
renemagrit 0:760ab96ff048 31
renemagrit 0:760ab96ff048 32 //.callback serial receive function
renemagrit 0:760ab96ff048 33 void callback() {
renemagrit 0:760ab96ff048 34
renemagrit 0:760ab96ff048 35 char buffer[10];
renemagrit 0:760ab96ff048 36 pc.gets(buffer, sizeof(buffer));
renemagrit 0:760ab96ff048 37
renemagrit 0:760ab96ff048 38 int digitalSum = 0;
renemagrit 0:760ab96ff048 39 sscanf((const char *)buffer,"%d",&digitalSum);
renemagrit 0:760ab96ff048 40 //pc.printf("%d \n", digitalSum);
renemagrit 0:760ab96ff048 41
renemagrit 0:760ab96ff048 42 _D2 = (digitalSum & 0b1);
renemagrit 0:760ab96ff048 43 _D3 = (digitalSum & 0b10);
renemagrit 0:760ab96ff048 44 _D4 = (digitalSum & 0b100);
renemagrit 0:760ab96ff048 45 _D5 = (digitalSum & 0b1000);
renemagrit 0:760ab96ff048 46 _D6 = (digitalSum & 0b10000);
renemagrit 0:760ab96ff048 47 _D7 = (digitalSum & 0b100000);
renemagrit 0:760ab96ff048 48 _D8 = (digitalSum & 0b1000000);
renemagrit 0:760ab96ff048 49 _D9 = (digitalSum & 0b10000000);
renemagrit 0:760ab96ff048 50 _D10 = (digitalSum & 0b100000000);
renemagrit 0:760ab96ff048 51 _D11 = (digitalSum & 0b1000000000);
renemagrit 0:760ab96ff048 52 _D12 = (digitalSum & 0b10000000000);
renemagrit 0:760ab96ff048 53 _D13 = (digitalSum & 0b100000000000);
renemagrit 0:760ab96ff048 54 _D14 = (digitalSum & 0b1000000000000);
renemagrit 0:760ab96ff048 55 _D15 = (digitalSum & 0b10000000000000);
renemagrit 0:760ab96ff048 56
renemagrit 0:760ab96ff048 57 }
renemagrit 0:760ab96ff048 58
renemagrit 0:760ab96ff048 59 //.Main Code
renemagrit 0:760ab96ff048 60 int main() {
renemagrit 0:760ab96ff048 61 pc.attach(&callback);
renemagrit 0:760ab96ff048 62 }