gblink_pinconf.h 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. // SPDX-License-Identifier: BSD-2-Clause
  2. // Copyright (c) 2023 KBEmbedded
  3. #ifndef __GBLINK_PINCONF_H__
  4. #define __GBLINK_PINCONF_H__
  5. #pragma once
  6. #include <furi.h>
  7. #include <furi_hal.h>
  8. #ifdef __cplusplus
  9. extern "C" {
  10. #endif
  11. /**
  12. * Set one of the pre-configured pinouts
  13. *
  14. * @param handle Pointer to gblink handle
  15. * @param pinout Which pinout to use
  16. *
  17. * @note The gblink instance must not be gblink_start()'ed!
  18. *
  19. * @returns 0 on success, 1 if gblink instance is not gblink_stop()'ed.
  20. */
  21. int gblink_pin_set_default(void *handle, gblink_pinouts pinout);
  22. /**
  23. * Check if the pinout set matches a pre-configured one
  24. *
  25. * @param handle Pointer to gblink handle
  26. *
  27. * @returns The index of the pre-configured pinout or -1 on error
  28. */
  29. int gblink_pin_get_default(void *handle);
  30. /**
  31. * Set a gpio pin to a specific pin mode
  32. *
  33. * @param handle Pointer to gblink handle
  34. * @param pin Pin mode to assign to the gpio pin
  35. * @param gpio Which gpio pin to assign the pin mode
  36. *
  37. * @note The gblink instance must not be gblink_start()'ed!
  38. *
  39. * @returns 0 on success, 1 if gblink instance is not gblink_stop()'ed.
  40. */
  41. int gblink_pin_set(void *handle, gblink_bus_pins pin, const GpioPin *gpio);
  42. /**
  43. * Get the gpio pin associated with the requested pin mode
  44. *
  45. * @param handle Pointer to gblink handle
  46. * @param pin Pin mode to inquire about
  47. *
  48. * @returns GpioPin pointer
  49. */
  50. const GpioPin *gblink_pin_get(void *handle, gblink_bus_pins pin);
  51. #ifdef __cplusplus
  52. }
  53. #endif
  54. #endif // __GBLINK_PINCONF_H__