faefa

Dependencies:   mbed CANMsg

Committer:
francescopistone
Date:
Thu Jan 31 06:57:39 2019 +0000
Branch:
test_branch
Revision:
10:26a7f59ab667
Parent:
7:c9fd242538d9
xxx

Who changed what in which revision?

UserRevisionLine numberNew contents of line
nerit 0:1e09cd7d66b4 1 Watchdog wd;
nerit 0:1e09cd7d66b4 2
nerit 0:1e09cd7d66b4 3 #if defined(speedMaster)
francescopistone 10:26a7f59ab667 4 InterruptIn tractorSpeedRead(PB_1); // define interrupt pin for tractor speed calculation MASTER MODE
francescopistone 10:26a7f59ab667 5 DigitalOut quinconceOut(PA_0,PullUp); // sincro per quinconcio out
francescopistone 10:26a7f59ab667 6 DigitalIn quinconceIn(PA_1,PullUp);
francescopistone 10:26a7f59ab667 7 //DigitalOut ProvaSincro(D8,PullUp);
francescopistone 10:26a7f59ab667 8 InterruptIn DcEncoder(PA_14);
nerit 0:1e09cd7d66b4 9 #else
francescopistone 10:26a7f59ab667 10 InterruptIn tractorSpeedRead(PA_5); // define interrupt pin for tractor speed calculation SLAVE MODE
francescopistone 10:26a7f59ab667 11 //DigitalIn quinconceIn(PA_0,PullUp);
francescopistone 10:26a7f59ab667 12 InterruptIn quinconceIn(PA_0);
francescopistone 10:26a7f59ab667 13 DigitalIn quinconceOut(PA_1,PullUp); // sincro per quinconcio out
francescopistone 10:26a7f59ab667 14 InterruptIn DcEncoder(PA_14);
nerit 0:1e09cd7d66b4 15 #endif
nerit 0:1e09cd7d66b4 16
nerit 0:1e09cd7d66b4 17 DigitalIn TBzeroPinInputRev(PB_11); // define input of reading zero position of distributor wheel
francescopistone 10:26a7f59ab667 18 //DigitalIn ElementPosition(PB_2); // define input for reading if seed element is down or up for master module, speed clock for slave
francescopistone 10:26a7f59ab667 19 InterruptIn ElementPosition(PB_2); // define input for reading speed of seed wheel with fixed 25 hole
nerit 0:1e09cd7d66b4 20 DigitalIn seedWheelZeroPinInputRev(PB_12); // define input of reading zero position of seeding wheel
nerit 0:1e09cd7d66b4 21 DigitalIn buttonUser(PC_13); // pulsante su scheda
nerit 0:1e09cd7d66b4 22
francescopistone 10:26a7f59ab667 23 DigitalOut speedClock(PA_6); // define out for speed clock repeater
nerit 0:1e09cd7d66b4 24
nerit 0:1e09cd7d66b4 25 InterruptIn pwmCheck(PB_13);
nerit 0:1e09cd7d66b4 26 PwmOut SDmotorPWM(PB_13); // define frequency command for seeding whell motor driver
nerit 0:1e09cd7d66b4 27 DigitalOut SDmotorInB(PB_14); // sd motor half bridge direction selector
nerit 0:1e09cd7d66b4 28 DigitalOut SDmotorInA(PB_15); // SD motor half bridge direction selector
nerit 0:1e09cd7d66b4 29 DigitalIn enDiag_A(PB_5); // SD motor fault condition input A
nerit 0:1e09cd7d66b4 30 DigitalIn enDiag_B(PB_4); // SD motor fault condition input A
nerit 0:1e09cd7d66b4 31 AnalogIn SDcurrent(PA_4); // SD power current feedback
nerit 0:1e09cd7d66b4 32
nerit 0:1e09cd7d66b4 33 DigitalOut TBmotor_M1(PC_8); // TB motor step division M1
nerit 0:1e09cd7d66b4 34 DigitalOut TBmotor_M2(PC_6); // TB motor step division M2
francescopistone 10:26a7f59ab667 35 DigitalOut TBmotor_M3(PC_6); // TB motor step division M3
nerit 0:1e09cd7d66b4 36 DigitalOut TBmotorRst(PC_4); // TB motor driver reset
nerit 0:1e09cd7d66b4 37 DigitalOut TBmotorStepOut(PB_3); // TB motor step command
nerit 0:1e09cd7d66b4 38 DigitalOut TBmotorDirecti(PA_10); // TB motor direction command
nerit 0:1e09cd7d66b4 39
nerit 0:1e09cd7d66b4 40
nerit 0:1e09cd7d66b4 41 #if defined(speedMaster)
nerit 0:1e09cd7d66b4 42 DigitalOut led(LED1); // ATTENZIONE: LED1 E' SU PA5 / D13
nerit 0:1e09cd7d66b4 43 #else
nerit 0:1e09cd7d66b4 44 DigitalOut led(PC_7); // ATTENZIONE: LED1 E' SU PA5 / D13
nerit 0:1e09cd7d66b4 45 #endif
nerit 0:1e09cd7d66b4 46
francescopistone 10:26a7f59ab667 47 DigitalIn zeroRequestIn(PB_6); // define input of zero request for slave module
francescopistone 10:26a7f59ab667 48 DigitalIn runRequestIn(PB_9); // define input of run request for slave module
nerit 0:1e09cd7d66b4 49
nerit 0:1e09cd7d66b4 50 #if defined(canbusActive)
nerit 0:1e09cd7d66b4 51 CAN can1(PA_11,PA_12,100000); // CAN BUS channel for communication with other slave and master consolle
nerit 0:1e09cd7d66b4 52 int checkState=0;
nerit 0:1e09cd7d66b4 53 #endif
nerit 0:1e09cd7d66b4 54 CANMessage txMsg;
nerit 0:1e09cd7d66b4 55 CANMessage rxMsg;
nerit 0:1e09cd7d66b4 56
nerit 0:1e09cd7d66b4 57 #if defined(pcSerial)
francescopistone 10:26a7f59ab667 58 Serial pc(USBTX, USBRX,250000); // serial channel for PC communication
nerit 0:1e09cd7d66b4 59 #else
nerit 0:1e09cd7d66b4 60 #if defined(speedTime)
francescopistone 10:26a7f59ab667 61 Serial pc(USBTX, USBRX,250000); // serial channel for PC communication
nerit 0:1e09cd7d66b4 62 #endif
nerit 0:1e09cd7d66b4 63 #endif
nerit 0:1e09cd7d66b4 64