/* Try to read a data sample for every channel.  */
static int32_t cn0503_update_code(struct cn0503_dev *dev, bool *code_rdy)
/* Try to read a data sample for every channel.  */
static int32_t cn0503_update_code(struct cn0503_dev *dev, bool *code_rdy)
{
	int32_t ret;
	uint16_t byte_count;
	uint8_t no_data_samples = 0;
	int8_t i;
	*code_rdy = false;
	ret = adpd410x_get_fifo_bytecount(dev->adpd4100_handler, &byte_count);
	if(ret != SUCCESS)
		return FAILURE;
	for(i = 0; i < dev->active_slots; i++) {
		if(dev->two_channel_slots & (1 << i))
			no_data_samples += 2 * dev->data_sizes[i];
		else
			no_data_samples += dev->data_sizes[i];
	}
	if(byte_count < no_data_samples)
		return SUCCESS;
	*code_rdy = true;
	return adpd410x_get_data(dev->adpd4100_handler, dev->data_channel);
}