diff --git a/baseflight.uvproj b/baseflight.uvproj
index e9deda99e6..a6d0cd2ceb 100755
--- a/baseflight.uvproj
+++ b/baseflight.uvproj
@@ -30,6 +30,7 @@
SFD\ST\STM32F1xx\STM32F103xx.sfr
+ 0
0
@@ -97,6 +98,7 @@
3
+ 1
SARMCM3.DLL
@@ -169,6 +171,10 @@
BIN\UL2CM3.DLL
"" ()
+
+
+
+ 0
@@ -551,6 +557,7 @@
11
+ 1
@@ -596,6 +603,7 @@
11
+ 1
@@ -696,6 +704,7 @@
11
+ 0
@@ -822,6 +831,7 @@
11
+ 1
@@ -881,6 +891,7 @@
SFD\ST\STM32F1xx\STM32F103xx.sfr
+ 0
0
@@ -948,6 +959,7 @@
3
+ 1
SARMCM3.DLL
@@ -1020,6 +1032,10 @@
BIN\UL2CM3.DLL
"" ()
+
+
+
+ 0
@@ -1402,6 +1418,7 @@
11
+ 1
@@ -1447,6 +1464,7 @@
11
+ 1
@@ -1617,6 +1635,7 @@
11
+ 1
@@ -1676,6 +1695,7 @@
SFD\ST\STM32F10xx\STM32F10xxB.sfr
+ 0
0
@@ -1743,6 +1763,7 @@
3
+ 1
SARMCM3.DLL
@@ -1815,6 +1836,10 @@
BIN\UL2CM3.DLL
"" ()
+
+
+
+ 0
@@ -2142,6 +2167,7 @@
11
+ 1
@@ -2187,6 +2213,7 @@
11
+ 1
@@ -2232,6 +2259,7 @@
11
+ 1
@@ -2277,6 +2305,7 @@
11
+ 1
@@ -2327,6 +2356,7 @@
11
+ 1
@@ -2372,6 +2402,7 @@
11
+ 1
@@ -2427,6 +2458,7 @@
11
+ 1
@@ -2472,6 +2504,7 @@
11
+ 1
@@ -2582,6 +2615,7 @@
11
+ 0
@@ -2703,6 +2737,7 @@
11
+ 1
diff --git a/src/drv_system.c b/src/drv_system.c
index b8285d6555..2209ebd228 100755
--- a/src/drv_system.c
+++ b/src/drv_system.c
@@ -6,10 +6,12 @@ static volatile uint32_t usTicks = 0;
static volatile uint32_t sysTickUptime = 0;
// from system_stm32f10x.c
void SetSysClock(void);
+#ifdef BUZZER
void systemBeep(bool onoff);
static void beepRev4(bool onoff);
static void beepRev5(bool onoff);
void (* systemBeepPtr)(bool onoff) = NULL;
+#endif
static void cycleCounterInit(void)
{
@@ -87,16 +89,17 @@ void systemInit(void)
#define AFIO_MAPR_SWJ_CFG_NO_JTAG_SW (0x2 << 24)
AFIO->MAPR |= AFIO_MAPR_SWJ_CFG_NO_JTAG_SW;
+#ifdef BUZZER
// Configure gpio
// rev5 needs inverted beeper. oops.
if (hse_value == 12000000)
systemBeepPtr = beepRev5;
else
systemBeepPtr = beepRev4;
-
+ BEEP_OFF;
+#endif
LED0_OFF;
LED1_OFF;
- BEEP_OFF;
for (i = 0; i < gpio_count; i++) {
if (hse_value == 12000000 && gpio_setup[i].cfg.mode == Mode_Out_OD)
@@ -188,6 +191,7 @@ void systemReset(bool toBootloader)
SCB->AIRCR = AIRCR_VECTKEY_MASK | (uint32_t)0x04;
}
+#ifdef BUZZER
static void beepRev4(bool onoff)
{
if (onoff) {
@@ -205,56 +209,11 @@ static void beepRev5(bool onoff)
digitalLo(BEEP_GPIO, BEEP_PIN);
}
}
+#endif
void systemBeep(bool onoff)
{
+#ifdef BUZZER
systemBeepPtr(onoff);
-}
-
-void alignSensors(int16_t *src, int16_t *dest, uint8_t rotation)
-{
- switch (rotation) {
- case CW0_DEG:
- dest[X] = src[X];
- dest[Y] = src[Y];
- dest[Z] = src[Z];
- break;
- case CW90_DEG:
- dest[X] = src[Y];
- dest[Y] = -src[X];
- dest[Z] = src[Z];
- break;
- case CW180_DEG:
- dest[X] = -src[X];
- dest[Y] = -src[Y];
- dest[Z] = src[Z];
- break;
- case CW270_DEG:
- dest[X] = -src[Y];
- dest[Y] = src[X];
- dest[Z] = src[Z];
- break;
- case CW0_DEG_FLIP:
- dest[X] = -src[X];
- dest[Y] = src[Y];
- dest[Z] = -src[Z];
- break;
- case CW90_DEG_FLIP:
- dest[X] = src[Y];
- dest[Y] = src[X];
- dest[Z] = -src[Z];
- break;
- case CW180_DEG_FLIP:
- dest[X] = src[X];
- dest[Y] = -src[Y];
- dest[Z] = -src[Z];
- break;
- case CW270_DEG_FLIP:
- dest[X] = -src[Y];
- dest[Y] = -src[X];
- dest[Z] = -src[Z];
- break;
- default:
- break;
- }
+#endif
}
diff --git a/src/drv_system.h b/src/drv_system.h
index be5f889db6..ca2871a5d4 100755
--- a/src/drv_system.h
+++ b/src/drv_system.h
@@ -15,6 +15,3 @@ void systemReset(bool toBootloader);
// current crystal frequency - 8 or 12MHz
extern uint32_t hse_value;
-
-// sensor orientation
-void alignSensors(int16_t *src, int16_t *dest, uint8_t rotation);
diff --git a/src/utils.c b/src/utils.c
index 2de9f351b9..e755c9c57e 100644
--- a/src/utils.c
+++ b/src/utils.c
@@ -10,3 +10,51 @@ int constrain(int amt, int low, int high)
else
return amt;
}
+
+void alignSensors(int16_t *src, int16_t *dest, uint8_t rotation)
+{
+ switch (rotation) {
+ case CW0_DEG:
+ dest[X] = src[X];
+ dest[Y] = src[Y];
+ dest[Z] = src[Z];
+ break;
+ case CW90_DEG:
+ dest[X] = src[Y];
+ dest[Y] = -src[X];
+ dest[Z] = src[Z];
+ break;
+ case CW180_DEG:
+ dest[X] = -src[X];
+ dest[Y] = -src[Y];
+ dest[Z] = src[Z];
+ break;
+ case CW270_DEG:
+ dest[X] = -src[Y];
+ dest[Y] = src[X];
+ dest[Z] = src[Z];
+ break;
+ case CW0_DEG_FLIP:
+ dest[X] = -src[X];
+ dest[Y] = src[Y];
+ dest[Z] = -src[Z];
+ break;
+ case CW90_DEG_FLIP:
+ dest[X] = src[Y];
+ dest[Y] = src[X];
+ dest[Z] = -src[Z];
+ break;
+ case CW180_DEG_FLIP:
+ dest[X] = src[X];
+ dest[Y] = -src[Y];
+ dest[Z] = -src[Z];
+ break;
+ case CW270_DEG_FLIP:
+ dest[X] = -src[Y];
+ dest[Y] = -src[X];
+ dest[Z] = -src[Z];
+ break;
+ default:
+ break;
+ }
+}
diff --git a/src/utils.h b/src/utils.h
index 4fca60f8cf..aca00681b5 100644
--- a/src/utils.h
+++ b/src/utils.h
@@ -1,3 +1,5 @@
#pragma once
int constrain(int amt, int low, int high);
+// sensor orientation
+void alignSensors(int16_t *src, int16_t *dest, uint8_t rotation);