WIP: dsm bind default to DSMX 11 ms

This commit is contained in:
Daniel Agar 2020-12-24 15:30:05 -05:00
parent 92afe45f7f
commit 0608a7fcc4
2 changed files with 24 additions and 8 deletions

View File

@ -384,17 +384,22 @@ void dsm_bind(uint16_t cmd, int pulses)
SPEKTRUM_RX_AS_GPIO_OUTPUT();
break;
case DSM_CMD_BIND_SEND_PULSES:
// Pulse RX pin a number of times
case DSM_CMD_BIND_SEND_PULSES: {
// Pulse RX pin a number of times
#if defined(DSM_DEBUG)
printf("DSM: DSM_CMD_BIND_SEND_PULSES\n");
printf("DSM: DSM_CMD_BIND_SEND_PULSES\n");
#endif
for (int i = 0; i < pulses; i++) {
dsm_udelay(120);
SPEKTRUM_OUT(false);
dsm_udelay(120);
SPEKTRUM_OUT(true);
auto flags = px4_enter_critical_section();
for (int i = 0; i < DSM_BIND_PULSE::INTERNAL_DSMX_11MS; i++) {
dsm_udelay(120);
SPEKTRUM_OUT(false);
dsm_udelay(120);
SPEKTRUM_OUT(true);
}
px4_leave_critical_section(flags);
}
break;

View File

@ -63,6 +63,17 @@ typedef struct dsm_decode_t {
dsm_buf_t buf;
} dsm_decode_t;
enum DSM_BIND_PULSE {
INTERNAL_DSM2_22MS = 3,
EXTERNAL_DSM2_22MS = 4,
INTERNAL_DSM2_11MS = 5,
EXTERNAL_DSM2_11MS = 6,
INTERNAL_DSMX_22MS = 7,
EXTERNAL_DSMX_22MS = 8,
INTERNAL_DSMX_11MS = 9,
EXTERNAL_DSMX_11MS = 10,
};
#pragma pack(pop)
__EXPORT int dsm_init(const char *device);