More cleanup of MPU driver code. Support MPU INT on CC3D and Naze32
[betaflight.git] / src / main / drivers / system.h
blobb92e6ffce9e6f4c1129d1d4dfb027733b04338fd
1 /*
2 * This file is part of Cleanflight.
4 * Cleanflight is free software: you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation, either version 3 of the License, or
7 * (at your option) any later version.
9 * Cleanflight is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with Cleanflight. If not, see <http://www.gnu.org/licenses/>.
18 #pragma once
20 void systemInit(void);
21 void delayMicroseconds(uint32_t us);
22 void delay(uint32_t ms);
24 uint32_t micros(void);
25 uint32_t millis(void);
27 // failure
28 void failureMode(uint8_t mode);
30 // bootloader/IAP
31 void systemReset(void);
32 void systemResetToBootloader(void);
33 bool isMPUSoftReset(void);
35 void enableGPIOPowerUsageAndNoiseReductions(void);
36 // current crystal frequency - 8 or 12MHz
37 extern uint32_t hse_value;
39 typedef void extiCallbackHandlerFunc(void);
41 void registerExtiCallbackHandler(IRQn_Type irqn, extiCallbackHandlerFunc *fn);
42 void unregisterExtiCallbackHandler(IRQn_Type irqn, extiCallbackHandlerFunc *fn);
44 extern uint32_t cachedRccCsrValue;
46 typedef enum {
47 FAILURE_DEVELOPER = 0,
48 FAILURE_MISSING_ACC,
49 FAILURE_ACC_INIT,
50 FAILURE_ACC_INCOMPATIBLE,
51 FAILURE_INVALID_EEPROM_CONTENTS,
52 FAILURE_FLASH_WRITE_FAILED,
53 FAILURE_GYRO_INIT_FAILED
54 } failureMode_e;