mirror of
https://github.com/betaflight/betaflight.git
synced 2025-07-19 22:35:23 +03:00
Merge remote-tracking branch 'multiwii/upstream'
Conflicts: src/drv_system.c src/main.c
This commit is contained in:
commit
d8e9282f04
11 changed files with 3348 additions and 3229 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)
|
||||
{
|
||||
|
@ -89,6 +93,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;
|
||||
|
@ -182,6 +192,29 @@ void systemReset(bool toBootloader)
|
|||
// Generate system reset
|
||||
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