11 #define PWM_CAMERA_DISARMED 900 12 #define PWM_CAMERA_NEUTRAL 1500 13 #define PWM_1_CAMERA_ON 1100 14 #define PWM_1_CAMERA_AUTOFOCUS_SHOOT 1300 15 #define PWM_1_CAMERA_INSTANT_SHOOT 1700 16 #define PWM_1_CAMERA_OFF 1900 17 #define PWM_2_CAMERA_KEEP_ALIVE 1700 18 #define PWM_2_CAMERA_ON_OFF 1900 20 CameraInterfaceSeagull::CameraInterfaceSeagull():
28 CameraInterfaceSeagull::~CameraInterfaceSeagull()
34 void CameraInterfaceSeagull::setup()
36 for (
unsigned i = 0; i <
arraySize(_pins); i = i + 2) {
37 if (_pins[i] >= 0 && _pins[i + 1] >= 0) {
40 uint8_t pin_bitmask = (1 << _pins[i + 1]) | (1 << _pins[i]);
52 PX4_ERR(
"Bad pin configuration - Seagull MAP2 requires 2 consecutive pins for control.");
55 void CameraInterfaceSeagull::trigger(
bool trigger_on_true)
62 for (
unsigned i = 0; i <
arraySize(_pins); i = i + 2) {
63 if (_pins[i] >= 0 && _pins[i + 1] >= 0) {
65 up_pwm_trigger_set(_pins[i + 1], trigger_on_true ? PWM_1_CAMERA_INSTANT_SHOOT : PWM_CAMERA_NEUTRAL);
70 void CameraInterfaceSeagull::send_keep_alive(
bool enable)
78 for (
unsigned i = 0; i <
arraySize(_pins); i = i + 2) {
79 if (_pins[i] >= 0 && _pins[i + 1] >= 0) {
86 void CameraInterfaceSeagull::send_toggle_power(
bool enable)
91 for (
unsigned i = 0; i <
arraySize(_pins); i = i + 2) {
92 if (_pins[i] >= 0 && _pins[i + 1] >= 0) {
100 if (!enable) { _camera_is_on = !_camera_is_on; }
105 PX4_INFO(
"PWM trigger mode (Seagull MAP2) , pins enabled : [%d][%d][%d][%d][%d][%d]",
106 _pins[5], _pins[4], _pins[3], _pins[2], _pins[1], _pins[0]);
__EXPORT void up_pwm_trigger_deinit(void)
De-initialise the PWM trigger outputs.
int info()
Print a little info about the driver.
Interface supported cameras using a Seagull MAP2 interface.
__BEGIN_DECLS __EXPORT int up_pwm_trigger_init(uint32_t channel_mask)
Intialise the PWM servo outputs using the specified configuration.
__EXPORT int up_pwm_trigger_set(unsigned channel, uint16_t value)
Set the current output value for a channel.