Skip to content

Commit

Permalink
[subsystem] possibility to poweron gps and imu via gpio at init
Browse files Browse the repository at this point in the history
closes #706
  • Loading branch information
fvantienen authored and flixr committed May 13, 2014
1 parent 260dd67 commit a34b7c6
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 0 deletions.
12 changes: 12 additions & 0 deletions sw/airborne/subsystems/gps.c
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,14 @@

#include "led.h"

#ifdef GPS_POWER_GPIO
#include "mcu_periph/gpio.h"

#ifndef GPS_POWER_GPIO_ON
#define GPS_POWER_GPIO_ON gpio_set
#endif
#endif

#define MSEC_PER_WEEK (1000*60*60*24*7)

struct GpsState gps;
Expand Down Expand Up @@ -106,6 +114,10 @@ void gps_init(void) {
gps.last_3dfix_time = 0;
gps.last_msg_ticks = 0;
gps.last_msg_time = 0;
#ifdef GPS_POWER_GPIO
gpio_setup_output(GPS_POWER_GPIO);
GPS_POWER_GPIO_ON(GPS_POWER_GPIO);
#endif
#ifdef GPS_LED
LED_OFF(GPS_LED);
#endif
Expand Down
13 changes: 13 additions & 0 deletions sw/airborne/subsystems/imu.c
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,14 @@

#include "subsystems/imu.h"

#ifdef IMU_POWER_GPIO
#include "mcu_periph/gpio.h"

#ifndef IMU_POWER_GPIO_ON
#define IMU_POWER_GPIO_ON gpio_set
#endif
#endif

#if PERIODIC_TELEMETRY
#include "subsystems/datalink/telemetry.h"

Expand Down Expand Up @@ -102,6 +110,11 @@ struct ImuFloat imuf;

void imu_init(void) {

#ifdef IMU_POWER_GPIO
gpio_setup_output(IMU_POWER_GPIO);
IMU_POWER_GPIO_ON(IMU_POWER_GPIO);
#endif

/* initialises neutrals */
RATES_ASSIGN(imu.gyro_neutral, IMU_GYRO_P_NEUTRAL, IMU_GYRO_Q_NEUTRAL, IMU_GYRO_R_NEUTRAL);

Expand Down

0 comments on commit a34b7c6

Please sign in to comment.