mirror of
https://bitbucket.org/librepilot/librepilot.git
synced 2024-11-29 07:24:13 +01:00
Made a start on function comments
git-svn-id: svn://svn.openpilot.org/OpenPilot/trunk@14 ebee16cc-31ac-478f-84a7-5cbb03baadba
This commit is contained in:
parent
4f36f10c1a
commit
9b77b473c4
@ -37,7 +37,7 @@
|
|||||||
#include <queue.h>
|
#include <queue.h>
|
||||||
|
|
||||||
|
|
||||||
/* FreeRTOS Tasks */
|
/* FreeRTOS Prototypes */
|
||||||
void PiosMainTask( void *pvParameters );
|
void PiosMainTask( void *pvParameters );
|
||||||
void SensorTask( void *pvParameters );
|
void SensorTask( void *pvParameters );
|
||||||
|
|
||||||
|
@ -25,9 +25,19 @@
|
|||||||
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
/* Project Includes */
|
/* Project Includes */
|
||||||
#include "pios.h"
|
#include "pios.h"
|
||||||
|
|
||||||
|
|
||||||
|
/* Public Function Prototypes */
|
||||||
|
int IRQDisable(void);
|
||||||
|
int IRQEnable(void);
|
||||||
|
|
||||||
|
|
||||||
|
/* Private Function Prototypes */
|
||||||
|
|
||||||
|
|
||||||
/* Local Variables */
|
/* Local Variables */
|
||||||
/* The nesting counter ensures, that interrupts won't be enabled so long nested functions disable them */
|
/* The nesting counter ensures, that interrupts won't be enabled so long nested functions disable them */
|
||||||
static unsigned int nested_ctr;
|
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) */
|
/* Stored priority level before IRQ has been disabled (important for co-existence with vPortEnterCritical) */
|
||||||
static unsigned int prev_primask;
|
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)
|
int IRQDisable(void)
|
||||||
{
|
{
|
||||||
/* Get current priority if nested level == 0 */
|
/* Get current priority if nested level == 0 */
|
||||||
@ -59,7 +76,14 @@ int IRQDisable(void)
|
|||||||
return 0;
|
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)
|
int IRQEnable(void)
|
||||||
{
|
{
|
||||||
/* Check for nesting error */
|
/* Check for nesting error */
|
||||||
@ -81,4 +105,4 @@ int IRQEnable(void)
|
|||||||
|
|
||||||
/* No error */
|
/* No error */
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -25,13 +25,34 @@
|
|||||||
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
/* Project Includes */
|
||||||
#include "pios.h"
|
#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};
|
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 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};
|
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)
|
void LED_INIT(void)
|
||||||
{
|
{
|
||||||
GPIO_InitTypeDef GPIO_InitStructure;
|
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)
|
void LED_ON(LedTypeDef LEDNum)
|
||||||
{
|
{
|
||||||
LED_GPIO_PORT[LEDNum]->BSRR = LED_GPIO_PIN[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)
|
void LED_OFF(LedTypeDef LEDNum)
|
||||||
{
|
{
|
||||||
LED_GPIO_PORT[LEDNum]->BRR = LED_GPIO_PIN[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)
|
void LED_TOGGLE(LedTypeDef LEDNum)
|
||||||
{
|
{
|
||||||
LED_GPIO_PORT[LEDNum]->ODR ^= LED_GPIO_PIN[LEDNum];
|
LED_GPIO_PORT[LEDNum]->ODR ^= LED_GPIO_PIN[LEDNum];
|
||||||
|
Loading…
Reference in New Issue
Block a user