Skip to content

Commit

Permalink
Merge pull request #178 from rosflight/code_style
Browse files Browse the repository at this point in the history
Ran code style fixer
  • Loading branch information
superjax committed Jun 14, 2017
2 parents 2427d47 + 622dd72 commit a8bc9c8
Show file tree
Hide file tree
Showing 36 changed files with 504 additions and 477 deletions.
1 change: 0 additions & 1 deletion .astylerc
Expand Up @@ -7,4 +7,3 @@ align-pointer=name
align-reference=name
max-code-length=120
suffix=none
--ignore-exclude-errors-x
74 changes: 46 additions & 28 deletions boards/naze/board.c
@@ -1,22 +1,22 @@
/* BSD 3-Clause License
*
*
* Copyright (c) 2017, James Jackson and Daniel Koch, BYU MAGICC Lab
* All rights reserved.
*
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
*
* * Redistributions of source code must retain the above copyright notice, this
* list of conditions and the following disclaimer.
*
*
* * Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
*
* * Neither the name of the copyright holder nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
Expand Down Expand Up @@ -103,21 +103,21 @@ static float _gyro_scale;

void sensors_init()
{
// Initialize I2c
i2cInit(I2CDEV_2);
// Initialize I2c
i2cInit(I2CDEV_2);

while(millis() < 50);
while (millis() < 50);

i2cWrite(0,0,0);
_baro_present = ms5611_init();
_mag_present = hmc5883lInit(_board_revision);
_sonar_present = mb1242_init();
_diff_pressure_present = ms4525_init();
i2cWrite(0,0,0);
_baro_present = ms5611_init();
_mag_present = hmc5883lInit(_board_revision);
_sonar_present = mb1242_init();
_diff_pressure_present = ms4525_init();

// IMU
uint16_t acc1G;
mpu6050_init(true, &acc1G, &_gyro_scale, _board_revision);
_accel_scale = 9.80665f/acc1G;
// IMU
uint16_t acc1G;
mpu6050_init(true, &acc1G, &_gyro_scale, _board_revision);
_accel_scale = 9.80665f/acc1G;
}

void imu_register_callback(void (*callback)(void))
Expand All @@ -133,7 +133,7 @@ void imu_not_responding_error()
sensors_init();
}

bool imu_read_all(float accel[3], float gyro[3], float* temperature)
bool imu_read_all(float accel[3], float gyro[3], float *temperature)
{
// Convert to NED
int16_t accel_raw[3];
Expand Down Expand Up @@ -292,7 +292,7 @@ void pwm_write(uint8_t channel, uint16_t value)

bool pwm_lost()
{
return ((millis() - pwmLastUpdate()) > 40);
return ((millis() - pwmLastUpdate()) > 40);
}

// non-volatile memory
Expand All @@ -302,22 +302,40 @@ void memory_init(void)
initEEPROM();
}

bool memory_read(void * dest, size_t len)
bool memory_read(void *dest, size_t len)
{
return readEEPROM(dest, len);
}

bool memory_write(const void * src, size_t len)
bool memory_write(const void *src, size_t len)
{
return writeEEPROM(src, len);
}

// LED

void led0_on(void) { LED0_ON; }
void led0_off(void) { LED0_OFF; }
void led0_toggle(void) { LED0_TOGGLE; }
void led0_on(void)
{
LED0_ON;
}
void led0_off(void)
{
LED0_OFF;
}
void led0_toggle(void)
{
LED0_TOGGLE;
}

void led1_on(void) { LED1_ON; }
void led1_off(void) { LED1_OFF; }
void led1_toggle(void) { LED1_TOGGLE; }
void led1_on(void)
{
LED1_ON;
}
void led1_off(void)
{
LED1_OFF;
}
void led1_toggle(void)
{
LED1_TOGGLE;
}
3 changes: 2 additions & 1 deletion fix-code-style.sh
Expand Up @@ -3,5 +3,6 @@
CMD="astyle --options=.astylerc"

$CMD include/*
$CMD --exclude="param.c" src/*
$CMD src/*
$CMD lib/turbotrig/*
$CMD boards/naze/*
20 changes: 10 additions & 10 deletions include/board.h
@@ -1,22 +1,22 @@
/*
/*
* Copyright (c) 2017, James Jackson and Daniel Koch, BYU MAGICC Lab
*
*
* All rights reserved.
*
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
*
* * Redistributions of source code must retain the above copyright notice, this
* list of conditions and the following disclaimer.
*
*
* * Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
*
* * Neither the name of the copyright holder nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
Expand Down Expand Up @@ -55,7 +55,7 @@ void imu_register_callback(void (*callback)(void));
void imu_read_accel(float accel[3]);
void imu_read_gyro(float gyro[3]);
float imu_read_temperature(void);
bool imu_read_all(float accel[3], float gyro[3], float* temperature);
bool imu_read_all(float accel[3], float gyro[3], float *temperature);
void imu_not_responding_error();

bool mag_check(void);
Expand Down Expand Up @@ -87,8 +87,8 @@ void pwm_write(uint8_t channel, uint16_t value);

// non-volatile memory
void memory_init(void);
bool memory_read(void * dest, size_t len);
bool memory_write(const void * src, size_t len);
bool memory_read(void *dest, size_t len);
bool memory_write(const void *src, size_t len);

// LEDs
void led0_on(void);
Expand Down
14 changes: 7 additions & 7 deletions include/controller.h
@@ -1,22 +1,22 @@
/*
/*
* Copyright (c) 2017, James Jackson and Daniel Koch, BYU MAGICC Lab
*
*
* All rights reserved.
*
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
*
* * Redistributions of source code must retain the above copyright notice, this
* list of conditions and the following disclaimer.
*
*
* * Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
*
* * Neither the name of the copyright holder nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
Expand Down
14 changes: 7 additions & 7 deletions include/estimator.h
@@ -1,22 +1,22 @@
/*
/*
* Copyright (c) 2017, James Jackson and Daniel Koch, BYU MAGICC Lab
*
*
* All rights reserved.
*
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
*
* * Redistributions of source code must retain the above copyright notice, this
* list of conditions and the following disclaimer.
*
*
* * Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
*
* * Neither the name of the copyright holder nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
Expand Down
14 changes: 7 additions & 7 deletions include/mavlink.h
@@ -1,22 +1,22 @@
/*
/*
* Copyright (c) 2017, James Jackson and Daniel Koch, BYU MAGICC Lab
*
*
* All rights reserved.
*
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
*
* * Redistributions of source code must retain the above copyright notice, this
* list of conditions and the following disclaimer.
*
*
* * Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
*
* * Neither the name of the copyright holder nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
Expand Down
14 changes: 7 additions & 7 deletions include/mavlink_log.h
@@ -1,22 +1,22 @@
/*
/*
* Copyright (c) 2017, James Jackson and Daniel Koch, BYU MAGICC Lab
*
*
* All rights reserved.
*
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
*
* * Redistributions of source code must retain the above copyright notice, this
* list of conditions and the following disclaimer.
*
*
* * Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
*
* * Neither the name of the copyright holder nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
Expand Down
14 changes: 7 additions & 7 deletions include/mavlink_param.h
@@ -1,22 +1,22 @@
/*
/*
* Copyright (c) 2017, James Jackson and Daniel Koch, BYU MAGICC Lab
*
*
* All rights reserved.
*
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
*
* * Redistributions of source code must retain the above copyright notice, this
* list of conditions and the following disclaimer.
*
*
* * Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
*
* * Neither the name of the copyright holder nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
Expand Down
14 changes: 7 additions & 7 deletions include/mavlink_receive.h
@@ -1,22 +1,22 @@
/*
/*
* Copyright (c) 2017, James Jackson and Daniel Koch, BYU MAGICC Lab
*
*
* All rights reserved.
*
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
*
* * Redistributions of source code must retain the above copyright notice, this
* list of conditions and the following disclaimer.
*
*
* * Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
*
* * Neither the name of the copyright holder nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
Expand Down

0 comments on commit a8bc9c8

Please sign in to comment.