1 /* 2 * Copyright (c) 2020 Raspberry Pi (Trading) Ltd. 3 * 4 * SPDX-License-Identifier: BSD-3-Clause 5 */ 6 7 #ifndef _PICO_STDLIB_H 8 #define _PICO_STDLIB_H 9 10 #include "pico.h" 11 #include "pico/stdio.h" 12 #include "pico/time.h" 13 #include "hardware/gpio.h" 14 #include "hardware/uart.h" 15 16 #ifdef __cplusplus 17 extern "C" { 18 #endif 19 20 /** \file stdlib.h 21 * \defgroup pico_stdlib pico_stdlib 22 * 23 * \brief Aggregation of a core subset of Raspberry Pi Pico SDK libraries used by most executables along with some additional 24 * utility methods 25 * 26 * Including pico_stdlib gives you everything you need to get a basic program running 27 * which prints to stdout or flashes a LED 28 * 29 * This library aggregates: 30 * - @ref hardware_divider 31 * - @ref hardware_gpio 32 * - @ref hardware_uart 33 * - @ref pico_runtime 34 * - @ref pico_platform 35 * - @ref pico_stdio 36 * - @ref pico_time 37 * - @ref pico_util 38 * 39 * There are some basic default values used by these functions that will default to 40 * usable values, however, they can be customised in a board definition header via 41 * config.h or similar 42 */ 43 44 // Note PICO_STDIO_UART, PICO_STDIO_USB, PICO_STDIO_SEMIHOSTING are set by the 45 // respective INTERFACE libraries, so these defines are set if the library 46 // is included for the target executable 47 48 #if LIB_PICO_STDIO_UART 49 #include "pico/stdio_uart.h" 50 #endif 51 52 #if LIB_PICO_STDIO_USB 53 #include "pico/stdio_usb.h" 54 #endif 55 56 #if LIB_PICO_STDIO_SEMIHOSTING 57 #include "pico/stdio_semihosting.h" 58 #endif 59 60 // PICO_CONFIG: PICO_DEFAULT_LED_PIN, Optionally define a pin that drives a regular LED on the board, default=Usually provided via board header, group=pico_stdlib 61 62 // PICO_CONFIG: PICO_DEFAULT_LED_PIN_INVERTED, 1 if LED is inverted or 0 if not, type=int, default=0, group=pico_stdlib 63 #ifndef PICO_DEFAULT_LED_PIN_INVERTED 64 #define PICO_DEFAULT_LED_PIN_INVERTED 0 65 #endif 66 67 // PICO_CONFIG: PICO_DEFAULT_WS2812_PIN, Optionally define a pin that controls data to a WS2812 compatible LED on the board, group=pico_stdlib 68 // PICO_CONFIG: PICO_DEFAULT_WS2812_POWER_PIN, Optionally define a pin that controls power to a WS2812 compatible LED on the board, group=pico_stdlib 69 70 /*! \brief Set up the default UART and assign it to the default GPIOs 71 * \ingroup pico_stdlib 72 * 73 * By default this will use UART 0, with TX to pin GPIO 0, 74 * RX to pin GPIO 1, and the baudrate to 115200 75 * 76 * Calling this method also initializes stdin/stdout over UART if the 77 * @ref pico_stdio_uart library is linked. 78 * 79 * Defaults can be changed using configuration defines, 80 * PICO_DEFAULT_UART_INSTANCE, 81 * PICO_DEFAULT_UART_BAUD_RATE 82 * PICO_DEFAULT_UART_TX_PIN 83 * PICO_DEFAULT_UART_RX_PIN 84 */ 85 void setup_default_uart(void); 86 87 #ifdef __cplusplus 88 } 89 #endif 90 #endif 91