HimaxWiseEyePlus / Seeed_Grove_Vision_AI_Module_V2

MIT License
30 stars 18 forks source link

App tflm_fd_fm, use GPIO #21

Closed hatrinh-sj closed 1 week ago

hatrinh-sj commented 2 weeks ago

Hi Kris,

My requirement is simple: if a face is detected, turn on a specific GPIO pin. Is it possible to use GPIO on Vision AI V2? I use serial only for debugging. I don't need face mesh or landmark.

stevehuang82 commented 2 weeks ago

Hi @hatrinh-sj,

You can configure PA0(D0) as a GPIO function using the following method:

include "hx_drv_gpio.h"

// Configure PA0(D0) as GPIO0 hx_drv_gpio_set_output(AON_GPIO0, GPIO_OUT_LOW); hx_drv_scu_set_PA0_pinmux(SCU_PA0_PINMUX_AON_GPIO0_2, 1);

// set GPIO0 output high hx_drv_gpio_set_out_value(AON_GPIO0, GPIO_OUT_HIGH);

// set GPIO0 output low hx_drv_gpio_set_out_value(AON_GPIO0, GPIO_OUT_LOW);

grove_ai_v2_pinout

hatrinh-sj commented 1 week ago

Thank you. I guess I must put the command to flip the pin in function "cv_fd_fm_run" in "cvapp_fd_fm.cpp". Is it correct?

    if (alg_result->num_tracked_human_targets == 0)
    {
        //need to wait jpeg transfer done
        ...
        hx_drv_gpio_set_out_value(AON_GPIO0, GPIO_OUT_LOW);

    }
    else {
       hx_drv_gpio_set_out_value(AON_GPIO0, GPIO_OUT_HIGH);
       ...

    }
stevehuang82 commented 1 week ago

Yes, it is.