mirror of
https://bitbucket.org/librepilot/librepilot.git
synced 2025-02-05 21:52:10 +01:00
PIOS_LED: Initialise all LED's as off.
PIOS_SYS: Added system reset function. OpenPilot Makefile: Default USE_BOOTLOADER should be NO. OpenPilot Bootloader: Removed LED initialisation. git-svn-id: svn://svn.openpilot.org/OpenPilot/trunk@303 ebee16cc-31ac-478f-84a7-5cbb03baadba
This commit is contained in:
parent
8ba2d76cd6
commit
7b5d85cb3e
@ -40,10 +40,6 @@ int main()
|
|||||||
/* Brings up System using CMSIS functions, enables the LEDs. */
|
/* Brings up System using CMSIS functions, enables the LEDs. */
|
||||||
PIOS_SYS_Init();
|
PIOS_SYS_Init();
|
||||||
|
|
||||||
/* Initialise LED's */
|
|
||||||
PIOS_LED_Off(LED1);
|
|
||||||
PIOS_LED_Off(LED2);
|
|
||||||
|
|
||||||
/* Only go into bootloader when the USB cable is connected */
|
/* Only go into bootloader when the USB cable is connected */
|
||||||
if(PIOS_USB_CableConnected()) {
|
if(PIOS_USB_CableConnected()) {
|
||||||
/* Delay system */
|
/* Delay system */
|
||||||
|
@ -27,7 +27,7 @@
|
|||||||
# Set to YES for debugging
|
# Set to YES for debugging
|
||||||
DEBUG = YES
|
DEBUG = YES
|
||||||
ENABLE_DEBUG_PINS = NO
|
ENABLE_DEBUG_PINS = NO
|
||||||
USE_BOOTLOADER = YES
|
USE_BOOTLOADER = NO
|
||||||
|
|
||||||
# Set to YES when using Code Sourcery toolchain
|
# Set to YES when using Code Sourcery toolchain
|
||||||
CODE_SOURCERY = YES
|
CODE_SOURCERY = YES
|
||||||
|
@ -53,6 +53,9 @@ void PIOS_LED_Init(void)
|
|||||||
RCC_APB2PeriphClockCmd(LED_GPIO_CLK[LEDNum], ENABLE);
|
RCC_APB2PeriphClockCmd(LED_GPIO_CLK[LEDNum], ENABLE);
|
||||||
GPIO_InitStructure.GPIO_Pin = LED_GPIO_PIN[LEDNum];
|
GPIO_InitStructure.GPIO_Pin = LED_GPIO_PIN[LEDNum];
|
||||||
GPIO_Init(LED_GPIO_PORT[LEDNum], &GPIO_InitStructure);
|
GPIO_Init(LED_GPIO_PORT[LEDNum], &GPIO_InitStructure);
|
||||||
|
|
||||||
|
/* LED's Off */
|
||||||
|
LED_GPIO_PORT[LEDNum]->BSRR = LED_GPIO_PIN[LEDNum];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -79,6 +79,45 @@ void PIOS_SYS_Init(void)
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Shutdown PIOS and reset the microcontroller:<BR>
|
||||||
|
* <UL>
|
||||||
|
* <LI>Disable all RTOS tasks
|
||||||
|
* <LI>Disable all interrupts
|
||||||
|
* <LI>Turn off all board LEDs
|
||||||
|
* <LI>Reset STM32
|
||||||
|
* </UL>
|
||||||
|
* \return < 0 if reset failed
|
||||||
|
*/
|
||||||
|
int32_t PIOS_SYS_Reset(void)
|
||||||
|
{
|
||||||
|
/* Disable all RTOS tasks */
|
||||||
|
#if defined(PIOS_INCLUDE_FREERTOS)
|
||||||
|
/* port specific FreeRTOS function to disable tasks (nested) */
|
||||||
|
portENTER_CRITICAL();
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// disable all interrupts
|
||||||
|
PIOS_IRQ_Disable();
|
||||||
|
|
||||||
|
// turn off all board LEDs
|
||||||
|
PIOS_LED_Off(LED1);
|
||||||
|
PIOS_LED_Off(LED2);
|
||||||
|
|
||||||
|
/* Reset STM32 */
|
||||||
|
//RCC_APB2PeriphResetCmd(0xfffffff8, ENABLE); /* MBHP_CORE_STM32: don't reset GPIOA/AF due to USB pins */
|
||||||
|
//RCC_APB1PeriphResetCmd(0xff7fffff, ENABLE); /* don't reset USB, so that the connection can survive! */
|
||||||
|
|
||||||
|
RCC_APB2PeriphResetCmd(0xffffffff, DISABLE);
|
||||||
|
RCC_APB1PeriphResetCmd(0xffffffff, DISABLE);
|
||||||
|
SCB->AIRCR = NVIC_AIRCR_VECTKEY | (1 << NVIC_VECTRESET);
|
||||||
|
|
||||||
|
while(1);
|
||||||
|
|
||||||
|
/* We will never reach this point */
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the serial number as a string
|
* Returns the serial number as a string
|
||||||
* param[out] str pointer to a string which can store at least 32 digits + zero terminator!
|
* param[out] str pointer to a string which can store at least 32 digits + zero terminator!
|
||||||
|
@ -29,6 +29,7 @@
|
|||||||
|
|
||||||
/* Public Functions */
|
/* Public Functions */
|
||||||
extern void PIOS_SYS_Init(void);
|
extern void PIOS_SYS_Init(void);
|
||||||
|
extern int32_t PIOS_SYS_Reset(void);
|
||||||
extern int32_t PIOS_SYS_SerialNumberGet(char *str);
|
extern int32_t PIOS_SYS_SerialNumberGet(char *str);
|
||||||
|
|
||||||
#endif /* PIOS_SYS_H */
|
#endif /* PIOS_SYS_H */
|
||||||
|
Loading…
x
Reference in New Issue
Block a user