![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
Fan Control Demo
Fork of mbed_fota by
main.cpp@8:9eec2c246a85, 2015-08-20 (annotated)
- Committer:
- dudnwjs
- Date:
- Thu Aug 20 05:16:55 2015 +0000
- Revision:
- 8:9eec2c246a85
- Parent:
- 7:3478c46cceef
- Child:
- 12:e3d3676753cc
add msg handler doxygen
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
dudnwjs | 8:9eec2c246a85 | 1 | /** |
dudnwjs | 8:9eec2c246a85 | 2 | * @file main.cpp |
dudnwjs | 8:9eec2c246a85 | 3 | * @brief interface configuration & main loop start |
dudnwjs | 8:9eec2c246a85 | 4 | * Copyright 2015 SEVENCORE Co., Ltd. |
dudnwjs | 8:9eec2c246a85 | 5 | * |
dudnwjs | 8:9eec2c246a85 | 6 | * @author HyeongJun Kim |
dudnwjs | 8:9eec2c246a85 | 7 | * @version 1.0.0 |
dudnwjs | 8:9eec2c246a85 | 8 | * @since 2015-08-17 |
dudnwjs | 8:9eec2c246a85 | 9 | */ |
dudnwjs | 8:9eec2c246a85 | 10 | |
dudnwjs | 8:9eec2c246a85 | 11 | |
dudnwjs | 0:a1f6b1ba8a1e | 12 | #include "mbed.h" |
dudnwjs | 1:5cf3a6c969be | 13 | #include "BleMsgHandler.h" |
dudnwjs | 3:1e70387e1337 | 14 | #include "app.h" |
dudnwjs | 0:a1f6b1ba8a1e | 15 | |
dudnwjs | 0:a1f6b1ba8a1e | 16 | Serial hostpc(USBTX,USBRX); |
dudnwjs | 0:a1f6b1ba8a1e | 17 | Serial device(p13,p14); |
dudnwjs | 6:8dd20294b2aa | 18 | LocalFileSystem local("local"); // Create the local filesystem |
dudnwjs | 0:a1f6b1ba8a1e | 19 | DigitalOut myled(LED1); |
dudnwjs | 6:8dd20294b2aa | 20 | DigitalOut myled2(LED2); |
dudnwjs | 6:8dd20294b2aa | 21 | DigitalOut myled3(LED3); |
dudnwjs | 6:8dd20294b2aa | 22 | DigitalOut myled4(LED4); |
dudnwjs | 0:a1f6b1ba8a1e | 23 | |
dudnwjs | 1:5cf3a6c969be | 24 | using namespace sevencore_fota; |
dudnwjs | 1:5cf3a6c969be | 25 | |
dudnwjs | 7:3478c46cceef | 26 | void led_setting_one(void){ |
dudnwjs | 6:8dd20294b2aa | 27 | myled = 1; |
dudnwjs | 6:8dd20294b2aa | 28 | myled2 = 1; |
dudnwjs | 6:8dd20294b2aa | 29 | myled3 = 1; |
dudnwjs | 6:8dd20294b2aa | 30 | myled4 = 1; |
dudnwjs | 6:8dd20294b2aa | 31 | } |
dudnwjs | 6:8dd20294b2aa | 32 | |
dudnwjs | 7:3478c46cceef | 33 | void led_setting_zero(void){ |
dudnwjs | 6:8dd20294b2aa | 34 | myled = 0; |
dudnwjs | 6:8dd20294b2aa | 35 | myled2 = 0; |
dudnwjs | 6:8dd20294b2aa | 36 | myled3 = 0; |
dudnwjs | 6:8dd20294b2aa | 37 | myled4 = 0; |
dudnwjs | 6:8dd20294b2aa | 38 | } |
dudnwjs | 6:8dd20294b2aa | 39 | |
dudnwjs | 6:8dd20294b2aa | 40 | int main() { |
dudnwjs | 8:9eec2c246a85 | 41 | wait(0.5); |
dudnwjs | 8:9eec2c246a85 | 42 | myled = 1; |
dudnwjs | 8:9eec2c246a85 | 43 | wait(0.5); |
dudnwjs | 8:9eec2c246a85 | 44 | myled = 0; |
dudnwjs | 8:9eec2c246a85 | 45 | wait(0.5); |
dudnwjs | 8:9eec2c246a85 | 46 | myled = 1; |
dudnwjs | 8:9eec2c246a85 | 47 | wait(0.5); |
dudnwjs | 8:9eec2c246a85 | 48 | myled = 0; |
dudnwjs | 8:9eec2c246a85 | 49 | wait(0.5); |
dudnwjs | 8:9eec2c246a85 | 50 | led_setting_one(); |
dudnwjs | 8:9eec2c246a85 | 51 | wait(0.5); |
dudnwjs | 5:e11b23f9aacc | 52 | hostpc.baud(9600); |
dudnwjs | 8:9eec2c246a85 | 53 | wait(0.5); |
dudnwjs | 3:1e70387e1337 | 54 | device.baud(115200); |
dudnwjs | 6:8dd20294b2aa | 55 | device.set_flow_control(device.RTSCTS,P2_7,p12); |
dudnwjs | 8:9eec2c246a85 | 56 | wait(0.5); |
dudnwjs | 3:1e70387e1337 | 57 | |
dudnwjs | 5:e11b23f9aacc | 58 | BleMsgHandler myfota(&device,&hostpc); |
dudnwjs | 6:8dd20294b2aa | 59 | |
dudnwjs | 1:5cf3a6c969be | 60 | myfota.PrintTitle(); |
dudnwjs | 3:1e70387e1337 | 61 | app_rst_gap(&myfota); |
dudnwjs | 3:1e70387e1337 | 62 | |
dudnwjs | 8:9eec2c246a85 | 63 | for(int i = 0; i < 200; i++) { |
dudnwjs | 4:60be78a172c2 | 64 | myfota.BleReceiveMsg(); |
dudnwjs | 4:60be78a172c2 | 65 | myfota.BleMsgHandle(); |
dudnwjs | 4:60be78a172c2 | 66 | } |
dudnwjs | 3:1e70387e1337 | 67 | |
dudnwjs | 0:a1f6b1ba8a1e | 68 | while(1) { |
dudnwjs | 0:a1f6b1ba8a1e | 69 | myled = 1; |
dudnwjs | 0:a1f6b1ba8a1e | 70 | wait(0.5); |
dudnwjs | 0:a1f6b1ba8a1e | 71 | myled = 0; |
dudnwjs | 0:a1f6b1ba8a1e | 72 | wait(0.5); |
dudnwjs | 0:a1f6b1ba8a1e | 73 | } |
dudnwjs | 5:e11b23f9aacc | 74 | |
dudnwjs | 0:a1f6b1ba8a1e | 75 | } |