1 // Copyright 2010-2020 Espressif Systems (Shanghai) PTE LTD 2 // 3 // Licensed under the Apache License, Version 2.0 (the "License"); 4 // you may not use this file except in compliance with the License. 5 // You may obtain a copy of the License at 6 // 7 // http://www.apache.org/licenses/LICENSE-2.0 8 // 9 // Unless required by applicable law or agreed to in writing, software 10 // distributed under the License is distributed on an "AS IS" BASIS, 11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 // See the License for the specific language governing permissions and 13 // limitations under the License. 14 15 #pragma once 16 17 #ifdef __cplusplus 18 extern "C" { 19 #endif 20 21 #include <stdint.h> 22 23 /** 24 * @brief Print formated string to console device 25 * @note float and long long data are not supported! 26 * 27 * @param fmt Format string 28 * @param ... Additional arguments, depending on the format string 29 * @return int: Total number of characters written on success; A negative number on failure. 30 */ 31 int esp_rom_printf(const char *fmt, ...); 32 33 /** 34 * @brief Pauses execution for us microseconds 35 * 36 * @param us Number of microseconds to pause 37 */ 38 void esp_rom_delay_us(uint32_t us); 39 40 /** 41 * @brief esp_rom_printf can print message to different channels simultaneously. 42 * This function can help install the low level putc function for esp_rom_printf. 43 * 44 * @param channel Channel number (startting from 1) 45 * @param putc Function pointer to the putc implementation. Set NULL can disconnect esp_rom_printf with putc. 46 */ 47 void esp_rom_install_channel_putc(int channel, void (*putc)(char c)); 48 49 /** 50 * @brief Disable logging from the ROM code. 51 */ 52 void esp_rom_disable_logging(void); 53 54 /** 55 * @brief Install UART1 as the default console channel, equivalent to `esp_rom_install_channel_putc(1, esp_rom_uart_putc)` 56 */ 57 void esp_rom_install_uart_printf(void); 58 59 #ifdef __cplusplus 60 } 61 #endif 62