52 lines
1.4 KiB
C
52 lines
1.4 KiB
C
/*
|
|
Copyright (c) 2015 Arduino LLC. All right reserved.
|
|
|
|
This library is free software; you can redistribute it and/or
|
|
modify it under the terms of the GNU Lesser General Public
|
|
License as published by the Free Software Foundation; either
|
|
version 2.1 of the License, or (at your option) any later version.
|
|
|
|
This library is distributed in the hope that it will be useful,
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
|
See the GNU Lesser General Public License for more details.
|
|
|
|
You should have received a copy of the GNU Lesser General Public
|
|
License along with this library; if not, write to the Free Software
|
|
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
#ifdef __cplusplus
|
|
extern "C" {
|
|
#endif
|
|
|
|
extern void init(void);
|
|
|
|
extern void enterSerialDfu(void);
|
|
extern void enterOTADfu(void);
|
|
|
|
// Hint instruction to tell CPU go to low power mode
|
|
#if 0
|
|
#define waitForEvent() __WFE()
|
|
#else
|
|
ATTR_ALWAYS_INLINE static inline void waitForEvent(void)
|
|
{
|
|
// Set bit 7 and bits 4..0 in the mask to one (0x ...00 1001 1111)
|
|
enum { FPU_EXCEPTION_MASK = 0x0000009F };
|
|
|
|
/* Clear exceptions and PendingIRQ from the FPU unit */
|
|
__set_FPSCR(__get_FPSCR() & ~(FPU_EXCEPTION_MASK));
|
|
(void) __get_FPSCR();
|
|
NVIC_ClearPendingIRQ(FPU_IRQn);
|
|
|
|
/* Call SoftDevice Wait For event */
|
|
(void) sd_app_evt_wait();
|
|
}
|
|
#endif
|
|
|
|
#ifdef __cplusplus
|
|
}
|
|
#endif
|