Skip to content

elehobica/pico_buttons

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Buttons handling library for Raspberry Pi Pico / Pico 2

Build

Overview

This project is a library for handling multiple buttons on Raspberry Pi Pico / Pico 2

This project features to detect:

  • Single Push event
  • Repeated Single Push event
  • Multiple Push event (exclusive with Repeated Single)
  • Long (Long) Push event (exclusive with Repeated Single)
  • Switch On/Off events

Notes

  • If Multiple detection enabled, time lag defined by 'actFinishCnt' is needed to determine action
  • Repeat count information of Repeated Single detection is served for UI items to accelerate something by continuous button push
  • Use NewButtonConfig() for customizing button detection parameters other than default configurations

Supported Board and Device

  • Raspberry Pi Pico
  • Raspberry Pi Pico 2

How to build

  • See "Getting started with Raspberry Pi Pico"
  • Put "pico-sdk", "pico-examples" and "pico-extras" on the same level with this project folder.
  • Set environmental variables for PICO_SDK_PATH, PICO_EXTRAS_PATH and PICO_EXAMPLES_PATH
  • Confirmed with Pico SDK 2.1.1
> git clone -b 2.1.1 https://github.com/raspberrypi/pico-sdk.git
> cd pico-sdk
> git submodule update -i
> cd ..
> git clone -b sdk-2.1.1 https://github.com/raspberrypi/pico-examples.git
>
> git clone -b sdk-2.1.1 https://github.com/raspberrypi/pico-extras.git
>
> git clone -b main https://github.com/elehobica/pico_buttons.git

Windows

  • Build is confirmed with Developer Command Prompt for VS 2022 and Visual Studio Code on Windows environment
  • Confirmed with cmake-3.27.2-windows-x86_64 and gcc-arm-none-eabi-10.3-2021.10-win32
  • Lanuch "Developer Command Prompt for VS 2022"
> cd pico_buttons\example
> mkdir build && cd build
> cmake -G "NMake Makefiles" ..  ; (for Raspberry Pi Pico 1 series)
> cmake -G "NMake Makefiles" -DPICO_PLATFORM=rp2350 -DPICO_BOARD=pico2 ..  ; (for Raspberry Pi Pico 2)
> nmake
  • Put "*.uf2" on RPI-RP2 or RP2350 drive

Linux

$ cd pico_buttons/example
$ mkdir build && cd build
$ cmake ..  # (for Raspberry Pi Pico 1 series)
$ cmake -DPICO_PLATFORM=rp2350 -DPICO_BOARD=pico2 ..  # (for Raspberry Pi Pico 2)
$ make -j4
  • Download "*.uf2" on RPI-RP2 or RP2350 drive