nucleo側のプログラム
Dependents: serial_connected_mcu_nucleo serial_connected_mcu_nucleo
Fork of serial_connected_mcu by
serial_connected_mcu.hpp@0:9ca9a6eddffa, 2016-07-10 (annotated)
- Committer:
- inst
- Date:
- Sun Jul 10 05:31:54 2016 +0000
- Revision:
- 0:9ca9a6eddffa
- Child:
- 2:9d7a03c79cd3
????;
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 | 0:9ca9a6eddffa | 6 | #include "mbed.h" |
inst | 0:9ca9a6eddffa | 7 | |
inst | 0:9ca9a6eddffa | 8 | namespace serial_connected_mcu { |
inst | 0:9ca9a6eddffa | 9 | |
inst | 0:9ca9a6eddffa | 10 | class serial_connected_mcu { |
inst | 0:9ca9a6eddffa | 11 | public: |
inst | 0:9ca9a6eddffa | 12 | enum servo_id { |
inst | 0:9ca9a6eddffa | 13 | SERVO_0, |
inst | 0:9ca9a6eddffa | 14 | SERVO_1, |
inst | 0:9ca9a6eddffa | 15 | SERVO_2, |
inst | 0:9ca9a6eddffa | 16 | SERVO_NUM |
inst | 0:9ca9a6eddffa | 17 | }; |
inst | 0:9ca9a6eddffa | 18 | |
inst | 0:9ca9a6eddffa | 19 | enum encoder_id { |
inst | 0:9ca9a6eddffa | 20 | ENCODER_0, |
inst | 0:9ca9a6eddffa | 21 | ENCODER_1, |
inst | 0:9ca9a6eddffa | 22 | ENCODER_2, |
inst | 0:9ca9a6eddffa | 23 | ENCODER_NUM |
inst | 0:9ca9a6eddffa | 24 | }; |
inst | 0:9ca9a6eddffa | 25 | |
inst | 0:9ca9a6eddffa | 26 | enum analog_input_id { |
inst | 0:9ca9a6eddffa | 27 | ANALOG_IN_0, |
inst | 0:9ca9a6eddffa | 28 | ANALOG_IN_1, |
inst | 0:9ca9a6eddffa | 29 | ANALOG_IN_2, |
inst | 0:9ca9a6eddffa | 30 | ANALOG_INPUT_NUM |
inst | 0:9ca9a6eddffa | 31 | }; |
inst | 0:9ca9a6eddffa | 32 | |
inst | 0:9ca9a6eddffa | 33 | static serial_connected_mcu* instance(); |
inst | 0:9ca9a6eddffa | 34 | void update(); |
inst | 0:9ca9a6eddffa | 35 | |
inst | 0:9ca9a6eddffa | 36 | private: |
inst | 0:9ca9a6eddffa | 37 | serial_connected_mcu(); |
inst | 0:9ca9a6eddffa | 38 | |
inst | 0:9ca9a6eddffa | 39 | // 実体を記述しない |
inst | 0:9ca9a6eddffa | 40 | ~serial_connected_mcu(); |
inst | 0:9ca9a6eddffa | 41 | void operator=(const serial_connected_mcu&); |
inst | 0:9ca9a6eddffa | 42 | serial_connected_mcu(const serial_connected_mcu&); |
inst | 0:9ca9a6eddffa | 43 | |
inst | 0:9ca9a6eddffa | 44 | static serial_connected_mcu* _instance; |
inst | 0:9ca9a6eddffa | 45 | |
inst | 0:9ca9a6eddffa | 46 | static const PinName _servo_pins[SERVO_NUM]; |
inst | 0:9ca9a6eddffa | 47 | |
inst | 0:9ca9a6eddffa | 48 | static TIM_TypeDef* _encoder_timers[ENCODER_NUM]; |
inst | 0:9ca9a6eddffa | 49 | static const size_t _encoder_pulse_per_revol; |
inst | 0:9ca9a6eddffa | 50 | |
inst | 0:9ca9a6eddffa | 51 | static const PinName _analog_input_pins[ANALOG_INPUT_NUM]; |
inst | 0:9ca9a6eddffa | 52 | |
inst | 0:9ca9a6eddffa | 53 | servo* _servos[SERVO_NUM]; |
inst | 0:9ca9a6eddffa | 54 | rotary_encoder_ab_phase* _encoders[ENCODER_NUM]; |
inst | 0:9ca9a6eddffa | 55 | AnalogIn* _analog_inputs[ANALOG_INPUT_NUM]; |
inst | 0:9ca9a6eddffa | 56 | }; |
inst | 0:9ca9a6eddffa | 57 | |
inst | 0:9ca9a6eddffa | 58 | } /* namespace serial_connected_mcu */ |
inst | 0:9ca9a6eddffa | 59 | |
inst | 0:9ca9a6eddffa | 60 | #endif |