Example: tourism industry

Raspberry Pi Pico C/C++ SDK

ColophonCopyright 2020 Raspberry Pi (Trading) documentation of the RP2040 microcontroller is licensed under a Creative Commons Attribution-NoDerivatives (CC BY-ND).build-date: 2021-11-04build-version: 150df05-cleanAbout the SDKT hroughout the text "the SDK" refers to our Raspberry Pi pico SDK. More details about the SDK can befound throughout this book. Source code included in the documentation is Copyright 2020 RaspberryPi (Trading) Ltd. and licensed under the 3-Clause BSD Disclaimer NoticeTECHNICAL AND RELIABILITY DATA FOR Raspberry PI PRODUCTS (INCLUDING DATASHEETS) AS MODIFIED FROMTIME TO TIME ( RESOURCES ) ARE PROVIDED BY Raspberry PI (TRADING) LTD ( RPTL) "AS IS" AND ANY EXPRESSOR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITYAND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.

General code improvements. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 366

Tags:

  Pico, Raspberry

Information

Domain:

Source:

Link to this page:

Please notify us if you found a problem with this document:

Other abuse

Transcription of Raspberry Pi Pico C/C++ SDK

1 ColophonCopyright 2020 Raspberry Pi (Trading) documentation of the RP2040 microcontroller is licensed under a Creative Commons Attribution-NoDerivatives (CC BY-ND).build-date: 2021-11-04build-version: 150df05-cleanAbout the SDKT hroughout the text "the SDK" refers to our Raspberry Pi pico SDK. More details about the SDK can befound throughout this book. Source code included in the documentation is Copyright 2020 RaspberryPi (Trading) Ltd. and licensed under the 3-Clause BSD Disclaimer NoticeTECHNICAL AND RELIABILITY DATA FOR Raspberry PI PRODUCTS (INCLUDING DATASHEETS) AS MODIFIED FROMTIME TO TIME ( RESOURCES ) ARE PROVIDED BY Raspberry PI (TRADING) LTD ( RPTL) "AS IS" AND ANY EXPRESSOR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITYAND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.

2 TO THE MAXIMUM EXTENT PERMITTED BYAPPLICABLE LAW IN NO EVENT SHALL RPTL BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTEGOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ONANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OROTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THE RESOURCES, EVEN IF ADVISED OF THE POSSIBILITY OFSUCH reserves the right to make any enhancements, improvements, corrections or any other modifications to theRESOURCES or any products described in them at any time and without further RESOURCES are intended for skilled users with suitable levels of design knowledge.

3 Users are solely responsible fortheir selection and use of the RESOURCES and any application of the products described in them. User agrees toindemnify and hold RPTL harmless against all liabilities, costs, damages or other losses arising out of their use of grants users permission to use the RESOURCES solely in conjunction with the Raspberry Pi products. All other useof the RESOURCES is prohibited. No licence is granted to any other RPTL or other third party intellectual property RISK ACTIVITIES. Raspberry Pi products are not designed, manufactured or intended for use in hazardousenvironments requiring fail safe performance, such as in the operation of nuclear facilities, aircraft navigation orcommunication systems, air traffic control, weapons systems or safety-critical applications (including life supportsystems and other medical devices), in which the failure of the products could lead directly to death, personal injury orsevere physical or environmental damage ( High Risk Activities ).

4 RPTL specifically disclaims any express or impliedwarranty of fitness for High Risk Activities and accepts no liability for use or inclusions of Raspberry Pi products in HighRisk Pi products are provided subject to RPTL s Standard Terms. RPTL s provision of the RESOURCES does notexpand or otherwise modify RPTL s Standard Terms including but not limited to the disclaimers and warrantiesexpressed in Pi pico C/C++ SDKL egal Disclaimer Notice1 Table of ContentsColophon.. 1 Legal Disclaimer Notice.. 11. About the SDK.. Introduction.. Anatomy of a SDK Application.. 72. SDK Architecture.. The Build System.

5 Every Library is an INTERFACE.. SDK Library Structure.. Higher-level Libraries.. Runtime Support (pico_runtime, pico_standard_link).. Hardware Support Libraries.. Hardware Structs Library.. Hardware Registers Library.. TinyUSB Port.. Directory Structure.. Locations of Files.. Conventions for Library Functions.. Function Naming Conventions.. Return Codes and Error Handling.. Use of Inline Functions.. Builder Pattern for Hardware Configuration APIs.. Customisation and Configuration Using Preprocessor variables.. Preprocessor Variables via Board Configuration File.. Preprocessor Variables Per Binary or Library via CMake.

6 SDK Runtime.. Standard Input/Output (stdio) Support.. Floating-point Support.. Hardware Divider.. Multi-core support.. Using C++.. Next Steps.. 283. Using Programmable I/O (PIO).. What is Programmable I/O (PIO)?.. Background.. I/O Using dedicated hardware on your PC.. I/O Using dedicated hardware on your Raspberry Pi or microcontroller.. I/O Using software control of GPIOs ("bit-banging").. Programmable I/O Hardware using FPGAs and CPLDs.. Programmable I/O Hardware using PIO.. Getting started with PIO.. A First PIO Application.. A Real Example: WS2812 LEDs.. PIO and DMA (A Logic Analyser).

7 Further examples.. Using PIOASM, the PIO Assembler.. Usage.. Directives.. Values.. Expressions.. Comments.. Labels.. Instructions.. Pseudoinstructions.. Output pass through.. 53 Raspberry Pi pico C/C++ SDKT able of Language generators.. PIO Instruction Set Reference.. Summary.. JMP.. WAIT.. IN.. OUT.. PUSH.. PULL.. MOV.. IRQ.. SET.. 674. Library Documentation.. Hardware APIs.. hardware_adc.. hardware_base.. hardware_claim.. hardware_clocks.. hardware_divider.. hardware_dma.. channel_config.. hardware_exception.. hardware_flash.. hardware_gpio.

8 Hardware_i2c.. hardware_interp.. interp_config.. hardware_irq.. hardware_pio.. sm_config.. pio_instructions.. hardware_pll.. hardware_pwm.. hardware_resets.. hardware_rtc.. hardware_spi.. hardware_sync.. hardware_timer.. hardware_uart.. hardware_vreg.. hardware_watchdog.. hardware_xosc.. High Level APIs.. pico_multicore.. fifo.. lockout.. pico_stdlib.. pico_sync.. critical_section.. lock_core.. mutex.. sem.. pico_time.. timestamp.. sleep.. alarm.. repeating_timer.. pico_unique_id.. pico_util.. datetime.. 253 Raspberry Pi pico C/C++ SDKT able of pheap.

9 Queue.. Third-party Libraries.. tinyusb_device.. tinyusb_host.. Runtime Infrastructure.. boot_stage2.. pico_base.. pico_binary_info.. pico_bit_ops.. pico_bootrom.. pico_bootsel_via_double_reset.. pico_cxx_options.. pico_divider.. pico_double.. pico_float.. pico_int64_ops.. pico_malloc.. pico_mem_ops.. pico_platform.. pico_printf.. pico_runtime.. pico_stdio.. pico_stdio_semihosting.. pico_stdio_uart.. pico_stdio_usb.. pico_standard_link.. External API Headers.. boot_picoboot.. boot_uf2.. pico_usb_reset_interface.. 279 Appendix A: App Notes.. 280 Attaching a 7 segment LED via GPIO.

10 280 Wiring information.. 280 List of Files.. 280 Bill of Materials.. 282 DHT-11, DHT-22, and AM2302 Sensors.. 283 Wiring information.. 283 List of Files.. 284 Bill of Materials.. 286 Attaching a 16x2 LCD via TTL.. 286 Wiring information.. 287 List of Files.. 287 Bill of Materials.. 290 Attaching a microphone using the ADC.. 291 Wiring information.. 292 List of Files.. 292 Bill of Materials.. 293 Attaching a BME280 temperature/humidity/pressure sensor via SPI.. 294 Wiring information.. 294 List of Files.. 294 Bill of Materials.. 299 Attaching a MPU9250 accelerometer/gyroscope via SPI.. 299 Wiring information.. 299 List of Files.