nRF51 SDK
 All Data Structures Functions Variables Typedefs Enumerations Enumerator Groups Pages
ANT Broadcast RX Example

Example of basic ANT Broadcast RX. More...

Macros

#define CHANNEL_0   0x00
 
#define CHANNEL_0_ANT_EXT_ASSIGN   0x00
 
#define CHANNEL_0_CHAN_ID_DEV_TYPE   0x00
 
#define CHANNEL_0_CHAN_ID_DEV_NUM   0x00
 
#define CHANNEL_0_CHAN_ID_TRANS_TYPE   0x00
 
#define ANT_CHANNEL_DEFAULT_NETWORK   0x00
 
#define ANT_MSG_IDX_ID   1u
 
#define ANT_EVENT_MSG_BUFFER_MIN_SIZE   32u
 

Functions

void app_error_handler (uint32_t error_code, uint32_t line_num, const uint8_t *p_file_name)
 Function for handling an error. More...
 
static void ant_channel_rx_broadcast_setup (void)
 Function for setting up the ANT module to be ready for RX broadcast. More...
 
static void channel_event_handle (uint8_t *p_event_message_buffer)
 Function for handling ANT RX channel events. More...
 
void PROTOCOL_EVENT_IRQHandler (void)
 Function for stack interrupt handling. More...
 
void softdevice_assert_callback (uint32_t pc, uint16_t line_num, const uint8_t *p_file_name)
 Function for handling SoftDevice asserts. More...
 
void HardFault_Handler (void)
 Function for handling HardFault.
 
int main (void)
 Function for application main entry. Does not return.
 

Detailed Description

When the application is booting, LED0 and LED1 are turned on. Once the SoftDevice is enabled, LED0 and LED1 are turned off to indicate the system is ready.

The example uses wildcard connection, which implies that it will connect to the nearest broadcasting ANT device. Channel period is set to 4 Hz (8192). When a packet is received it will turn on LED0 for 20 milliseconds.

LED1 is turned on whenever the processor enters sleep state and turned off when woken up by an interrupt.

Macro Definition Documentation

#define CHANNEL_0   0x00

ANT Channel 0.

#define CHANNEL_0_ANT_EXT_ASSIGN   0x00

ANT Ext Assign.

#define CHANNEL_0_CHAN_ID_DEV_TYPE   0x00

Device type wildcard.

#define CHANNEL_0_CHAN_ID_DEV_NUM   0x00

Device number wildcard.

#define CHANNEL_0_CHAN_ID_TRANS_TYPE   0x00

Transmission type wildcard.

#define ANT_CHANNEL_DEFAULT_NETWORK   0x00

ANT Channel Network.

#define ANT_MSG_IDX_ID   1u

ANT message ID index.

#define ANT_EVENT_MSG_BUFFER_MIN_SIZE   32u

Minimum size of ANT event message buffer.

Function Documentation

void app_error_handler ( uint32_t  error_code,
uint32_t  line_num,
const uint8_t *  p_file_name 
)

Function for error handling, which is called when an error has occurred.

Parameters
[in]error_codeError code supplied to the handler.
[in]line_numLine number where the error occurred.
[in]p_file_namePointer to the file name.
static void ant_channel_rx_broadcast_setup ( void  )
static

The following commands are issued in this order:

  • assign channel
  • set channel ID
  • open channel
static void channel_event_handle ( uint8_t *  p_event_message_buffer)
static
Parameters
[in]p_event_message_bufferThe ANT event message buffer.
void PROTOCOL_EVENT_IRQHandler ( void  )

Implemented to clear the pending flag when receiving an interrupt from the stack.

void softdevice_assert_callback ( uint32_t  pc,
uint16_t  line_num,
const uint8_t *  p_file_name 
)
Parameters
[in]pcValue of the program counter.
[in]line_numLine number where the assert occurred.
[in]p_file_namePointer to the file name.