/samples/bluetooth/st_ble_sensor/src/ |
A D | button_svc.c | 25 static const struct gpio_dt_spec button = GPIO_DT_SPEC_GET(DT_ALIAS(sw0), gpios); variable 32 if (!gpio_is_ready_dt(&button)) { in button_init() 34 button.port->name); in button_init() 38 ret = gpio_pin_configure_dt(&button, GPIO_INPUT); in button_init() 41 ret, button.port->name, button.pin); in button_init() 46 gpio_init_callback(&gpio_cb, handler, BIT(button.pin)); in button_init() 47 gpio_add_callback(button.port, &gpio_cb); in button_init() 48 ret = gpio_pin_interrupt_configure_dt(&button, GPIO_INT_EDGE_TO_ACTIVE); in button_init() 51 "GPIO %s pin %d", ret, button.port->name, button.pin); in button_init()
|
/samples/bluetooth/encrypted_advertising/peripheral/src/ |
A D | main.c | 53 button.pin); in get_passkey_confirmation() 74 if (!gpio_is_ready_dt(&button)) { in setup_btn() 75 LOG_ERR("Error: button device %s is not ready", button.port->name); in setup_btn() 79 ret = gpio_pin_configure_dt(&button, GPIO_INPUT); in setup_btn() 81 LOG_ERR("Error %d: failed to configure %s pin %d", ret, button.port->name, in setup_btn() 82 button.pin); in setup_btn() 86 ret = gpio_pin_interrupt_configure_dt(&button, GPIO_INT_EDGE_TO_ACTIVE); in setup_btn() 89 button.port->name, button.pin); in setup_btn() 93 gpio_init_callback(&button_cb_data, button_pressed, BIT(button.pin)); in setup_btn() 94 gpio_add_callback(button.port, &button_cb_data); in setup_btn() [all …]
|
/samples/bluetooth/encrypted_advertising/central/src/ |
A D | main.c | 59 button.pin); in get_passkey_confirmation() 80 if (!gpio_is_ready_dt(&button)) { in setup_btn() 81 LOG_ERR("Error: button device %s is not ready", button.port->name); in setup_btn() 85 ret = gpio_pin_configure_dt(&button, GPIO_INPUT); in setup_btn() 87 LOG_ERR("Error %d: failed to configure %s pin %d", ret, button.port->name, in setup_btn() 88 button.pin); in setup_btn() 92 ret = gpio_pin_interrupt_configure_dt(&button, GPIO_INT_EDGE_TO_ACTIVE); in setup_btn() 95 button.port->name, button.pin); in setup_btn() 99 gpio_init_callback(&button_cb_data, button_pressed, BIT(button.pin)); in setup_btn() 100 gpio_add_callback(button.port, &button_cb_data); in setup_btn() [all …]
|
/samples/basic/button/src/ |
A D | main.c | 28 static const struct gpio_dt_spec button = GPIO_DT_SPEC_GET_OR(SW0_NODE, gpios, variable 49 if (!gpio_is_ready_dt(&button)) { in main() 51 button.port->name); in main() 55 ret = gpio_pin_configure_dt(&button, GPIO_INPUT); in main() 58 ret, button.port->name, button.pin); in main() 62 ret = gpio_pin_interrupt_configure_dt(&button, in main() 66 ret, button.port->name, button.pin); in main() 70 gpio_init_callback(&button_cb_data, button_pressed, BIT(button.pin)); in main() 71 gpio_add_callback(button.port, &button_cb_data); in main() 72 printk("Set up button at %s pin %d\n", button.port->name, button.pin); in main() [all …]
|
/samples/boards/espressif/light_sleep/src/ |
A D | main.c | 28 static const struct gpio_dt_spec button = variable 33 if (!gpio_is_ready_dt(&button)) { in main() 34 printk("Error: button device %s is not ready\n", button.port->name); in main() 38 const int wakeup_level = (button.dt_flags & GPIO_ACTIVE_LOW) ? 0 : 1; in main() 40 esp_gpio_wakeup_enable(button.pin, in main() 49 if (gpio_pin_get_dt(&button) == wakeup_level) { in main() 50 printk("Waiting for GPIO%d to go high...\n", button.pin); in main() 53 } while (gpio_pin_get_dt(&button) == wakeup_level); in main()
|
/samples/boards/nxp/mimxrt1060_evk/system_off/src/ |
A D | main.c | 31 static const struct gpio_dt_spec button = GPIO_DT_SPEC_GET_OR(SW0_NODE, gpios, { 0 }); variable 38 if (!gpio_is_ready_dt(&button)) { in main() 39 printk("Error: button device %s is not ready\n", button.port->name); in main() 44 int ret = gpio_pin_configure_dt(&button, GPIO_INPUT); in main() 47 printk("Error %d: failed to configure %s pin %d\n", ret, button.port->name, in main() 48 button.pin); in main() 52 ret = gpio_pin_interrupt_configure_dt(&button, GPIO_INT_EDGE_TO_ACTIVE); in main() 55 button.port->name, button.pin); in main() 84 printk("Entering system off; press %s to restart sooner\n", button.port->name); in main()
|
/samples/boards/st/power_mgmt/standby_shutdown/src/ |
A D | main.c | 35 static const struct gpio_dt_spec button = variable 115 if (!gpio_is_ready_dt(&button)) { in main() 117 button.port->name); in main() 121 ret = gpio_pin_configure_dt(&button, GPIO_INPUT); in main() 124 ret, button.port->name, button.pin); in main() 128 ret = gpio_pin_interrupt_configure_dt(&button, in main() 132 ret, button.port->name, button.pin); in main() 136 gpio_init_callback(&button_cb_data, button_pressed, BIT(button.pin)); in main() 137 gpio_add_callback(button.port, &button_cb_data); in main()
|
/samples/basic/button/ |
A D | sample.yaml | 4 sample.basic.button: 6 - button 12 harness: button
|
A D | README.rst | 1 .. zephyr:code-sample:: button 10 A simple button demo showcasing the use of GPIO input with interrupts. 11 The sample prints a message to the console each time a button is pressed. 13 .. NOTE:: If you are looking into an implementation of button events with 20 The board hardware must have a push button connected via a GPIO pin. These are 23 The button must be configured using the ``sw0`` :ref:`devicetree <dt-guide>` 36 will be turned on when the button is pressed, and turned off off when it is 68 label = "User button"; 82 meant to apply to the button, such as ``(GPIO_PULL_UP | GPIO_ACTIVE_LOW)`` 105 :zephyr-app: samples/basic/button [all …]
|
A D | CMakeLists.txt | 5 project(button) project
|
/samples/boards/st/power_mgmt/wkup_pins/src/ |
A D | main.c | 22 static const struct gpio_dt_spec button = GPIO_DT_SPEC_GET(WKUP_SRC_NODE, gpios); variable 28 printk("\nWake-up button is connected to %s pin %d\n", button.port->name, button.pin); in main() 35 gpio_pin_configure_dt(&button, STM32_GPIO_WKUP); in main()
|
/samples/net/openthread/coap/src/ |
A D | main.c | 27 static const struct gpio_dt_spec button = GPIO_DT_SPEC_GET_OR(SW0_NODE, gpios, {0}); variable 55 button_init(&button); in main() 57 gpio_init_callback(&button_cb_data, button_pressed, BIT(button.pin)); in main() 58 gpio_add_callback_dt(&button, &button_cb_data); in main()
|
/samples/bluetooth/mesh/src/ |
A D | microbit.c | 16 static const struct gpio_dt_spec button = variable 53 gpio_pin_configure_dt(&button, GPIO_INPUT); in configure_button() 54 gpio_pin_interrupt_configure_dt(&button, GPIO_INT_EDGE_TO_ACTIVE); in configure_button() 56 gpio_init_callback(&button_cb, button_pressed, BIT(button.pin)); in configure_button() 58 gpio_add_callback(button.port, &button_cb); in configure_button() 72 gpio_pin_interrupt_configure_dt(&button, GPIO_INT_EDGE_TO_ACTIVE); in board_output_number() 87 gpio_pin_interrupt_configure_dt(&button, GPIO_INT_DISABLE); in board_prov_complete()
|
/samples/boards/nordic/dynamic_pinctrl/src/ |
A D | remap.c | 34 const struct gpio_dt_spec button = GPIO_DT_SPEC_GET_OR(DT_ALIAS(sw0), in remap_pins() local 38 if (!gpio_is_ready_dt(&button)) { in remap_pins() 42 ret = gpio_pin_configure_dt(&button, GPIO_INPUT); in remap_pins() 48 if (gpio_pin_get_dt(&button)) { in remap_pins()
|
/samples/boards/renesas/comparator/src/ |
A D | main.c | 26 static const struct gpio_dt_spec button = GPIO_DT_SPEC_GET_OR(SW0_NODE, gpios, {0}); variable 84 if (!gpio_is_ready_dt(&button)) { in main() 85 printk("Error: button device %s is not ready\n", button.port->name); in main() 89 ret = gpio_pin_configure_dt(&button, GPIO_INPUT); in main() 91 printk("Error %d: failed to configure %s pin %d\n", ret, button.port->name, in main() 92 button.pin); in main()
|
/samples/shields/x_nucleo_53l0a1/src/ |
A D | main.c | 121 const struct gpio_dt_spec button = GPIO_DT_SPEC_GET(SW0_NODE, gpios); in main() local 126 if (!gpio_is_ready_dt(&button)) { in main() 128 button.port->name); in main() 132 gpio_pin_configure_dt(&button, GPIO_INPUT); in main() 133 gpio_pin_interrupt_configure_dt(&button, GPIO_INT_EDGE_RISING); in main() 134 gpio_init_callback(&button_cb_data, change_mode, BIT(button.pin)); in main() 135 gpio_add_callback(button.port, &button_cb_data); in main()
|
/samples/boards/st/power_mgmt/wkup_pins/boards/ |
A D | nucleo_g031k8.overlay | 10 /* the board has no actual button, you need to connect PA0 to GND with a jumper wire */ 13 user_button: button {
|
/samples/bluetooth/mesh_provisioner/src/ |
A D | main.c | 319 static const struct gpio_dt_spec button = GPIO_DT_SPEC_GET_OR(SW0_NODE, gpios, {0}); variable 331 if (!gpio_is_ready_dt(&button)) { in button_init() 332 printk("Error: button device %s is not ready\n", button.port->name); in button_init() 335 ret = gpio_pin_configure_dt(&button, GPIO_INPUT); in button_init() 337 printk("Error %d: failed to configure %s pin %d\n", ret, button.port->name, in button_init() 338 button.pin); in button_init() 341 ret = gpio_pin_interrupt_configure_dt(&button, GPIO_INT_EDGE_TO_ACTIVE); in button_init() 344 button.port->name, button.pin); in button_init() 347 gpio_init_callback(&button_cb_data, button_pressed, BIT(button.pin)); in button_init() 348 gpio_add_callback(button.port, &button_cb_data); in button_init()
|
/samples/bluetooth/st_ble_sensor/ |
A D | README.rst | 11 GATT services. Currently only button notification and LED service are 27 Open ST Bluetooth LE Sensor app and click on "CONNECT TO A DEVICE" button to scan Bluetooth LE devi… 30 Push SW0 button on embedded device to test button service.
|
/samples/subsys/usb/hid-mouse/ |
A D | README.rst | 11 by the Zephyr project. This very simple driver enumerates a board with a button 12 into a mouse that has a left mouse button and optionally (depending on 13 the number of buttons on the board) a right mouse button, X-axis movement, 16 will be performed on every button click if the bus is in suspended state. 30 - ``INPUT_KEY_0``: left button 31 - ``INPUT_KEY_1``: right button 97 When you press the button on your board, it will act as if the left 98 mouse button was pressed, and this information will be displayed 110 If your board has more than one button, they will act as right mouse button,
|
/samples/subsys/usb/legacy/hid-mouse/ |
A D | README.rst | 11 by the Zephyr project. This very simple driver enumerates a board with a button 12 into a mouse that has a left mouse button and optionally (depending on 13 the number of buttons on the board) a right mouse button, X-axis movement, 16 will be performed on every button click if the bus is in suspended state. 33 - ``INPUT_KEY_0``: left button 34 - ``INPUT_KEY_1``: right button 100 When you press the button on your board, it will act as if the left 101 mouse button was pressed, and this information will be displayed 113 If your board has more than one button, they will act as right mouse button,
|
/samples/boards/nordic/mesh/onoff-app/ |
A D | README.rst | 16 FICR. Each button controls the state of its 19 The models for button 1 and LED 1 are in the node's root element. 20 The 3 remaining button/LED pairs are in elements 1 through 3. 24 After provisioning, the button clients must 30 If a button is pressed only once within a 1 second interval, it sends an 35 using one button for "on" and another for "off" would reduce the number 58 Prior to provisioning, each button controls its corresponding LED as one 62 binds button 2 and LED 1 to application key 1. It then configures button 2 74 bind 1 1 1001 # bind appkey 1 to button 2 on element 1 (unicast 0101) 75 pub-set 0101 c000 1 0 0 1001 # publish button 2 to group address c000
|
/samples/boards/nordic/system_off/ |
A D | Kconfig | 11 bool "Use button to wake up device from system off" 14 Enable system off wakeup from pressing sw0 button.
|
/samples/boards/st/power_mgmt/standby_shutdown/ |
A D | README.rst | 13 Press and hold the user button: 16 release the user button to exit from shutdown mode or from shutdown mode. 40 Press and hold the user button: 43 release the user button to exit from shutdown mode or from shutdown mode.
|
/samples/bluetooth/mesh_provisioner/ |
A D | Kconfig | 9 bool "Use sw0 button to provision"
|