defines.h 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112
  1. /**
  2. * This software is subject to the ANT+ Shared Source License
  3. * www.thisisant.com/swlicenses
  4. * Copyright (c) Garmin Canada Inc. 2012
  5. * All rights reserved.
  6. *
  7. * Redistribution and use in source and binary forms, with or
  8. * without modification, are permitted provided that the following
  9. * conditions are met:
  10. *
  11. * 1) Redistributions of source code must retain the above
  12. * copyright notice, this list of conditions and the following
  13. * disclaimer.
  14. *
  15. * 2) Redistributions in binary form must reproduce the above
  16. * copyright notice, this list of conditions and the following
  17. * disclaimer in the documentation and/or other materials
  18. * provided with the distribution.
  19. *
  20. * 3) Neither the name of Garmin nor the names of its
  21. * contributors may be used to endorse or promote products
  22. * derived from this software without specific prior
  23. * written permission.
  24. *
  25. * The following actions are prohibited:
  26. *
  27. * 1) Redistribution of source code containing the ANT+ Network
  28. * Key. The ANT+ Network Key is available to ANT+ Adopters.
  29. * Please refer to http://thisisant.com to become an ANT+
  30. * Adopter and access the key.
  31. *
  32. * 2) Reverse engineering, decompilation, and/or disassembly of
  33. * software provided in binary form under this license.
  34. *
  35. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
  36. * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
  37. * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
  38. * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE HEREBY
  39. * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
  40. * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  41. * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES(INCLUDING,
  42. * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
  43. * SERVICES; DAMAGE TO ANY DEVICE, LOSS OF USE, DATA, OR
  44. * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
  45. * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
  46. * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
  47. * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
  48. * OF THE POSSIBILITY OF SUCH DAMAGE. SOME STATES DO NOT ALLOW
  49. * THE EXCLUSION OF INCIDENTAL OR CONSEQUENTIAL DAMAGES, SO THE
  50. * ABOVE LIMITATIONS MAY NOT APPLY TO YOU.
  51. *
  52. */
  53. /**@file
  54. * @brief Definitions.
  55. * This file is based on implementation originally made in August 2012 by Garmin Canada Inc.
  56. * (former Dynastream Innovations Inc.)
  57. * @defgroup ant_fs_client_main ANT-FS client device simulator
  58. * @{
  59. * @ingroup nrf_ant_fs_client
  60. *
  61. * @brief The ANT-FS client device simulator.
  62. *
  63. */
  64. #ifndef DEFINES_H__
  65. #define DEFINES_H__
  66. #include <stdint.h>
  67. #ifdef __cplusplus
  68. extern "C" {
  69. #endif
  70. #define MAX_ULONG 0xFFFFFFFFu /**< The Max value for the type. */
  71. /**@brief uint16_t type presentation as an union. */
  72. typedef union
  73. {
  74. uint16_t data; /**< The data content. */
  75. struct
  76. {
  77. uint8_t low; /**< The low byte of the data content. */
  78. uint8_t high; /**< The high byte of the data content. */
  79. } bytes;
  80. } ushort_union_t;
  81. /**@brief uint32_t type presentation as an union. */
  82. typedef union
  83. {
  84. uint32_t data; /**< The data content as a single variable. */
  85. uint8_t data_bytes[sizeof(uint32_t)]; /**< The data content as a byte array. */
  86. struct
  87. {
  88. // The least significant byte of the uint32_t in this structure is referenced by byte0.
  89. uint8_t byte0; /**< Byte 0 of the data content. */
  90. uint8_t byte1; /**< Byte 1 of the data content. */
  91. uint8_t byte2; /**< Byte 2 of the data content. */
  92. uint8_t byte3; /**< Byte 3 of the data content. */
  93. } bytes;
  94. } ulong_union_t;
  95. #ifdef __cplusplus
  96. }
  97. #endif
  98. #endif // DEFINES_H__
  99. /**
  100. *@}
  101. **/