blob: cc33c4abc4c0f9e881d12195644d306ec4f5f115 [file] [log] [blame]
Enrico Granata60b1cbc2019-05-20 11:06:46 -07001// Copyright 2019 The Chromium OS 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#ifndef MEMS_SETUP_CONFIGURATION_H_
6#define MEMS_SETUP_CONFIGURATION_H_
7
8#include <memory>
9#include <string>
10
11#include <base/macros.h>
12
Enrico Granata51cdb942019-06-18 16:40:17 -070013#include <libmems/iio_device.h>
Enrico Granata60b1cbc2019-05-20 11:06:46 -070014#include "mems_setup/delegate.h"
Enrico Granata60b1cbc2019-05-20 11:06:46 -070015#include "mems_setup/sensor_kind.h"
16
17namespace mems_setup {
18
19class Configuration {
20 public:
Enrico Granata51cdb942019-06-18 16:40:17 -070021 Configuration(libmems::IioDevice* sensor,
22 SensorKind kind,
23 Delegate* delegate);
Enrico Granata60b1cbc2019-05-20 11:06:46 -070024
25 bool Configure();
26
27 private:
28 bool ConfigGyro();
Enrico Granata7a622342019-05-21 11:10:59 -070029 bool ConfigAccelerometer();
Enrico Granata651d2572019-07-16 15:17:01 -070030 bool ConfigIlluminance();
Enrico Granata60b1cbc2019-05-20 11:06:46 -070031
Enrico Granata651d2572019-07-16 15:17:01 -070032 bool CopyImuCalibationFromVpd(int max_value);
33 bool CopyImuCalibationFromVpd(int max_value, const std::string& location);
34
35 bool CopyLightCalibrationFromVpd();
Enrico Granata60b1cbc2019-05-20 11:06:46 -070036
Enrico Granata10e19de2019-05-21 14:17:36 -070037 bool AddSysfsTrigger(int trigger_id);
38
Enrico Granata064a25c2019-07-15 15:48:03 -070039 bool EnableAccelScanElements();
40
41 bool EnableBuffer();
42
Enrico Granatafc2e3472019-07-16 11:23:25 -070043 bool EnableKeyboardAngle();
44
Enrico Granata60b1cbc2019-05-20 11:06:46 -070045 Delegate* delegate_; // non-owned
46 SensorKind kind_;
Enrico Granata51cdb942019-06-18 16:40:17 -070047 libmems::IioDevice* sensor_; // non-owned
Enrico Granata60b1cbc2019-05-20 11:06:46 -070048
49 DISALLOW_COPY_AND_ASSIGN(Configuration);
50};
51
52} // namespace mems_setup
53
54#endif // MEMS_SETUP_CONFIGURATION_H_