mirror of
https://github.com/betaflight/betaflight.git
synced 2025-07-15 20:35:33 +03:00
fixed buzzer on rev5 boards;
added experimental gyro-based headfree boxes git-svn-id: https://afrodevices.googlecode.com/svn/trunk/baseflight@429 7c89a4a9-59b9-e629-4cfe-3a2d53b20e61
This commit is contained in:
parent
800ce6bdf7
commit
3bb1063001
6 changed files with 3142 additions and 3096 deletions
|
@ -6,6 +6,10 @@ static volatile uint32_t usTicks = 0;
|
|||
static volatile uint32_t sysTickUptime = 0;
|
||||
// from system_stm32f10x.c
|
||||
void SetSysClock(void);
|
||||
void systemBeep(bool onoff);
|
||||
static void beepRev4(bool onoff);
|
||||
static void beepRev5(bool onoff);
|
||||
void (* systemBeepPtr)(bool onoff) = NULL;
|
||||
|
||||
static void cycleCounterInit(void)
|
||||
{
|
||||
|
@ -84,6 +88,12 @@ void systemInit(void)
|
|||
AFIO->MAPR |= AFIO_MAPR_SWJ_CFG_NO_JTAG_SW;
|
||||
|
||||
// Configure gpio
|
||||
// rev5 needs inverted beeper. oops.
|
||||
if (hse_value == 12000000)
|
||||
systemBeepPtr = beepRev5;
|
||||
else
|
||||
systemBeepPtr = beepRev4;
|
||||
|
||||
LED0_OFF;
|
||||
LED1_OFF;
|
||||
BEEP_OFF;
|
||||
|
@ -178,6 +188,29 @@ void systemReset(bool toBootloader)
|
|||
SCB->AIRCR = AIRCR_VECTKEY_MASK | (uint32_t)0x04;
|
||||
}
|
||||
|
||||
static void beepRev4(bool onoff)
|
||||
{
|
||||
if (onoff) {
|
||||
digitalLo(BEEP_GPIO, BEEP_PIN);
|
||||
} else {
|
||||
digitalHi(BEEP_GPIO, BEEP_PIN);
|
||||
}
|
||||
}
|
||||
|
||||
static void beepRev5(bool onoff)
|
||||
{
|
||||
if (onoff) {
|
||||
digitalHi(BEEP_GPIO, BEEP_PIN);
|
||||
} else {
|
||||
digitalLo(BEEP_GPIO, BEEP_PIN);
|
||||
}
|
||||
}
|
||||
|
||||
void systemBeep(bool onoff)
|
||||
{
|
||||
systemBeepPtr(onoff);
|
||||
}
|
||||
|
||||
void alignSensors(int16_t *src, int16_t *dest, uint8_t rotation)
|
||||
{
|
||||
switch (rotation) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue