diff --git a/flight/sys/pios.c b/flight/sys/pios.c index 4ccf51087..3ad952918 100644 --- a/flight/sys/pios.c +++ b/flight/sys/pios.c @@ -37,7 +37,7 @@ #include -/* FreeRTOS Tasks */ +/* FreeRTOS Prototypes */ void PiosMainTask( void *pvParameters ); void SensorTask( void *pvParameters ); diff --git a/flight/sys/pios_irq.c b/flight/sys/pios_irq.c index 0e14da013..b2fb68fbe 100644 --- a/flight/sys/pios_irq.c +++ b/flight/sys/pios_irq.c @@ -25,9 +25,19 @@ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + /* Project Includes */ #include "pios.h" + +/* Public Function Prototypes */ +int IRQDisable(void); +int IRQEnable(void); + + +/* Private Function Prototypes */ + + /* Local Variables */ /* The nesting counter ensures, that interrupts won't be enabled so long nested functions disable them */ static unsigned int nested_ctr; @@ -35,7 +45,14 @@ static unsigned int nested_ctr; /* Stored priority level before IRQ has been disabled (important for co-existence with vPortEnterCritical) */ static unsigned int prev_primask; -/* Disables all interrupts (nested) */ + +/******************************************************************************* +* Function Name : IRQDisable +* Description : Disables all interrupts (nested) +* Input : None +* Output : None +* Return : Zero on no error +*******************************************************************************/ int IRQDisable(void) { /* Get current priority if nested level == 0 */ @@ -59,7 +76,14 @@ int IRQDisable(void) return 0; } -/* Enables all interrupts (nested) */ + +/******************************************************************************* +* Function Name : IRQEnable +* Description : Enables all interrupts (nested) +* Input : None +* Output : None +* Return : Zero on no error, -1 on nesting error +*******************************************************************************/ int IRQEnable(void) { /* Check for nesting error */ @@ -81,4 +105,4 @@ int IRQEnable(void) /* No error */ return 0; -} \ No newline at end of file +} diff --git a/flight/sys/pios_led.c b/flight/sys/pios_led.c index e7125391e..22c4434a5 100644 --- a/flight/sys/pios_led.c +++ b/flight/sys/pios_led.c @@ -25,13 +25,34 @@ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + +/* Project Includes */ #include "pios.h" + +/* Public Function Prototypes */ +void LED_INIT(void); +void LED_ON(LedTypeDef LEDNum); +void LED_OFF(LedTypeDef LEDNum); +void LED_TOGGLE(LedTypeDef LEDNum); + + +/* Private Function Prototypes */ + + +/* Local Variables */ GPIO_TypeDef* LED_GPIO_PORT[NUM_LED] = {LED1_GPIO_PORT, LED2_GPIO_PORT}; const uint16_t LED_GPIO_PIN[NUM_LED] = {LED1_GPIO_PIN, LED2_GPIO_PIN}; const uint32_t LED_GPIO_CLK[NUM_LED] = {LED1_GPIO_CLK, LED2_GPIO_CLK}; -/* Initialises all the LED's */ + +/******************************************************************************* +* Function Name : LED_INIT +* Description : Initialises all the LED's +* Input : None +* Output : None +* Return : None +*******************************************************************************/ void LED_INIT(void) { GPIO_InitTypeDef GPIO_InitStructure; @@ -45,16 +66,40 @@ void LED_INIT(void) } } + +/******************************************************************************* +* Function Name : LED_ON +* Description : Turn on LED +* Input : LED Number +* Output : None +* Return : None +*******************************************************************************/ void LED_ON(LedTypeDef LEDNum) { LED_GPIO_PORT[LEDNum]->BSRR = LED_GPIO_PIN[LEDNum]; } + +/******************************************************************************* +* Function Name : LED_OFF +* Description : Turn off LED +* Input : LED Number +* Output : None +* Return : None +*******************************************************************************/ void LED_OFF(LedTypeDef LEDNum) { LED_GPIO_PORT[LEDNum]->BRR = LED_GPIO_PIN[LEDNum]; } + +/******************************************************************************* +* Function Name : LED_TOGGLE +* Description : Turn on/off LED +* Input : LED Number +* Output : None +* Return : None +*******************************************************************************/ void LED_TOGGLE(LedTypeDef LEDNum) { LED_GPIO_PORT[LEDNum]->ODR ^= LED_GPIO_PIN[LEDNum];