2018.07.26

Dependencies:   EthernetInterface TextLCD USBDevice USBHost2 mbed

Committer:
sayzyas
Date:
Thu Jul 26 00:29:55 2018 +0000
Revision:
1:392f3708c3e2
Parent:
0:2cb1be240f50
2018.07.26

Who changed what in which revision?

UserRevisionLine numberNew contents of line
sayzyas 0:2cb1be240f50 1 #include "mbed.h"
sayzyas 0:2cb1be240f50 2 #include "rtos.h"
sayzyas 0:2cb1be240f50 3 #include "common.h"
sayzyas 0:2cb1be240f50 4 #include "com_func.h"
sayzyas 0:2cb1be240f50 5
sayzyas 0:2cb1be240f50 6
sayzyas 0:2cb1be240f50 7 void cf_led_onoff(
sayzyas 0:2cb1be240f50 8 DigitalOut *led1,
sayzyas 0:2cb1be240f50 9 DigitalOut *led2,
sayzyas 0:2cb1be240f50 10 DigitalOut *led3,
sayzyas 0:2cb1be240f50 11 DigitalOut *led4,
sayzyas 0:2cb1be240f50 12 bool led1_onoff,
sayzyas 0:2cb1be240f50 13 bool led2_onoff,
sayzyas 0:2cb1be240f50 14 bool led3_onoff,
sayzyas 0:2cb1be240f50 15 bool led4_onoff
sayzyas 0:2cb1be240f50 16 ){
sayzyas 0:2cb1be240f50 17 if (led1_onoff == true ) *led1 = 1;
sayzyas 0:2cb1be240f50 18 else *led1 = 0;
sayzyas 0:2cb1be240f50 19 if (led2_onoff == true ) *led2 = 1;
sayzyas 0:2cb1be240f50 20 else *led2 = 0;
sayzyas 0:2cb1be240f50 21 if (led3_onoff == true ) *led3 = 1;
sayzyas 0:2cb1be240f50 22 else *led3 = 0;
sayzyas 0:2cb1be240f50 23 if (led4_onoff == true ) *led4 = 1;
sayzyas 0:2cb1be240f50 24 else *led4 = 0;
sayzyas 0:2cb1be240f50 25 }
sayzyas 0:2cb1be240f50 26
sayzyas 0:2cb1be240f50 27 // LED demo
sayzyas 0:2cb1be240f50 28 void cf_led_demo(
sayzyas 0:2cb1be240f50 29 DigitalOut *led1,
sayzyas 0:2cb1be240f50 30 DigitalOut *led2,
sayzyas 0:2cb1be240f50 31 DigitalOut *led3,
sayzyas 0:2cb1be240f50 32 DigitalOut *led4,
sayzyas 0:2cb1be240f50 33 int cnt,
sayzyas 0:2cb1be240f50 34 int wait
sayzyas 0:2cb1be240f50 35 ){
sayzyas 0:2cb1be240f50 36 for( int i = 0; i < cnt; i++ ) {
sayzyas 0:2cb1be240f50 37 *led1 = 1; // on
sayzyas 0:2cb1be240f50 38 *led2 = 0; // off
sayzyas 0:2cb1be240f50 39 *led3 = 0; // off
sayzyas 0:2cb1be240f50 40 *led4 = 0; // off
sayzyas 0:2cb1be240f50 41 Thread::wait(wait);
sayzyas 0:2cb1be240f50 42 *led1 = 0; // off
sayzyas 0:2cb1be240f50 43 *led2 = 1; // on
sayzyas 0:2cb1be240f50 44 *led3 = 0; // off
sayzyas 0:2cb1be240f50 45 *led4 = 0; // off
sayzyas 0:2cb1be240f50 46 Thread::wait(wait);
sayzyas 0:2cb1be240f50 47 *led1 = 0; // off
sayzyas 0:2cb1be240f50 48 *led2 = 0; // off
sayzyas 0:2cb1be240f50 49 *led3 = 1; // on
sayzyas 0:2cb1be240f50 50 *led4 = 0; // off
sayzyas 0:2cb1be240f50 51 Thread::wait(wait);
sayzyas 0:2cb1be240f50 52 *led1 = 0; // off
sayzyas 0:2cb1be240f50 53 *led2 = 0; // off
sayzyas 0:2cb1be240f50 54 *led3 = 0; // off
sayzyas 0:2cb1be240f50 55 *led4 = 1; // on
sayzyas 0:2cb1be240f50 56 Thread::wait(wait);
sayzyas 0:2cb1be240f50 57 *led1 = 0; // off
sayzyas 0:2cb1be240f50 58 *led2 = 0; // off
sayzyas 0:2cb1be240f50 59 *led3 = 0; // off
sayzyas 0:2cb1be240f50 60 *led4 = 0; // off
sayzyas 0:2cb1be240f50 61 }
sayzyas 0:2cb1be240f50 62 }
sayzyas 0:2cb1be240f50 63
sayzyas 0:2cb1be240f50 64 void cf_led_error(
sayzyas 0:2cb1be240f50 65 DigitalOut *led1,
sayzyas 0:2cb1be240f50 66 DigitalOut *led2,
sayzyas 0:2cb1be240f50 67 DigitalOut *led3,
sayzyas 0:2cb1be240f50 68 DigitalOut *led4
sayzyas 0:2cb1be240f50 69 ){
sayzyas 0:2cb1be240f50 70 for( int i = 0; i < 16; i++ ) {
sayzyas 0:2cb1be240f50 71 *led1 = 1; // on
sayzyas 0:2cb1be240f50 72 *led2 = 1; // off
sayzyas 0:2cb1be240f50 73 *led3 = 1; // off
sayzyas 0:2cb1be240f50 74 *led4 = 1; // off
sayzyas 0:2cb1be240f50 75 Thread::wait(30);
sayzyas 0:2cb1be240f50 76 *led1 = 0; // off
sayzyas 0:2cb1be240f50 77 *led2 = 0; // on
sayzyas 0:2cb1be240f50 78 *led3 = 0; // off
sayzyas 0:2cb1be240f50 79 *led4 = 0; // off
sayzyas 0:2cb1be240f50 80 Thread::wait(30);
sayzyas 0:2cb1be240f50 81 }
sayzyas 0:2cb1be240f50 82 }
sayzyas 0:2cb1be240f50 83