mirror of
https://github.com/PX4/PX4-Autopilot.git
synced 2026-05-31 18:47:21 +08:00
auav-x21:Add On board reset
This commit is contained in:
committed by
Daniel Agar
parent
866721cb33
commit
d6987ac674
@@ -247,6 +247,10 @@
|
||||
/* This board provides a DMA pool and APIs */
|
||||
#define BOARD_DMA_ALLOC_POOL_SIZE 5120
|
||||
|
||||
/* This board provides the board_on_reset interface */
|
||||
|
||||
#define BOARD_HAS_ON_RESET 1
|
||||
|
||||
#define BOARD_HAS_STATIC_MANIFEST 1
|
||||
|
||||
__BEGIN_DECLS
|
||||
|
||||
@@ -121,6 +121,37 @@ __END_DECLS
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
/************************************************************************************
|
||||
* Name: board_on_reset
|
||||
*
|
||||
* Description:
|
||||
* Optionally provided function called on entry to board_system_reset
|
||||
* It should perform any house keeping prior to the rest.
|
||||
*
|
||||
* status - 1 if resetting to boot loader
|
||||
* 0 if just resetting
|
||||
*
|
||||
************************************************************************************/
|
||||
__EXPORT void board_on_reset(int status)
|
||||
{
|
||||
// Configure the GPIO pins to outputs and keep them low.
|
||||
stm32_configgpio(GPIO_GPIO0_OUTPUT);
|
||||
stm32_configgpio(GPIO_GPIO1_OUTPUT);
|
||||
stm32_configgpio(GPIO_GPIO2_OUTPUT);
|
||||
stm32_configgpio(GPIO_GPIO3_OUTPUT);
|
||||
stm32_configgpio(GPIO_GPIO4_OUTPUT);
|
||||
stm32_configgpio(GPIO_GPIO5_OUTPUT);
|
||||
|
||||
/**
|
||||
* On resets invoked from system (not boot) insure we establish a low
|
||||
* output state (discharge the pins) on PWM pins before they become inputs.
|
||||
*/
|
||||
|
||||
if (status >= 0) {
|
||||
up_mdelay(400);
|
||||
}
|
||||
}
|
||||
|
||||
/************************************************************************************
|
||||
* Name: board_peripheral_reset
|
||||
*
|
||||
@@ -156,6 +187,10 @@ __EXPORT void board_peripheral_reset(int ms)
|
||||
__EXPORT void
|
||||
stm32_boardinitialize(void)
|
||||
{
|
||||
// Reset all PWM to Low outputs.
|
||||
|
||||
board_on_reset(-1);
|
||||
|
||||
/* configure LEDs */
|
||||
|
||||
board_autoled_initialize();
|
||||
@@ -175,14 +210,6 @@ stm32_boardinitialize(void)
|
||||
px4_arch_configgpio(GPIO_VDD_BRICK_VALID);
|
||||
px4_arch_configgpio(GPIO_VDD_5V_PERIPH_OC);
|
||||
|
||||
/* configure the GPIO pins to outputs and keep them low */
|
||||
px4_arch_configgpio(GPIO_GPIO0_OUTPUT);
|
||||
px4_arch_configgpio(GPIO_GPIO1_OUTPUT);
|
||||
px4_arch_configgpio(GPIO_GPIO2_OUTPUT);
|
||||
px4_arch_configgpio(GPIO_GPIO3_OUTPUT);
|
||||
px4_arch_configgpio(GPIO_GPIO4_OUTPUT);
|
||||
px4_arch_configgpio(GPIO_GPIO5_OUTPUT);
|
||||
|
||||
/* configure SPI interfaces */
|
||||
|
||||
stm32_spiinitialize();
|
||||
|
||||
Reference in New Issue
Block a user