嵌入式 HI3518c从sensor拿平均亮度决定红外是否开启

int joseph_get_avelum_from_sensor(void)
{
 int qy_ret = 0;
 ISP_EXP_STA_INFO_S joseph_isp_exp_sta_info;

 memset(&joseph_isp_exp_sta_info,0,sizeof(ISP_EXP_STA_INFO_S));
 qy_ret = HI_MPI_ISP_GetExpStaInfo(&joseph_isp_exp_sta_info);
 
 if(qy_ret == 0)
 {
  printf("%s %d The value of ave lum is %x !\n",__FUNCTION__,__LINE__,joseph_isp_exp_sta_info.u8AveLum);
 }
 else
 {
  printf("%s %d Read The value of ave_lum Error !\n",__FUNCTION__,__LINE__);
 }
 return 0;
}

驱动Sensor:


int sensor_read_register(int addr)
{

 #ifdef HI_GPIO_I2C
  
#else
  int fd = -1;
  int ret;
  I2C_DATA_S i2c_data;
  
  fd = open("/dev/hi_i2c", 0);
  if(fd<0)
  {
   printf("Open hi_i2c error!\n");
   return -1;
  }
  
  i2c_data.dev_addr = sensor_i2c_addr;
  i2c_data.reg_addr = addr;
  i2c_data.addr_byte_num = sensor_addr_byte;
  //i2c_data.data = data;
  i2c_data.data_byte_num = sensor_data_byte;
 
  ret = ioctl(fd, CMD_I2C_READ, &i2c_data);
 
  if (ret)
  {
   printf("hi_i2c read faild!\n");
   return -1;
  }
  else
  {
   printf("%s %d The value of current_exp is %X !\n",__FUNCTION__,__LINE__,i2c_data.data);
  }
  close(fd);
#endif
  return 0;

}

 

你可能感兴趣的:(嵌入式 HI3518c从sensor拿平均亮度决定红外是否开启)