1
0
mirror of https://bitbucket.org/librepilot/librepilot.git synced 2024-11-29 07:24:13 +01:00

Uncrustify

This commit is contained in:
Alessio Morale 2016-07-03 17:10:46 +02:00
parent 036dcbaa21
commit 6214c0ea30
5 changed files with 28 additions and 30 deletions

View File

@ -35,14 +35,14 @@
#include <pios_stm32.h> #include <pios_stm32.h>
typedef bool (* pios_exti_vector_t)(void); typedef bool (*pios_exti_vector_t)(void);
struct pios_exti_cfg { struct pios_exti_cfg {
pios_exti_vector_t vector; pios_exti_vector_t vector;
uint32_t line; /* use EXTI_LineN macros */ uint32_t line; /* use EXTI_LineN macros */
struct stm32_gpio pin; struct stm32_gpio pin;
struct stm32_irq irq; struct stm32_irq irq;
struct stm32_exti exti; struct stm32_exti exti;
}; };
/* must be added to any pios_exti_cfg definition for it to be valid */ /* must be added to any pios_exti_cfg definition for it to be valid */

View File

@ -34,7 +34,7 @@
#ifdef PIOS_INCLUDE_EXTI #ifdef PIOS_INCLUDE_EXTI
/* Map EXTI line to full config */ /* Map EXTI line to full config */
#define EXTI_MAX_LINES 16 #define EXTI_MAX_LINES 16
static pios_exti_vector_t pios_exti_vector[EXTI_MAX_LINES]; static pios_exti_vector_t pios_exti_vector[EXTI_MAX_LINES];
@ -161,7 +161,7 @@ int32_t PIOS_EXTI_Init(const struct pios_exti_cfg *cfg)
/* Following is not entirely correct! There is cfg->pin.pin_source to serve this purpose, and GPIO_Pin can also contain more than one bit set */ /* Following is not entirely correct! There is cfg->pin.pin_source to serve this purpose, and GPIO_Pin can also contain more than one bit set */
uint8_t exti_source_pin = PIOS_EXTI_gpio_pin_to_exti_source_pin(cfg->pin.init.GPIO_Pin); uint8_t exti_source_pin = PIOS_EXTI_gpio_pin_to_exti_source_pin(cfg->pin.init.GPIO_Pin);
SYSCFG_EXTILineConfig(exti_source_port, exti_source_pin); SYSCFG_EXTILineConfig(exti_source_port, exti_source_pin);
EXTI_Init((EXTI_InitTypeDef*)&cfg->exti.init); EXTI_Init((EXTI_InitTypeDef *)&cfg->exti.init);
/* Enable the interrupt channel */ /* Enable the interrupt channel */
NVIC_Init(&cfg->irq.init); NVIC_Init(&cfg->irq.init);
@ -173,26 +173,25 @@ int32_t PIOS_EXTI_DeInit(const struct pios_exti_cfg *cfg)
{ {
uint8_t line_index = PIOS_EXTI_line_to_index(cfg->line); uint8_t line_index = PIOS_EXTI_line_to_index(cfg->line);
if(pios_exti_vector[line_index] == cfg->vector) { if (pios_exti_vector[line_index] == cfg->vector) {
EXTI_InitTypeDef disable = cfg->exti.init; EXTI_InitTypeDef disable = cfg->exti.init;
disable.EXTI_LineCmd = DISABLE; disable.EXTI_LineCmd = DISABLE;
EXTI_Init(&disable); EXTI_Init(&disable);
pios_exti_vector[line_index] = 0; pios_exti_vector[line_index] = 0;
return 0; return 0;
} }
return -1; return -1;
} }
static bool PIOS_EXTI_generic_irq_handler(uint8_t line_index) static bool PIOS_EXTI_generic_irq_handler(uint8_t line_index)
{ {
if(pios_exti_vector[line_index]) { if (pios_exti_vector[line_index]) {
return pios_exti_vector[line_index](); return pios_exti_vector[line_index]();
} }
/* Unconfigured interrupt just fired! */ /* Unconfigured interrupt just fired! */
return false; return false;
} }

View File

@ -34,7 +34,7 @@
#ifdef PIOS_INCLUDE_EXTI #ifdef PIOS_INCLUDE_EXTI
/* Map EXTI line to full config */ /* Map EXTI line to full config */
#define EXTI_MAX_LINES 16 #define EXTI_MAX_LINES 16
static pios_exti_vector_t pios_exti_vector[EXTI_MAX_LINES]; static pios_exti_vector_t pios_exti_vector[EXTI_MAX_LINES];
@ -174,26 +174,25 @@ int32_t PIOS_EXTI_DeInit(const struct pios_exti_cfg *cfg)
{ {
uint8_t line_index = PIOS_EXTI_line_to_index(cfg->line); uint8_t line_index = PIOS_EXTI_line_to_index(cfg->line);
if(pios_exti_vector[line_index] == cfg->vector) { if (pios_exti_vector[line_index] == cfg->vector) {
EXTI_InitTypeDef disable = cfg->exti.init; EXTI_InitTypeDef disable = cfg->exti.init;
disable.EXTI_LineCmd = DISABLE; disable.EXTI_LineCmd = DISABLE;
EXTI_Init(&disable); EXTI_Init(&disable);
pios_exti_vector[line_index] = 0; pios_exti_vector[line_index] = 0;
return 0; return 0;
} }
return -1; return -1;
} }
static bool PIOS_EXTI_generic_irq_handler(uint8_t line_index) static bool PIOS_EXTI_generic_irq_handler(uint8_t line_index)
{ {
if(pios_exti_vector[line_index]) { if (pios_exti_vector[line_index]) {
return pios_exti_vector[line_index](); return pios_exti_vector[line_index]();
} }
/* Unconfigured interrupt just fired! */ /* Unconfigured interrupt just fired! */
return false; return false;
} }

View File

@ -33,7 +33,7 @@
#ifdef PIOS_INCLUDE_EXTI #ifdef PIOS_INCLUDE_EXTI
#define EXTI_MAX_LINES 16 #define EXTI_MAX_LINES 16
static pios_exti_vector_t pios_exti_vector[EXTI_MAX_LINES]; static pios_exti_vector_t pios_exti_vector[EXTI_MAX_LINES];
@ -174,26 +174,25 @@ int32_t PIOS_EXTI_DeInit(const struct pios_exti_cfg *cfg)
{ {
uint8_t line_index = PIOS_EXTI_line_to_index(cfg->line); uint8_t line_index = PIOS_EXTI_line_to_index(cfg->line);
if(pios_exti_vector[line_index] == cfg->vector) { if (pios_exti_vector[line_index] == cfg->vector) {
EXTI_InitTypeDef disable = cfg->exti.init; EXTI_InitTypeDef disable = cfg->exti.init;
disable.EXTI_LineCmd = DISABLE; disable.EXTI_LineCmd = DISABLE;
EXTI_Init(&disable); EXTI_Init(&disable);
pios_exti_vector[line_index] = 0; pios_exti_vector[line_index] = 0;
return 0; return 0;
} }
return -1; return -1;
} }
static bool PIOS_EXTI_generic_irq_handler(uint8_t line_index) static bool PIOS_EXTI_generic_irq_handler(uint8_t line_index)
{ {
if(pios_exti_vector[line_index]) { if (pios_exti_vector[line_index]) {
return pios_exti_vector[line_index](); return pios_exti_vector[line_index]();
} }
/* Unconfigured interrupt just fired! */ /* Unconfigured interrupt just fired! */
return false; return false;
} }

View File

@ -162,8 +162,9 @@ QIODevice *SerialConnection::openDevice(const QString &deviceName)
// don't specify a parent when constructing the QSerialPort as this object will be moved // don't specify a parent when constructing the QSerialPort as this object will be moved
// to a different thread later on (see telemetrymanager.cpp) // to a different thread later on (see telemetrymanager.cpp)
serialHandle = new QSerialPort(port); serialHandle = new QSerialPort(port);
connect(serialHandle, static_cast<void(QSerialPort::*)(QSerialPort::SerialPortError)>(&QSerialPort::error), connect(serialHandle, static_cast<void(QSerialPort::*) (QSerialPort::SerialPortError)>(&QSerialPort::error),
[=](QSerialPort::SerialPortError error) { qWarning() << "serial port error:" << error; }); [ = ](QSerialPort::SerialPortError error) { qWarning() << "serial port error:" << error; }
);
// we need to handle port settings here... // we need to handle port settings here...
if (serialHandle->open(QIODevice::ReadWrite)) { if (serialHandle->open(QIODevice::ReadWrite)) {
if (serialHandle->setBaudRate(m_config->speed().toInt()) if (serialHandle->setBaudRate(m_config->speed().toInt())