Fork of serial_connected_mcu by
serial_connected_mcu.hpp@5:4f51af2919d5, 2016-07-10 (annotated)
- Committer:
- kachikyun
- Date:
- Sun Jul 10 07:24:41 2016 +0000
- Revision:
- 5:4f51af2919d5
- Parent:
- 4:1323ef48a984
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
inst | 0:9ca9a6eddffa | 1 | #ifndef INCUDED_SERIAL_CONNECTED_MCU_HPP |
inst | 0:9ca9a6eddffa | 2 | #define INCUDED_SERIAL_CONNECTED_MCU_HPP |
inst | 0:9ca9a6eddffa | 3 | |
inst | 0:9ca9a6eddffa | 4 | #include "rotary_encoder_ab_phase.hpp" |
inst | 0:9ca9a6eddffa | 5 | #include "servo.hpp" |
inst | 4:1323ef48a984 | 6 | #include "serial_connected_mcu_slave.hpp" |
inst | 0:9ca9a6eddffa | 7 | #include "mbed.h" |
inst | 0:9ca9a6eddffa | 8 | |
inst | 0:9ca9a6eddffa | 9 | namespace serial_connected_mcu { |
inst | 0:9ca9a6eddffa | 10 | |
inst | 0:9ca9a6eddffa | 11 | class serial_connected_mcu { |
inst | 0:9ca9a6eddffa | 12 | public: |
inst | 0:9ca9a6eddffa | 13 | enum servo_id { |
inst | 0:9ca9a6eddffa | 14 | SERVO_0, |
inst | 0:9ca9a6eddffa | 15 | SERVO_1, |
inst | 0:9ca9a6eddffa | 16 | SERVO_2, |
inst | 0:9ca9a6eddffa | 17 | SERVO_NUM |
inst | 0:9ca9a6eddffa | 18 | }; |
inst | 0:9ca9a6eddffa | 19 | |
inst | 0:9ca9a6eddffa | 20 | enum encoder_id { |
inst | 0:9ca9a6eddffa | 21 | ENCODER_0, |
inst | 0:9ca9a6eddffa | 22 | ENCODER_1, |
inst | 0:9ca9a6eddffa | 23 | ENCODER_2, |
inst | 0:9ca9a6eddffa | 24 | ENCODER_NUM |
inst | 0:9ca9a6eddffa | 25 | }; |
inst | 0:9ca9a6eddffa | 26 | |
inst | 0:9ca9a6eddffa | 27 | enum analog_input_id { |
inst | 0:9ca9a6eddffa | 28 | ANALOG_IN_0, |
inst | 0:9ca9a6eddffa | 29 | ANALOG_IN_1, |
inst | 0:9ca9a6eddffa | 30 | ANALOG_IN_2, |
inst | 0:9ca9a6eddffa | 31 | ANALOG_INPUT_NUM |
inst | 0:9ca9a6eddffa | 32 | }; |
inst | 0:9ca9a6eddffa | 33 | |
inst | 0:9ca9a6eddffa | 34 | static serial_connected_mcu* instance(); |
inst | 0:9ca9a6eddffa | 35 | void update(); |
inst | 0:9ca9a6eddffa | 36 | |
inst | 0:9ca9a6eddffa | 37 | private: |
inst | 0:9ca9a6eddffa | 38 | serial_connected_mcu(); |
inst | 2:9d7a03c79cd3 | 39 | ~serial_connected_mcu(); |
inst | 0:9ca9a6eddffa | 40 | |
inst | 0:9ca9a6eddffa | 41 | // 実体を記述しない |
inst | 0:9ca9a6eddffa | 42 | void operator=(const serial_connected_mcu&); |
inst | 0:9ca9a6eddffa | 43 | serial_connected_mcu(const serial_connected_mcu&); |
inst | 0:9ca9a6eddffa | 44 | |
inst | 0:9ca9a6eddffa | 45 | static serial_connected_mcu* _instance; |
inst | 0:9ca9a6eddffa | 46 | |
inst | 0:9ca9a6eddffa | 47 | static const PinName _servo_pins[SERVO_NUM]; |
inst | 0:9ca9a6eddffa | 48 | |
inst | 0:9ca9a6eddffa | 49 | static TIM_TypeDef* _encoder_timers[ENCODER_NUM]; |
inst | 0:9ca9a6eddffa | 50 | static const size_t _encoder_pulse_per_revol; |
inst | 0:9ca9a6eddffa | 51 | |
inst | 0:9ca9a6eddffa | 52 | static const PinName _analog_input_pins[ANALOG_INPUT_NUM]; |
inst | 0:9ca9a6eddffa | 53 | |
inst | 0:9ca9a6eddffa | 54 | servo* _servos[SERVO_NUM]; |
inst | 0:9ca9a6eddffa | 55 | rotary_encoder_ab_phase* _encoders[ENCODER_NUM]; |
inst | 0:9ca9a6eddffa | 56 | AnalogIn* _analog_inputs[ANALOG_INPUT_NUM]; |
inst | 4:1323ef48a984 | 57 | |
inst | 4:1323ef48a984 | 58 | serial_connected_mcu_slave _slave; |
inst | 0:9ca9a6eddffa | 59 | }; |
inst | 0:9ca9a6eddffa | 60 | |
inst | 0:9ca9a6eddffa | 61 | } /* namespace serial_connected_mcu */ |
inst | 0:9ca9a6eddffa | 62 | |
inst | 0:9ca9a6eddffa | 63 | #endif |