trikRuntime
pwmCapture.h
Go to the documentation of this file.
1 /* Copyright 2013 - 2015 Roman Kurbatov, Yurii Litvinov and CyberTech Labs Ltd.
2  *
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at
6  *
7  * http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License. */
14 
15 #pragma once
16 
17 #include <QtCore/QScopedPointer>
18 
19 #include "pwmCaptureInterface.h"
20 #include "deviceState.h"
21 
22 namespace trikKernel {
23 class Configurer;
24 }
25 
26 namespace trikHal {
27 class HardwareAbstractionInterface;
28 class InputDeviceFileInterface;
29 }
30 
31 namespace trikControl {
32 
35 {
36  Q_OBJECT
37 
38 public:
42  PwmCapture(const QString &port, const trikKernel::Configurer &configurer
43  , const trikHal::HardwareAbstractionInterface &hardwareAbstraction);
44 
45  ~PwmCapture() override;
46 
47  Status status() const override;
48 
49 public slots:
51  QVector<int> frequency() override;
52 
54  int duty() override;
55 
56 private:
57  QScopedPointer<trikHal::InputDeviceFileInterface> mFrequencyFile;
58  QScopedPointer<trikHal::InputDeviceFileInterface> mDutyFile;
59  DeviceState mState;
60 };
61 
62 }
Definition: analogSensor.h:23
Generic configuration helper, parses configuration XML files and presents configuration as a set of a...
Definition: configurer.h:28
static const int port
Definition: trikCommunicatorTest.cpp:24
Helper class to track device state (off, starting, ready, stopping, fail).
Definition: deviceState.h:26
Provides characteristics of PWM signal supplied to the port.
Definition: pwmCaptureInterface.h:27
Status
Device status.
Definition: deviceInterface.h:33
Definition: trikCommunicator.h:27
Definition: brickFactory.h:21
Implementation of PWM capture for real robot.
Definition: pwmCapture.h:34
Hardware abstraction, provides devices that are used to communicate with robot hardware or emulate it...
Definition: hardwareAbstractionInterface.h:29