bl_iot_sdk icon indicating copy to clipboard operation
bl_iot_sdk copied to clipboard

PIR interrupt example

Open mikewen opened this issue 4 years ago • 3 comments

How to use PIR interrupt?

Which pins can be used for PIR detection?

Thanks!

mikewen avatar Feb 19 '21 00:02 mikewen

Hi @mikewen , there is huge chance that the reply from developers will be delayed, due they celebrating Chinese New Year. (EDIT: I guess I was wrong. Bouffalo developers are such a nice people 😊)

gamelaster avatar Feb 19 '21 06:02 gamelaster

@mikewen If you want to wake up BL602 by one GPIO which is connected to one external PIR, please add the following into bl_factory_params_IoTKitA_40M.dts

    gpio7 {
        status = "okay";
        pin = <7>;
        feature = "button";
        active = "Hi";
        mode = "multipress";
        button {
            debounce = <10>;
            short_press_ms {
                start = <100>;
                end = <3000>;
                kevent = <2>;
            };
            long_press_ms {
                start = <6000>;
                end = <10000>;
                kevent = <3>;
            };
            longlong_press_ms {
                start = <15000>;
                kevent = <4>;
            };
            trig_level = "Hi";
        };
        hbn_use = "okay";
    };

Then call hal_hbn_enter in code. Please double check the GPIO7 is not PULL-UP with your board, cause GPIO7 is used as UART RX by default. Maybe you need some rework. Thanks

YafeiJin avatar Feb 19 '21 06:02 YafeiJin

@YafeiJin Thank you!

What does hal_hbn_enter do? I guess use hal_hbn_enter to enter the sleep mode? (stand for 'hal hibernate enter' ?)

mikewen avatar Feb 19 '21 15:02 mikewen