common.h 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. /* Copyright (c) 2009 Nordic Semiconductor. All Rights Reserved.
  2. *
  3. * The information contained herein is property of Nordic Semiconductor ASA.
  4. * Terms and conditions of usage are described in detail in NORDIC
  5. * SEMICONDUCTOR STANDARD SOFTWARE LICENSE AGREEMENT.
  6. *
  7. * Licensees are granted free, non-transferable use of the information. NO
  8. * WARRANTY of ANY KIND is provided. This heading must NOT be removed from
  9. * the file.
  10. *
  11. */
  12. #ifndef COMMON_H
  13. #define COMMON_H
  14. /*lint ++flb "Enter library region" */
  15. #include <stdbool.h>
  16. #include <stdint.h>
  17. /* @file
  18. * @brief Common header file for generic macros and definitions
  19. *
  20. */
  21. /*
  22. * GPIO glue macros, this can be used to define a pin number in source/header file and use that macro for pin
  23. * configuration using this expansion.
  24. * example:
  25. * #define RESET_PIN 8
  26. * NRF_GPIO->PINCNF(RESET_PIN) = XXX ; // Expanded NRF_GPIO->PIN_CNF[8] = XXX
  27. */
  28. #define PINX_GLUE(x, y, z) x##y##_##z /*!< first level glue for pin macros */
  29. #define PINCNF(p) PINX_GLUE(PIN,p,CNF) /*!< gpio configure pin number 'p' */
  30. #define PINOUT(p) PINX_GLUE(PIN,p,OUT) /*!< gpio out pin number 'p' */
  31. /*lint --flb "Leave library region" */
  32. #endif