mirror of
https://github.com/Dasharo/zephyr.git
synced 2026-03-06 14:57:20 -08:00
Prepend the text 'cmake_minimum_required(VERSION 3.8.2)' into the application and test build scripts. Modern versions of CMake will spam users with a deprecation warning when the toplevel CMakeLists.txt does not specify a CMake version. This is documented in bug #8355. To resolve this we include a cmake_minimum_required() line into the toplevel build scripts. Additionally, cmake_minimum_required is invoked from within boilerplate.cmake. The highest version will be enforced. This patch allows us to afterwards change CMake policy CMP000 from OLD to NEW which in turn finally rids us of the verbose warning. The extra boilerplate is considered more acceptable than the verbosity of the CMP0000 policy. Signed-off-by: Sebastian Bøe <sebastian.boe@nordicsemi.no>
.. _button-sample: Button demo ########### Overview ******** A simple button demo showcasing the use of GPIO input with interrupts. Requirements ************ The demo assumes that a push button is connected to one of GPIO lines. The sample code is configured to work on boards with user defined buttons and that have defined the SW0_* variable in board.h To use this sample, you will require a board that defines the user switch in its header file. The :file:`board.h` must define the following variables: - SW0_GPIO_NAME (or SW0_GPIO_CONTROLLER) - SW0_GPIO_PIN The following boards currently define the above variables: - bbc_microbit - cc3220sf_launchxl - frdm_k64f - nrf51_pca10028 - nrf52840_pca10056 - nrf52_pca10040 - nucleo_f103rb - :ref:`quark_d2000_devboard` - quark_se_c1000_devboard - quark_se_c1000_ss_devboard Building and Running ******************** This sample can be built for multiple boards, in this example we will build it for the nucleo_f103rb board: .. zephyr-app-commands:: :zephyr-app: samples/basic/button :board: nucleo_f103rb :goals: build :compact: After startup, the program looks up a predefined GPIO device, and configures the pin in input mode, enabling interrupt generation on falling edge. During each iteration of the main loop, the state of GPIO line is monitored and printed to the serial console. When the input button gets pressed, the interrupt handler will print an information about this event along with its timestamp.