tile_button_driver.h 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. /**
  2. * NOTICE
  3. *
  4. * Copyright 2017 Tile Inc. All Rights Reserved.
  5. * All code or other information included in the accompanying files ("Tile Source Material")
  6. * is PROPRIETARY information of Tile Inc. ("Tile") and access and use of the Tile Source Material
  7. * is subject to these terms. The Tile Source Material may only be used for demonstration purposes,
  8. * and may not be otherwise distributed or made available to others, including for commercial purposes.
  9. * Without limiting the foregoing , you understand and agree that no production use
  10. * of the Tile Source Material is allowed without a Tile ID properly obtained under a separate
  11. * agreement with Tile.
  12. * You also understand and agree that Tile may terminate the limited rights granted under these terms
  13. * at any time in its discretion.
  14. * All Tile Source Material is provided AS-IS without warranty of any kind.
  15. * Tile does not warrant that the Tile Source Material will be error-free or fit for your purposes.
  16. * Tile will not be liable for any damages resulting from your use of or inability to use
  17. * the Tile Source Material.
  18. *
  19. * Support: firmware_support@tile.com
  20. */
  21. /** @file tile_button_driver.h
  22. ** @brief Tile Button driver
  23. */
  24. #ifndef TILE_BUTTON_DRIVER_H_
  25. #define TILE_BUTTON_DRIVER_H_
  26. #include <stdint.h>
  27. #ifdef __cplusplus
  28. extern "C" {
  29. #endif
  30. /**
  31. * @brief Button states
  32. */
  33. enum TILE_BUTTON_STATES
  34. {
  35. TILE_BUTTON_PRESSED,
  36. TILE_BUTTON_RELEASED,
  37. };
  38. /**
  39. * Tile button driver.
  40. */
  41. struct tile_button_driver
  42. {
  43. /**
  44. * Read the state of the Tile button.
  45. *
  46. * @param[out] button_state State of the button. See TILE_BUTTON_STATES.
  47. *
  48. * @return See @ref TILE_ERROR_CODES.
  49. */
  50. int (*read_state)(uint8_t *button_state);
  51. };
  52. /**
  53. * Register the button module.
  54. *
  55. * @param[in] driver Driver for the Tile button.
  56. *
  57. * @return TILE_ERROR_SUCCESS.
  58. */
  59. int tile_button_register(struct tile_button_driver *driver);
  60. /**
  61. * Call when the Tile button has been pressed.
  62. *
  63. * @return TILE_ERROR_SUCCESS.
  64. */
  65. int tile_button_pressed(void);
  66. #ifdef __cplusplus
  67. }
  68. #endif
  69. #endif // TILE_BUTTON_DRIVER_H_