1
0
mirror of https://bitbucket.org/librepilot/librepilot.git synced 2025-01-29 14:52:12 +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:
gussy 2010-03-14 06:47:57 +00:00 committed by gussy
parent 8ba2d76cd6
commit 7b5d85cb3e
5 changed files with 44 additions and 5 deletions

View File

@ -40,10 +40,6 @@ int main()
/* Brings up System using CMSIS functions, enables the LEDs. */
PIOS_SYS_Init();
/* Initialise LED's */
PIOS_LED_Off(LED1);
PIOS_LED_Off(LED2);
/* Only go into bootloader when the USB cable is connected */
if(PIOS_USB_CableConnected()) {
/* Delay system */

View File

@ -27,7 +27,7 @@
# Set to YES for debugging
DEBUG = YES
ENABLE_DEBUG_PINS = NO
USE_BOOTLOADER = YES
USE_BOOTLOADER = NO
# Set to YES when using Code Sourcery toolchain
CODE_SOURCERY = YES

View File

@ -53,6 +53,9 @@ void PIOS_LED_Init(void)
RCC_APB2PeriphClockCmd(LED_GPIO_CLK[LEDNum], ENABLE);
GPIO_InitStructure.GPIO_Pin = LED_GPIO_PIN[LEDNum];
GPIO_Init(LED_GPIO_PORT[LEDNum], &GPIO_InitStructure);
/* LED's Off */
LED_GPIO_PORT[LEDNum]->BSRR = LED_GPIO_PIN[LEDNum];
}
}

View File

@ -79,6 +79,45 @@ void PIOS_SYS_Init(void)
#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
* param[out] str pointer to a string which can store at least 32 digits + zero terminator!

View File

@ -29,6 +29,7 @@
/* Public Functions */
extern void PIOS_SYS_Init(void);
extern int32_t PIOS_SYS_Reset(void);
extern int32_t PIOS_SYS_SerialNumberGet(char *str);
#endif /* PIOS_SYS_H */