Changeset 459 for azure_iot_hub_riscv/trunk/app_iothub_client/src/command.c
- Timestamp:
- Sep 25, 2020, 7:28:35 PM (4 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
azure_iot_hub_riscv/trunk/app_iothub_client/src/command.c
r458 r459 9 9 #include "monitor.h" 10 10 #include "device.h" 11 #include "kpu_main.h" 11 12 12 13 /* … … 55 56 " WIFI set ssid pwd \n"; 56 57 57 #define LED_PIN 3 /* D13 */ 58 static const uint16_t led_pattern[1] = { 59 LED_PIN 58 static const uint16_t led_pattern[] = { 59 LED_G_PIN, 60 LED_R_PIN, 61 LED_B_PIN, 60 62 }; 61 63 … … 88 90 89 91 /* 90 * ダイレクトデジタルピン出力91 */92 void93 digitalWrite(uint8_t Pin, int dwVal){94 int8_t gpio_pin = gpio_get_gpiohno(Pin, false);95 96 if( gpio_pin >= 0){97 gpio_set_pin(TADR_GPIOHS_BASE, (uint8_t)gpio_pin, dwVal);98 }99 }100 101 /*102 92 * LED設定コマンド関数 103 93 */ … … 110 100 arg1 = a2i(argv[1]); 111 101 arg2 = a2i(argv[2]); 112 if(arg1 >= 1 && arg1 <= 4){ 113 if(arg2 != 0) 114 digitalWrite(led_pattern[arg1-1], 1); 115 else 116 digitalWrite(led_pattern[arg1-1], 0); 102 if(arg1 >= 1 && arg1 <= sizeof(led_pattern) / sizeof(led_pattern[0])){ 103 if(arg2 != 0) { 104 digitalWrite(led_pattern[arg1-1], LOW); 105 syslog(LOG_NOTICE, "digitalWrite(%d,LOW)", arg1); 106 } 107 else { 108 digitalWrite(led_pattern[arg1-1], HIGH); 109 syslog(LOG_NOTICE, "digitalWrite(%d,HIGH)", arg1); 110 } 111 } 112 else{ 113 syslog(LOG_NOTICE, "LED %d is not arival.", arg1); 117 114 } 118 115 return 0;
Note:
See TracChangeset
for help on using the changeset viewer.