BLE_Nano nRF51 Central heart rate

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers ant_stack_handler_types.h Source File

ant_stack_handler_types.h

Go to the documentation of this file.
00001 /* Copyright (c) 2013 Nordic Semiconductor. All Rights Reserved.
00002  *
00003  * The information contained herein is property of Nordic Semiconductor ASA.
00004  * Terms and conditions of usage are described in detail in NORDIC
00005  * SEMICONDUCTOR STANDARD SOFTWARE LICENSE AGREEMENT.
00006  *
00007  * Licensees are granted free, non-transferable use of the information. NO
00008  * WARRANTY of ANY KIND is provided. This heading must NOT be removed from
00009  * the file.
00010  *
00011  */
00012 
00013 /**@file
00014  *
00015  * @defgroup ant_stack_handler_types Types definitions for ANT support in SoftDevice handler.
00016  * @{
00017  * @ingroup  softdevice_handler
00018  * @brief    This file contains the declarations of types required for ANT stack support. These
00019  *           types will be defined when the preprocessor define ANT_STACK_SUPPORT_REQD is defined.
00020  */
00021 
00022 #ifndef ANT_STACK_HANDLER_TYPES_H__
00023 #define ANT_STACK_HANDLER_TYPES_H__
00024 
00025 #ifdef ANT_STACK_SUPPORT_REQD
00026 
00027 #include <stdlib.h>
00028 
00029 #define ANT_STACK_EVT_MSG_BUF_SIZE      32                                                /**< Size of ANT event message buffer. This will be provided to the SoftDevice while fetching an event. */
00030 #define ANT_STACK_EVT_STRUCT_SIZE       (sizeof(ant_evt_t))                               /**< Size of the @ref ant_evt_t structure. This will be used by the @ref softdevice_handler to internal event buffer size needed. */
00031 
00032 /**@brief ANT stack event type. */
00033 typedef struct
00034 {
00035     union
00036     {
00037         uint32_t ulForceAlign;                           ///< force the evt_buffer to be 4-byte aligned, required for some casting to ANT_MESSAGE.
00038         uint8_t  evt_buffer[ANT_STACK_EVT_MSG_BUF_SIZE]; ///< Event message buffer.
00039     } msg;
00040     uint8_t channel;                                     ///< Channel number.
00041     uint8_t event;                                       ///< Event code.
00042 } ant_evt_t;
00043 
00044 /**@brief Application ANT stack event handler type. */
00045 typedef void (*ant_evt_handler_t) (ant_evt_t * p_ant_evt);
00046 
00047 /**@brief     Function for registering for ANT events.
00048  *
00049  * @details   The application should use this function to register for receiving ANT events from
00050  *            the SoftDevice. If the application does not call this function, then any ANT event
00051  *            that may be generated by the SoftDevice will NOT be fetched. Once the application has
00052  *            registered for the events, it is not possible to  possible to cancel the registration.
00053  *            However, it is possible to register a different function for handling the events at
00054  *            any point of time.
00055  *
00056  * @param[in] ant_evt_handler Function to be called for each received ANT event.
00057  *
00058  * @retval    NRF_SUCCESS     Successful registration.
00059  * @retval    NRF_ERROR_NULL  Null pointer provided as input.
00060  */
00061 uint32_t softdevice_ant_evt_handler_set(ant_evt_handler_t ant_evt_handler);
00062 
00063 #else
00064 
00065 // The ANT Stack support is not required.
00066 
00067 #define ANT_STACK_EVT_STRUCT_SIZE       0                                                 /**< Since the ANT stack support is not required, this is equated to 0, so that the @ref softdevice_handler.h can compute the internal event buffer size without having to care for ANT events.*/
00068 
00069 #endif // ANT_STACK_SUPPORT_REQD
00070 
00071 #endif // ANT_STACK_HANDLER_TYPES_H__
00072 
00073 /** @} */
00074