wangyouqiang | 38e5336 | 2024-01-23 10:53:48 +0800 | [diff] [blame] | 1 | #include <stdio.h> |
| 2 | #include <strings.h> |
| 3 | #include<stdlib.h> |
| 4 | |
| 5 | #include "lynq_led.h" |
| 6 | |
| 7 | void user_help(void) |
| 8 | { |
| 9 | printf("\t-1 exit\n" |
| 10 | "\t1 open net led\n" |
| 11 | "\t2 close net led \n" |
| 12 | "\t3 open status led\n" |
| 13 | "\t4 close status led\n" |
| 14 | "please input operator: >> \n"); |
| 15 | } |
| 16 | |
| 17 | |
| 18 | int main(int argc, const char *argv[]) |
| 19 | { |
| 20 | int ret; |
| 21 | int opt = 0; |
| 22 | while(1) |
| 23 | { |
| 24 | printf("=========gnss main=========\n"); |
| 25 | user_help(); |
| 26 | scanf("%d", &opt); |
| 27 | switch (opt) |
| 28 | { |
| 29 | case -1: |
| 30 | { |
| 31 | printf("main exit\n"); |
| 32 | return 0; |
| 33 | } |
| 34 | case 1: |
| 35 | { |
| 36 | ret = lynq_set_netled_on(1); |
| 37 | if(ret) |
| 38 | { |
| 39 | printf("[%s-%d] lynq_set_netled_on error\n", __FUNCTION__, __LINE__); |
| 40 | return -1; |
| 41 | } |
| 42 | else |
| 43 | { |
| 44 | printf("open net led success.\n"); |
| 45 | } |
| 46 | break; |
| 47 | } |
| 48 | case 2: |
| 49 | { |
| 50 | ret = lynq_set_netled_on(0); |
| 51 | if(ret) |
| 52 | { |
| 53 | printf("[%s-%d] lynq_set_netled_on error\n", __FUNCTION__, __LINE__); |
| 54 | return -1; |
| 55 | } |
| 56 | else |
| 57 | { |
| 58 | printf("close net led success.\n"); |
| 59 | } |
| 60 | break; |
| 61 | } |
| 62 | case 3: |
| 63 | { |
| 64 | ret = lynq_set_statusled_on(1); |
| 65 | if(ret) |
| 66 | { |
| 67 | printf("[%s-%d] lynq_set_statusled_on error\n", __FUNCTION__, __LINE__); |
| 68 | return -1; |
| 69 | } |
| 70 | else |
| 71 | { |
| 72 | printf("open status led success.\n"); |
| 73 | } |
| 74 | break; |
| 75 | } |
| 76 | case 4: |
| 77 | { |
| 78 | ret = lynq_set_statusled_on(0); |
| 79 | if(ret) |
| 80 | { |
| 81 | printf("[%s-%d] lynq_set_statusled_on error\n", __FUNCTION__, __LINE__); |
| 82 | return -1; |
| 83 | } |
| 84 | else |
| 85 | { |
| 86 | printf("close status led success.\n"); |
| 87 | } |
| 88 | break; |
| 89 | } |
| 90 | default: |
| 91 | { |
| 92 | printf("opt unkuown\n"); |
| 93 | break; |
| 94 | } |
| 95 | } |
| 96 | } |
| 97 | |
| 98 | return 0; |
| 99 | } |
| 100 | |