stdglue.h 847 B

123456789101112131415161718192021222324252627282930313233343536
  1. /**
  2. * @file stdglue.h
  3. * Furi: stdlibc glue
  4. */
  5. #pragma once
  6. #include <stdbool.h>
  7. #include <stdlib.h>
  8. #ifdef __cplusplus
  9. extern "C" {
  10. #endif
  11. /** Write callback
  12. * @param _cookie pointer to cookie (see stdio gnu extension)
  13. * @param data pointer to data
  14. * @param size data size @warnign your handler must consume everything
  15. */
  16. typedef void (*FuriStdglueWriteCallback)(void* _cookie, const char* data, size_t size);
  17. /** Initialized std library glue code */
  18. void furi_stdglue_init();
  19. /** Set STDOUT callback for your thread
  20. *
  21. * @param callback callback or NULL to clear
  22. *
  23. * @return true on success, otherwise fail
  24. * @warning function is thread aware, use this API from the same thread
  25. */
  26. bool furi_stdglue_set_thread_stdout_callback(FuriStdglueWriteCallback callback);
  27. #ifdef __cplusplus
  28. }
  29. #endif