EV3RT C++ API Reference  Version 1.0
An RTOS-based development platform for LEGO Mindstorms EV3.
Sensor.h
1 //
2 // Sensor.h
3 //
4 // Copyright (c) 2015-2016 Embedded Technology Software Design Robot Contest
5 //
6 
7 #ifndef EV3CPPAPI_SENSOR_H_
8 #define EV3CPPAPI_SENSOR_H_
9 
10 #include "Port.h"
11 
12 #include "ev3api.h"
13 
14 namespace ev3api {
18 class Sensor
19 {
20 protected:
26  inline sensor_port_t getPort(void) const { return mPort; }
27 
34  explicit Sensor(ePortS port, sensor_type_t type)
35  :mPort(static_cast<sensor_port_t>(port)), mType(type)
36  {
37  ev3_sensor_config(getPort(), type);
38  }
39 
45  virtual ~Sensor(void) { }
46 
47 private:
48  sensor_port_t mPort;
49  sensor_type_t mType;
50 }; // class Sensor
51 } // namespace ev3api
52 
53 #endif // ! EV3CPPAPI_SENSOR_H_
Definition: Clock.h:12
モータ/センサポート関連定義
sensor_port_t getPort(void) const
Definition: Sensor.h:26
ePortS
Definition: Port.h:18
Definition: Sensor.h:18
virtual ~Sensor(void)
Definition: Sensor.h:45
Sensor(ePortS port, sensor_type_t type)
Definition: Sensor.h:34