esp_rom_sys.h 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  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. #pragma once
  15. #ifdef __cplusplus
  16. extern "C" {
  17. #endif
  18. #include <stdint.h>
  19. /**
  20. * @brief Print formated string to console device
  21. * @note float and long long data are not supported!
  22. *
  23. * @param fmt Format string
  24. * @param ... Additional arguments, depending on the format string
  25. * @return int: Total number of characters written on success; A negative number on failure.
  26. */
  27. int esp_rom_printf(const char *fmt, ...);
  28. /**
  29. * @brief Pauses execution for us microseconds
  30. *
  31. * @param us Number of microseconds to pause
  32. */
  33. void esp_rom_delay_us(uint32_t us);
  34. /**
  35. * @brief esp_rom_printf can print message to different channels simultaneously.
  36. * This function can help install the low level putc function for esp_rom_printf.
  37. *
  38. * @param channel Channel number (startting from 1)
  39. * @param putc Function pointer to the putc implementation. Set NULL can disconnect esp_rom_printf with putc.
  40. */
  41. void esp_rom_install_channel_putc(int channel, void (*putc)(char c));
  42. /**
  43. * @brief Disable logging from the ROM code.
  44. */
  45. void esp_rom_disable_logging(void);
  46. /**
  47. * @brief Install UART1 as the default console channel, equivalent to `esp_rom_install_channel_putc(1, esp_rom_uart_putc)`
  48. */
  49. void esp_rom_install_uart_printf(void);
  50. #ifdef __cplusplus
  51. }
  52. #endif