返回值: 无\r
\r
#### 读取ALS信息\r
- void mg_als_read( mg_als_t * als_ctrl, als_info_t *info );\r
- 参数定义:\r
+ als_info_t * mg_als_read( mg_als_t * als_ctrl )\r
+ 参数定义:\r
als_ctrl: 按键控制器\r
- info: 传感器信息\r
- 返回值: 无\r
+ 返回值:\r
+ 读取失败,返回NULL;\r
+ 成功,返回传感器信息\r
\r
#### 设置阈值\r
void mg_als_cfg( mg_als_t * als_ctrl, uint32_t threshold_high, uint32_t threshold_low );\r
mg_als_t * mg_als_open( void );
void mg_als_close( mg_als_t * als_ctrl );
-void mg_als_read( mg_als_t * als_ctrl, als_info_t *info );
+als_info_t * mg_als_read( mg_als_t * als_ctrl );
void mg_als_cfg( mg_als_t * als_ctrl, uint32_t threshold_high, uint32_t threshold_low );
#endif //_ALS__H__
}
-void mg_als_read( mg_als_t * als_ctrl, als_info_t *info )
+als_info_t * mg_als_read( mg_als_t * als_ctrl )
{
-
usleep(5000);
if(!stop){
- info->ad_value = als_ctrl->data.ad_value;
+ return &als_ctrl->data;
}else{
- info->ad_value = 44444; //Invalid value
+ return NULL;
}
- info->threshold_high = als_ctrl->data.threshold_high;
- info->threshold_low = als_ctrl->data.threshold_low;
- info->status = als_ctrl->data.status;
}