stdglue.h 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  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 global STDOUT callback
  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_global_stdout_callback(FuriStdglueWriteCallback callback);
  27. /** Set STDOUT callback for your thread
  28. *
  29. * @param callback callback or NULL to clear
  30. *
  31. * @return true on success, otherwise fail
  32. * @warning function is thread aware, use this API from the same thread
  33. */
  34. bool furi_stdglue_set_thread_stdout_callback(FuriStdglueWriteCallback callback);
  35. #ifdef __cplusplus
  36. }
  37. #endif