Access custom data (actual payload) inside ESB payload

Hi,

I am trying to modify ACK handling in ESB(nrf_esb.c, inside on_radio_disabled_rx()) but confused about accessing real payload data (PRX example, SDK17)

  1.  
    static  uint8_t  m_rx_payload_buffer[NRF_ESB_MAX_PAYLOAD_LENGTH + 2]
     is used for receive by setting 
    NRF_RADIO->PACKETPTR        = (uint32_t)m_rx_payload_buffer;
     
  2. It should hold total ESB payload defined as 
    typedef struct
    {
        uint8_t length;                                 //!< Length of the packet (maximum value is @ref NRF_ESB_MAX_PAYLOAD_LENGTH).
        uint8_t pipe;                                   //!< Pipe used for this payload.
        int8_t  rssi;                                   //!< RSSI for the received packet.
        uint8_t noack;                                  //!< Flag indicating that this packet will not be acknowledgement. Flag is ignored when selective auto ack is enabled.
        uint8_t pid;                                    //!< PID assigned during communication.
        uint8_t data[NRF_ESB_MAX_PAYLOAD_LENGTH];       //!< The payload data.
    } nrf_esb_payload_t;
    
     
  3. I guess that would make first byte of data as m_rx_payload_buffer[5]?
  4. However, I can see stuff like this: 
            memcpy(m_rx_fifo.p_payload[m_rx_fifo.entry_point]->data, &m_rx_payload_buffer[2],
                   m_rx_fifo.p_payload[m_rx_fifo.entry_point]->length);
      which suggests data index ==  [2].

So, which index is correct? What am I missing?

Thanks.

Related