Welcome Guest,Register Now
Log In

ANT Forum

Welcome guest, please Login or Register

   

Need help about bi-directional communication

Rank

Total Posts: 7

Joined 2014-08-20

PM

Hi, I'm testing an app based on the acquirechannel sample application.
I'm using the android device as slave to receive data from a chip every 3 seconds.
I would like to send out a data to the chip by clicking a button.
Any ideas?
Thanks!

Here's the code from chip to receive the data:
return_value sd_ant_event_get(&ant;_channel, &event;, event_message_buffer);
  
  if (
return_value == NRF_SUCCESS)
  
{
   
// Handle event
   
switch (event)
   
{
     
case EVENT_RX:
       
handle_channel_event(event00event_message_buffer);
       break;
     default:
       break;
   
}
  } 


static void handle_channel_event(uint32_t eventuint8_t adduint32_t data,uint8_t p_event_message_buffer)          
{
    uint32_t return_value
;
    
    switch (
event)
    
{
        
      
case EVENT_RX
     switch (
p_event_message_buffer[1])
     
{
      
/* Acknowledged data recieved */
      //case MESG_BROADCAST_DATA_ID:  
      
case MESG_ACKNOWLEDGED_DATA_ID:   //Necessary to check acknowledged data in embedded systems         
        
switch (p_event_message_buffer[ANT_OP_ID])
          
{
            
case START_MEAS:
              
check 1;
              break;
            case 
CHANNEL_COM:
              break;
            case 
PCAP_CONFIG:
              
nrf_gpio_pin_set(LED6);
              break;
            default:
              break;
          
}
        
break;
     
}                
        
default:      
            break;
    
}