mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-31 04:51:35 +08:00
More GPIO and general pin assignment fixes.
This commit is contained in:
@@ -80,9 +80,12 @@
|
|||||||
# define GPIO_SERVO_5 (1<<4) /**< servo 5 output */
|
# define GPIO_SERVO_5 (1<<4) /**< servo 5 output */
|
||||||
# define GPIO_SERVO_6 (1<<5) /**< servo 6 output */
|
# define GPIO_SERVO_6 (1<<5) /**< servo 6 output */
|
||||||
|
|
||||||
# define GPIO_5V_PERIPH_EN (1<<6) /**< PA8 - VDD_5V_PERIPH_EN */
|
# define GPIO_5V_PERIPH_EN (1<<6) /**< PA8 - !VDD_5V_PERIPH_EN */
|
||||||
# define GPIO_5V_HIPOWER_OC (1<<7) /**< PE10 - !VDD_5V_HIPOWER_OC */
|
# define GPIO_3V3_SENSORS_EN (1<<7) /**< PE3 - VDD_3V3_SENSORS_EN */
|
||||||
# define GPIO_5V_PERIPH_OC (1<<8) /**< PE15 - !VDD_5V_PERIPH_OC */
|
# define GPIO_BRICK_VALID (1<<8) /**< PB5 - !VDD_BRICK_VALID */
|
||||||
|
# define GPIO_SERVO_VALID (1<<9) /**< PB7 - !VDD_SERVO_VALID */
|
||||||
|
# define GPIO_5V_HIPOWER_OC (1<<10) /**< PE10 - !VDD_5V_HIPOWER_OC */
|
||||||
|
# define GPIO_5V_PERIPH_OC (1<<11) /**< PE10 - !VDD_5V_PERIPH_OC */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Default GPIO device - other devices may also support this protocol if
|
* Default GPIO device - other devices may also support this protocol if
|
||||||
|
|||||||
@@ -169,15 +169,19 @@ const PX4FMU::GPIOConfig PX4FMU::_gpio_tab[] = {
|
|||||||
{GPIO_GPIO7_INPUT, GPIO_GPIO7_OUTPUT, GPIO_CAN2_RX_2},
|
{GPIO_GPIO7_INPUT, GPIO_GPIO7_OUTPUT, GPIO_CAN2_RX_2},
|
||||||
#endif
|
#endif
|
||||||
#if defined(CONFIG_ARCH_BOARD_PX4FMU_V2)
|
#if defined(CONFIG_ARCH_BOARD_PX4FMU_V2)
|
||||||
{GPIO_GPIO0_INPUT, GPIO_GPIO0_OUTPUT, 0},
|
{GPIO_GPIO0_INPUT, GPIO_GPIO0_OUTPUT, 0},
|
||||||
{GPIO_GPIO1_INPUT, GPIO_GPIO1_OUTPUT, 0},
|
{GPIO_GPIO1_INPUT, GPIO_GPIO1_OUTPUT, 0},
|
||||||
{GPIO_GPIO2_INPUT, GPIO_GPIO2_OUTPUT, 0},
|
{GPIO_GPIO2_INPUT, GPIO_GPIO2_OUTPUT, 0},
|
||||||
{GPIO_GPIO3_INPUT, GPIO_GPIO3_OUTPUT, 0},
|
{GPIO_GPIO3_INPUT, GPIO_GPIO3_OUTPUT, 0},
|
||||||
{GPIO_GPIO4_INPUT, GPIO_GPIO4_OUTPUT, 0},
|
{GPIO_GPIO4_INPUT, GPIO_GPIO4_OUTPUT, 0},
|
||||||
{GPIO_GPIO5_INPUT, GPIO_GPIO5_OUTPUT, 0},
|
{GPIO_GPIO5_INPUT, GPIO_GPIO5_OUTPUT, 0},
|
||||||
{0, GPIO_VDD_5V_PERIPH_EN, 0},
|
|
||||||
{GPIO_5V_HIPOWER_OC, 0, 0},
|
{0, GPIO_VDD_5V_PERIPH_EN, 0},
|
||||||
{GPIO_5V_PERIPH_OC, 0, 0},
|
{0, GPIO_VDD_3V3_SENSORS_EN, 0},
|
||||||
|
{GPIO_VDD_BRICK_VALID, 0, 0},
|
||||||
|
{GPIO_VDD_SERVO_VALID, 0, 0},
|
||||||
|
{GPIO_VDD_5V_HIPOWER_OC, 0, 0},
|
||||||
|
{GPIO_VDD_5V_PERIPH_OC, 0, 0},
|
||||||
#endif
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -227,7 +227,6 @@ ADC::init()
|
|||||||
if ((hrt_absolute_time() - now) > 500) {
|
if ((hrt_absolute_time() - now) > 500) {
|
||||||
log("sample timeout");
|
log("sample timeout");
|
||||||
return -1;
|
return -1;
|
||||||
return 0xffff;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -282,7 +281,7 @@ ADC::close_last(struct file *filp)
|
|||||||
void
|
void
|
||||||
ADC::_tick_trampoline(void *arg)
|
ADC::_tick_trampoline(void *arg)
|
||||||
{
|
{
|
||||||
((ADC *)arg)->_tick();
|
(reinterpret_cast<ADC *>(arg))->_tick();
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@@ -366,8 +365,15 @@ int
|
|||||||
adc_main(int argc, char *argv[])
|
adc_main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
if (g_adc == nullptr) {
|
if (g_adc == nullptr) {
|
||||||
/* XXX this hardcodes the default channel set for PX4FMU - should be configurable */
|
#ifdef CONFIG_ARCH_BOARD_PX4FMU_V1
|
||||||
|
/* XXX this hardcodes the default channel set for PX4FMUv1 - should be configurable */
|
||||||
g_adc = new ADC((1 << 10) | (1 << 11) | (1 << 12) | (1 << 13));
|
g_adc = new ADC((1 << 10) | (1 << 11) | (1 << 12) | (1 << 13));
|
||||||
|
#endif
|
||||||
|
#ifdef CONFIG_ARCH_BOARD_PX4FMU_V2
|
||||||
|
/* XXX this hardcodes the default channel set for PX4FMUv2 - should be configurable */
|
||||||
|
g_adc = new ADC((1 << 2) | (1 << 3) | (1 << 4) |
|
||||||
|
(1 << 10) | (1 << 11) | (1 << 12) | (1 << 13) | (1 << 14) | (1 << 15));
|
||||||
|
#endif
|
||||||
|
|
||||||
if (g_adc == nullptr)
|
if (g_adc == nullptr)
|
||||||
errx(1, "couldn't allocate the ADC driver");
|
errx(1, "couldn't allocate the ADC driver");
|
||||||
|
|||||||
Reference in New Issue
Block a user