Ignore:
Timestamp:
Sep 25, 2020, 7:28:35 PM (4 years ago)
Author:
coas-nagasima
Message:

Azure IoT への送信内容を、検出したpersonとcarの数を送信するよう変更。
Azure IoT CentralからLEDのON/OFFが出来るよう更新。

File:
1 edited

Legend:

Unmodified
Added
Removed
  • azure_iot_hub_riscv/trunk/app_iothub_client/src/command.c

    r458 r459  
    99#include "monitor.h"
    1010#include "device.h"
     11#include "kpu_main.h"
    1112
    1213/*
     
    5556"          WIFI                   set ssid pwd \n";
    5657
    57 #define LED_PIN       3         /* D13 */
    58 static const uint16_t led_pattern[1] = {
    59         LED_PIN
     58static const uint16_t led_pattern[] = {
     59        LED_G_PIN,
     60        LED_R_PIN,
     61        LED_B_PIN,
    6062};
    6163
     
    8890
    8991/*
    90  *  ダイレクトデジタルピン出力
    91  */
    92 void
    93 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 /*
    10292 *  LED設定コマンド関数
    10393 */
     
    110100        arg1 = a2i(argv[1]);
    111101        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);
    117114        }
    118115        return 0;
Note: See TracChangeset for help on using the changeset viewer.