Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(299)

Side by Side Diff: device/generic_sensor/iio/sensor_data_iio.cc

Issue 2370343002: [sensors] Ambient light sensor implementation for ChromeOS and Linux. (Closed)
Patch Set: Newest version. and some comments Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "device/generic_sensor/iio/sensor_data_iio.h"
6 #include "device/sensors/public/cpp/device_sensors_consts.h"
7
8 namespace device {
9
10 namespace {
11
12 using mojom::SensorType;
13
14 const size_t kAlsCols = 5;
Mikhail 2016/10/14 13:59:04 can omit it
maksims (do not use this acc) 2016/10/17 06:06:59 Done.
15
16 const char* kAmbientLightFileNames[][kAlsCols] = {
17 {"in_illuminance0_input", "in_illuminance_input", "in_illuminance0_raw",
18 "in_illuminance_raw", "illuminance0_input"}};
19
20 // An example of other sensor:
21 //
22 // const char* kAccelerometerFileNames[3][3] = {
23 // { "x1", "x2", "x3", },
24 // { "y1", "y2", "y3", },
25 // { "z1", "z2", "z3", },
26 // };
27
28 } // namespace
29
30 bool CreateSensorData(mojom::SensorType type, SensorDataIio* data) {
Mikhail 2016/10/14 13:59:04 DCHECK(data) or pass it as SensorDataIio&
maksims (do not use this acc) 2016/10/17 06:06:59 Done.
31 switch (type) {
32 case SensorType::AMBIENT_LIGHT:
33 data->sensor_file_names[0] = &kAmbientLightFileNames[0][0];
34 data->sensor_file_names_cols = arraysize(*kAmbientLightFileNames);
35 data->sensor_file_names_rows = arraysize(kAmbientLightFileNames);
36 data->reporting_mode = mojom::ReportingMode::ON_CHANGE;
37 data->default_configuration =
38 PlatformSensorConfiguration(kDefaultAmbientLightFrequencyHz);
39 break;
40 default:
41 NOTIMPLEMENTED();
42 return false;
43 }
44 return true;
45 }
46
47 } // namespace device
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698