bouffalolab / bl_iot_sdk

BL602/BL702 SDK. Any technical topic, please access the following link.
http://bbs.bouffalolab.com
Apache License 2.0
265 stars 170 forks source link

PIR interrupt example #43

Open mikewen opened 3 years ago

mikewen commented 3 years ago

How to use PIR interrupt?

Which pins can be used for PIR detection?

Thanks!

gamelaster commented 3 years ago

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 😊)

YafeiJin commented 3 years ago

@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

mikewen commented 3 years ago

@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' ?)