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/kpu_main.c

    r458 r459  
    148148}
    149149
    150 void digitalWrite(uint8_t Pin, int dwVal);
     150/*
     151 *  ダイレクトデジタルピン出力
     152 */
     153void
     154digitalWrite(uint8_t Pin, int dwVal){
     155    int8_t gpio_pin = gpio_get_gpiohno(Pin, false);
     156
     157    if( gpio_pin >= 0){
     158        gpio_set_pin(TADR_GPIOHS_BASE, (uint8_t)gpio_pin, dwVal);
     159    }
     160}
    151161
    152162#if (CLASS_NUMBER > 1)
     
    188198kpu_model_context_t g_task;
    189199static region_layer_t detect_rl;
     200yolo_result_t yolo_result;
     201yolo_result_t yolo_result_frame;
    190202
    191203volatile uint8_t g_ai_done_flag;
     
    220232        lcd_drawRect(&DrawProp, x1, y1, x2, y2, 2, ST7789_RED);
    221233#endif
     234        if (strcmp(class_lable[class].str, "person") == 0)
     235                yolo_result_frame.person++;
     236        if (strcmp(class_lable[class].str, "car") == 0)
     237                yolo_result_frame.car++;
    222238}
    223239
     
    247263        syslog(LOG_NOTICE, "Sample program starts (exinf = %d).", (int_t) exinf);
    248264
    249         pinMode(LED_PIN, OUTPUT);
     265        pinMode(LED_G_PIN, OUTPUT);
     266        digitalWrite(LED_G_PIN, HIGH);
     267        pinMode(LED_R_PIN, OUTPUT);
     268        digitalWrite(LED_R_PIN, HIGH);
     269        pinMode(LED_B_PIN, OUTPUT);
     270        digitalWrite(LED_B_PIN, HIGH);
    250271
    251272        select_spi0_dvp_mode(1);
     
    523544                lcd_drawPicture(hlcd, 0, 0, hcmr->_width, hcmr->_height, (uint16_t *)hcmr->_dataBuffer);
    524545
     546                yolo_result_frame.person = 0;
     547                yolo_result_frame.car = 0;
     548
    525549                /* draw boxs */
    526550                region_layer_draw_boxes(&detect_rl, drawboxes);
     551
     552                if (yolo_result.reset) {
     553                        yolo_result.reset = 0;
     554                        yolo_result.person = 0;
     555                        yolo_result.car = 0;
     556                }
     557                if (yolo_result.person < yolo_result_frame.person)
     558                        yolo_result.person = yolo_result_frame.person;
     559                if (yolo_result.car < yolo_result_frame.car)
     560                        yolo_result.car = yolo_result_frame.car;
    527561        }
    528562        ov2640_activate(hcmr, false);
Note: See TracChangeset for help on using the changeset viewer.