mirror of
https://github.com/PX4/PX4-Autopilot.git
synced 2026-06-07 09:13:32 +08:00
dsm Use the abstaction SPEKTRUM_POWER to enable the interface
Use the abstaction SPEKTRUM_POWER to enable the interface not the define for the GPIO pin. Use the clearer macro definitions
This commit is contained in:
+8
-8
@@ -235,9 +235,9 @@ dsm_guess_format(bool reset)
|
||||
int
|
||||
dsm_config(int fd)
|
||||
{
|
||||
#ifdef GPIO_SPEKTRUM_PWR_EN
|
||||
#ifdef SPEKTRUM_POWER
|
||||
// enable power on DSM connector
|
||||
POWER_SPEKTRUM(true);
|
||||
SPEKTRUM_POWER(true);
|
||||
#endif
|
||||
|
||||
int ret = -1;
|
||||
@@ -315,7 +315,7 @@ dsm_deinit()
|
||||
dsm_fd = -1;
|
||||
}
|
||||
|
||||
#ifdef GPIO_SPEKTRUM_PWR_EN
|
||||
#if defined(SPEKTRUM_POWER)
|
||||
/**
|
||||
* Handle DSM satellite receiver bind mode handler
|
||||
*
|
||||
@@ -334,20 +334,20 @@ dsm_bind(uint16_t cmd, int pulses)
|
||||
case DSM_CMD_BIND_POWER_DOWN:
|
||||
|
||||
/*power down DSM satellite*/
|
||||
POWER_SPEKTRUM(0);
|
||||
SPEKTRUM_POWER(false);
|
||||
break;
|
||||
|
||||
case DSM_CMD_BIND_POWER_UP:
|
||||
|
||||
/*power up DSM satellite*/
|
||||
POWER_SPEKTRUM(1);
|
||||
SPEKTRUM_POWER(true);
|
||||
dsm_guess_format(true);
|
||||
break;
|
||||
|
||||
case DSM_CMD_BIND_SET_RX_OUT:
|
||||
|
||||
/*Set UART RX pin to active output mode*/
|
||||
SPEKTRUM_RX_AS_GPIO();
|
||||
SPEKTRUM_RX_AS_GPIO_OUTPUT();
|
||||
break;
|
||||
|
||||
case DSM_CMD_BIND_SEND_PULSES:
|
||||
@@ -355,9 +355,9 @@ dsm_bind(uint16_t cmd, int pulses)
|
||||
/*Pulse RX pin a number of times*/
|
||||
for (int i = 0; i < pulses; i++) {
|
||||
dsm_udelay(120);
|
||||
SPEKTRUM_RX_HIGH(false);
|
||||
SPEKTRUM_OUT(false);
|
||||
dsm_udelay(120);
|
||||
SPEKTRUM_RX_HIGH(true);
|
||||
SPEKTRUM_OUT(true);
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
+1
-1
@@ -63,7 +63,7 @@ __EXPORT bool dsm_input(int dsm_fd, uint16_t *values, uint16_t *num_values, bool
|
||||
__EXPORT bool dsm_parse(const uint64_t now, const uint8_t *frame, const unsigned len, uint16_t *values,
|
||||
uint16_t *num_values, bool *dsm_11_bit, unsigned *frame_drops, uint16_t max_channels);
|
||||
|
||||
#ifdef GPIO_SPEKTRUM_PWR_EN
|
||||
#ifdef SPEKTRUM_POWER
|
||||
__EXPORT void dsm_bind(uint16_t cmd, int pulses);
|
||||
#endif
|
||||
|
||||
|
||||
Reference in New Issue
Block a user