本文整理汇总了C++中NVIC_SystemReset函数的典型用法代码示例。如果您正苦于以下问题:C++ NVIC_SystemReset函数的具体用法?C++ NVIC_SystemReset怎么用?C++ NVIC_SystemReset使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了NVIC_SystemReset函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: main
int main (void) {
//
// Variables
//
char TCP_USER_i = 0;
TCP_USER_INFO *TCP_USER;
BOOL TCP_Connected = FALSE;
int a = 0, b = 0;
int RESET_VALUE_SEC = 0;
//
// Init
//
Init();
// Play saved animation
if (ANIMATION_PLAY) {
Animation_Start();
}
//
// While
//
while (1) {
main_TcpNet();
DHCP_Check();
if (ftpFileClose == __TRUE && ftpFileWrite == __TRUE) {
ftpFileClose = __FALSE;
ftpFileWrite = __FALSE;
if (strstr((char *)ftpFileOpen, "device.settings")) {
Delay_ms(2000);
NVIC_SystemReset();
}
}
/*****************************************************************************
** 1 ms timer
*****************************************************************************/
if (TICK_1MS == __TRUE) {
TICK_1MS = __FALSE;
if (ANIMATION_PLAY) {
if (DelayValue >= ((currentEffect.delay+1) * getDelayUnitValue(currentEffect.delayUnit))) {
DelayValue = 0;
if (CurrentAnimationEffect >= AnimationEffectsCount - 1) {
CurrentAnimationEffect = 0;
} else {
CurrentAnimationEffect++;
}
Animation_Read_Effect();
} else {
DelayValue++;
}
}
}
/*****************************************************************************
** 10 ms timer
*****************************************************************************/
if (TICK_10MS == __TRUE) {
TICK_10MS = __FALSE;
}
/*****************************************************************************
** 100 ms timer
*****************************************************************************/
if (TICK_100MS == __TRUE) {
TICK_100MS = __FALSE;
/*****************************************************************************
** reset button
*****************************************************************************/
if (!(LPC_GPIO1->FIOPIN & (1<<RESET_BUTTON_PIN))) {
if (RESET_VALUE_SEC >= 5) {
RESET_VALUE_SEC = 0;
Status_LED1_Set(TRUE);
Status_LED2_Set(TRUE);
while (!(LPC_GPIO1->FIOPIN & (1<<RESET_BUTTON_PIN)));
SPI_FLASH_Delete_All_Files();
NVIC_SystemReset();
Status_LED1_Set(FALSE);
Status_LED2_Set(FALSE);
}
} else {
RESET_VALUE_SEC = 0;
//.........这里部分代码省略.........
开发者ID:luka1995,项目名称:LPProjects-LED-Cube-8x8x8,代码行数:101,代码来源:MAIN.c
示例2: reboot
static void reboot(uint8_t argc, char **argv) {
NVIC_SystemReset();
}
开发者ID:Hletian,项目名称:EasyLogger,代码行数:3,代码来源:user_finsh_cmd.c
示例3: main
/**@brief Function for bootloader main entry.
*/
int main(void)
{
uint32_t err_code;
bool dfu_start = false;
bool app_reset = (NRF_POWER->GPREGRET == BOOTLOADER_DFU_START);
if (app_reset)
{
NRF_POWER->GPREGRET = 0;
}
leds_init();
// This check ensures that the defined fields in the bootloader corresponds with actual
// setting in the nRF51 chip.
APP_ERROR_CHECK_BOOL(*((uint32_t *)NRF_UICR_BOOT_START_ADDRESS) == BOOTLOADER_REGION_START);
APP_ERROR_CHECK_BOOL(NRF_FICR->CODEPAGESIZE == CODE_PAGE_SIZE);
// Initialize.
timers_init();
buttons_init();
(void)bootloader_init();
if (bootloader_dfu_sd_in_progress())
{
nrf_gpio_pin_clear(UPDATE_IN_PROGRESS_LED);
err_code = bootloader_dfu_sd_update_continue();
APP_ERROR_CHECK(err_code);
ble_stack_init(!app_reset);
scheduler_init();
err_code = bootloader_dfu_sd_update_finalize();
APP_ERROR_CHECK(err_code);
nrf_gpio_pin_set(UPDATE_IN_PROGRESS_LED);
}
else
{
// If stack is present then continue initialization of bootloader.
ble_stack_init(!app_reset);
scheduler_init();
}
dfu_start = app_reset;
dfu_start |= ((nrf_gpio_pin_read(BOOTLOADER_BUTTON) == 0) ? true: false);
if (dfu_start || (!bootloader_app_is_valid(DFU_BANK_0_REGION_START)))
{
nrf_gpio_pin_clear(UPDATE_IN_PROGRESS_LED);
// Initiate an update of the firmware.
err_code = bootloader_dfu_start();
APP_ERROR_CHECK(err_code);
nrf_gpio_pin_set(UPDATE_IN_PROGRESS_LED);
}
if (bootloader_app_is_valid(DFU_BANK_0_REGION_START) && !bootloader_dfu_sd_in_progress())
{
// Select a bank region to use as application region.
// @note: Only applications running from DFU_BANK_0_REGION_START is supported.
bootloader_app_start(DFU_BANK_0_REGION_START);
}
NVIC_SystemReset();
}
开发者ID:ClarePhang,项目名称:nrf51-ble-dfu-symmetric-signing,代码行数:71,代码来源:main.c
示例4: HID_ProcessCommand
void HID_ProcessCommand(uint8_t *request, uint8_t *response)
{
uint8_t result = DAP_OK;
uint16_t data;
uint16_t length;
uint32_t address;
uint8_t *p_address;
if ((*request >= HID_Command0) && (*request <= HID_Command7))
{
*response++ = *request;
switch (*request++)
{
case HID_Command0: /* Get device info */
address = DBGMCU->IDCODE;
*response++ = (address >> 0) & 0xFF;
*response++ = (address >> 8) & 0xFF;
*response++ = (address >> 16) & 0xFF;
*response++ = (address >> 24) & 0xFF;
break;
case HID_Command1:
FLASH_Unlock();
break;
case HID_Command2:
FLASH_Lock();
break;
case HID_Command3:
address = PACK_DATA_LONG(0);
if (FLASH_ErasePage(address) != FLASH_COMPLETE)
result = DAP_ERROR;
break;
case HID_Command4: /* Check for blank (0xFF) */
{
p_address = PACK_DATA_PBYTE(0);
length = PACK_DATA_WORD(4);
while (length-- != 0)
{
if (*p_address++ != 0xFF)
{
result = DAP_ERROR;
break;
}
}
}
break;
case HID_Command5: /* Write to flash */
{
address = PACK_DATA_LONG(0);
length = PACK_DATA_WORD(4);
if (length > (DAP_PACKET_SIZE - (8+2))) // Check for maximum data payload
result = DAP_ERROR;
else
{
request += 8;
while (length-- != 0)
{
data = *request++;
if (length != 0)
{
data |= ((uint16_t)(*request++) << 8);
length--;
}
if (FLASH_ProgramHalfWord(address, data) != FLASH_COMPLETE)
{
result = DAP_ERROR;
break;
}
address += 2;
}
}
}
break;
case HID_Command6: /* Read from flash */
{
p_address = PACK_DATA_PBYTE(0);
length = PACK_DATA_WORD(4);
if (length > (DAP_PACKET_SIZE - (2))) // Check for maximum data payload
result = DAP_ERROR;
else
while (length-- != 0)
*response++ = *p_address++;
}
break;
case HID_Command7: /* Reset device */
NVIC_SystemReset();
break;
default:
*(--response) = ID_DAP_Invalid;
return;
}
*response++ = result;
return;
}
开发者ID:32bitmicro,项目名称:CMSIS-DAP,代码行数:93,代码来源:usbd_user_hid.c
示例5: SystemInit
//.........这里部分代码省略.........
/* Workaround for Errata 36 "CLOCK: Some registers are not reset when expected" found at the Errata document
for your device located at https://www.nordicsemi.com/DocLib */
if (errata_36()){
NRF_CLOCK->EVENTS_DONE = 0;
NRF_CLOCK->EVENTS_CTTO = 0;
NRF_CLOCK->CTIV = 0;
}
#if defined (DEVELOP_IN_NRF52832)
/* Workaround for Errata 37 "RADIO: Encryption engine is slow by default" found at the Errata document
for your device located at https://www.nordicsemi.com/DocLib */
if (errata_37()){
*(volatile uint32_t *)0x400005A0 = 0x3;
}
#endif
#if defined (DEVELOP_IN_NRF52832)
/* Workaround for Errata 57 "NFCT: NFC Modulation amplitude" found at the Errata document
for your device located at https://www.nordicsemi.com/DocLib */
if (errata_57()){
*(volatile uint32_t *)0x40005610 = 0x00000005;
*(volatile uint32_t *)0x40005688 = 0x00000001;
*(volatile uint32_t *)0x40005618 = 0x00000000;
*(volatile uint32_t *)0x40005614 = 0x0000003F;
}
#endif
/* Workaround for Errata 66 "TEMP: Linearity specification not met with default settings" found at the Errata document
for your device located at https://www.nordicsemi.com/DocLib */
if (errata_66()){
NRF_TEMP->A0 = NRF_FICR->TEMP.A0;
NRF_TEMP->A1 = NRF_FICR->TEMP.A1;
NRF_TEMP->A2 = NRF_FICR->TEMP.A2;
NRF_TEMP->A3 = NRF_FICR->TEMP.A3;
NRF_TEMP->A4 = NRF_FICR->TEMP.A4;
NRF_TEMP->A5 = NRF_FICR->TEMP.A5;
NRF_TEMP->B0 = NRF_FICR->TEMP.B0;
NRF_TEMP->B1 = NRF_FICR->TEMP.B1;
NRF_TEMP->B2 = NRF_FICR->TEMP.B2;
NRF_TEMP->B3 = NRF_FICR->TEMP.B3;
NRF_TEMP->B4 = NRF_FICR->TEMP.B4;
NRF_TEMP->B5 = NRF_FICR->TEMP.B5;
NRF_TEMP->T0 = NRF_FICR->TEMP.T0;
NRF_TEMP->T1 = NRF_FICR->TEMP.T1;
NRF_TEMP->T2 = NRF_FICR->TEMP.T2;
NRF_TEMP->T3 = NRF_FICR->TEMP.T3;
NRF_TEMP->T4 = NRF_FICR->TEMP.T4;
}
/* Workaround for Errata 103 "CCM: Wrong reset value of CCM MAXPACKETSIZE" found at the Errata document
for your device located at https://www.nordicsemi.com/DocLib */
if (errata_103()){
NRF_CCM->MAXPACKETSIZE = 0xFBul;
}
#if defined (DEVELOP_IN_NRF52832)
/* Workaround for Errata 108 "RAM: RAM content cannot be trusted upon waking up from System ON Idle or System OFF mode" found at the Errata document
for your device located at https://www.nordicsemi.com/DocLib */
if (errata_108()){
*(volatile uint32_t *)0x40000EE4 = *(volatile uint32_t *)0x10000258 & 0x0000004F;
}
#endif
/* Workaround for Errata 136 "System: Bits in RESETREAS are set when they should not be" found at the Errata document
for your device located at https://www.nordicsemi.com/DocLib */
if (errata_136()){
if (NRF_POWER->RESETREAS & POWER_RESETREAS_RESETPIN_Msk){
NRF_POWER->RESETREAS = ~POWER_RESETREAS_RESETPIN_Msk;
}
}
#if defined (DEVELOP_IN_NRF52832)
/* Workaround for Errata 182 "RADIO: Fixes for anomalies #102, #106, and #107 do not take effect" found at the Errata document
for your device located at https://www.nordicsemi.com/DocLib */
if (errata_182()){
*(volatile uint32_t *) 0x4000173C |= (0x1 << 10);
}
#endif
/* Configure GPIO pads as pPin Reset pin if Pin Reset capabilities desired. If CONFIG_GPIO_AS_PINRESET is not
defined, pin reset will not be available. One GPIO (see Product Specification to see which one) will then be
reserved for PinReset and not available as normal GPIO. */
#if defined (CONFIG_GPIO_AS_PINRESET)
if (((NRF_UICR->PSELRESET[0] & UICR_PSELRESET_CONNECT_Msk) != (UICR_PSELRESET_CONNECT_Connected << UICR_PSELRESET_CONNECT_Pos)) ||
((NRF_UICR->PSELRESET[1] & UICR_PSELRESET_CONNECT_Msk) != (UICR_PSELRESET_CONNECT_Connected << UICR_PSELRESET_CONNECT_Pos))){
NRF_NVMC->CONFIG = NVMC_CONFIG_WEN_Wen << NVMC_CONFIG_WEN_Pos;
while (NRF_NVMC->READY == NVMC_READY_READY_Busy){}
NRF_UICR->PSELRESET[0] = 21;
while (NRF_NVMC->READY == NVMC_READY_READY_Busy){}
NRF_UICR->PSELRESET[1] = 21;
while (NRF_NVMC->READY == NVMC_READY_READY_Busy){}
NRF_NVMC->CONFIG = NVMC_CONFIG_WEN_Ren << NVMC_CONFIG_WEN_Pos;
while (NRF_NVMC->READY == NVMC_READY_READY_Busy){}
NVIC_SystemReset();
}
#endif
SystemCoreClockUpdate();
}
开发者ID:abtink,项目名称:openthread,代码行数:101,代码来源:system_nrf52810.c
示例6: pyb_hard_reset
/// \function hard_reset()
/// Resets the pyboard in a manner similar to pushing the external RESET
/// button.
STATIC mp_obj_t pyb_hard_reset(void) {
NVIC_SystemReset();
return mp_const_none;
}
开发者ID:A-L-E-X,项目名称:micropython,代码行数:7,代码来源:modpyb.c
示例7: main
int
main (void)
{
/* accelerometer readings fifo */
TFifoEntry acc_lowpass;
TFifoEntry fifo_buf[FIFO_DEPTH];
int fifo_pos;
TFifoEntry *fifo;
uint32_t SSPdiv;
uint16_t oid_last_seen;
uint8_t cmd_buffer[64], cmd_pos, c;
uint8_t volatile *uart;
int x, y, z, moving;
volatile int t;
int i;
/* wait on boot - debounce */
for (t = 0; t < 2000000; t++);
/* Initialize GPIO (sets up clock) */
GPIOInit ();
/* initialize pins */
pin_init ();
/* fire up LED 1 */
GPIOSetValue (1, 1, 1);
/* initialize SPI */
spi_init ();
/* read device UUID */
bzero (&device_uuid, sizeof (device_uuid));
iap_read_uid (&device_uuid);
tag_id = crc16 ((uint8_t *) & device_uuid, sizeof (device_uuid));
random_seed =
device_uuid[0] ^ device_uuid[1] ^ device_uuid[2] ^ device_uuid[3];
/************ IF Plugged to computer upon reset ? ******************/
if (GPIOGetValue (0, 3))
{
/* wait some time till Bluetooth is off */
for (t = 0; t < 2000000; t++);
/* Init 3D acceleration sensor */
acc_init (1);
/* Init Flash Storage with USB */
storage_init (TRUE, tag_id);
g_storage_items = storage_items ();
/* Init Bluetooth */
bt_init (TRUE, tag_id);
/* switch to LED 2 */
GPIOSetValue (1, 1, 0);
GPIOSetValue (1, 2, 1);
/* set command buffer to empty */
cmd_pos = 0;
/* spin in loop */
while (1)
{
/* reset after USB unplug */
if (!GPIOGetValue (0, 3))
NVIC_SystemReset ();
/* if UART rx send to menue */
if (UARTCount)
{
/* blink LED1 upon Bluetooth command */
GPIOSetValue (1, 1, 1);
/* execute menue command with last character received */
/* scan through whole UART buffer */
uart = UARTBuffer;
for (i = UARTCount; i > 0; i--)
{
UARTCount--;
c = *uart++;
if ((c < ' ') && cmd_pos)
{
/* if one-character command - execute */
if (cmd_pos == 1)
main_menue (cmd_buffer[0]);
else
{
cmd_buffer[cmd_pos] = 0;
debug_printf
("Unknown command '%s' - please press H+[Enter] for help\n# ",
cmd_buffer);
}
/* set command buffer to empty */
cmd_pos = 0;
}
else if (cmd_pos < (sizeof (cmd_buffer) - 2))
cmd_buffer[cmd_pos++] = c;
}
//.........这里部分代码省略.........
开发者ID:KhMassri,项目名称:DTNWorkspace,代码行数:101,代码来源:main_tx.c
示例8: sldReviveCallback
static void sldReviveCallback(WM_MESSAGE* pMsg)
{
const WM_KEY_INFO* pKeyInfo;
WM_MESSAGE myMsg;
switch(pMsg->MsgId)
{
case WM_KEY:
pKeyInfo = (WM_KEY_INFO*)pMsg->Data.p;
switch(pKeyInfo->Key)
{
case GUI_KEY_RIGHT:
case GUI_KEY_ENTER:
myMsg.hWin = WM_GetClientWindow(confirmWin);
myMsg.hWinSrc = pMsg->hWin;
myMsg.MsgId = USER_MSG_CHOOSE;
myMsg.Data.v = SYS_REVIVE;
WM_SendMessage(myMsg.hWin, &myMsg);
WM_BringToTop(confirmWin);
WM_SetFocus(WM_GetDialogItem(confirmWin, GUI_ID_BUTTON0));
break;
case GUI_KEY_BACKSPACE:
if(Mem_isEqual(&SysConf, &agentConf, sizeof(SysConf)) )
{
WM_SetFocus(Slideres[0]);
WM_SetFocus(menuWin);
}
else
{
myMsg.hWin = WM_GetClientWindow(confirmWin);
myMsg.hWinSrc = subWins[3];
myMsg.MsgId = USER_MSG_CHOOSE;
myMsg.Data.v = SYS_SETTING;
WM_SendMessage(myMsg.hWin, &myMsg);
WM_BringToTop(confirmWin);
WM_SetFocus(WM_GetDialogItem (confirmWin,GUI_ID_BUTTON0));
}
break;
default:
HSD_SLIDER_Callback(pMsg);
break;
}
break;
case USER_MSG_REPLY:
WM_SetFocus(Slideres[0]);
WM_BringToTop(subWins[3]);
if(pMsg->Data.v == REPLY_OK )
{
if(SysConf.Skin != DEFAULT_SKIN)
{
myMsg.MsgId = USER_MSG_SKIN;
myMsg.Data.v = DEFAULT_SKIN;
WM_BroadcastMessage(&myMsg);
agentConf.Skin = SysConf.Skin;
}
if(SysConf.Shape != DEFAULT_SHAPE)
{
myMsg.hWin = mapWin;
myMsg.MsgId = USER_MSG_SHAPE;
myMsg.Data.v = DEFAULT_SHAPE;
WM_SendMessage(myMsg.hWin, &myMsg);
agentConf.Shape = SysConf.Shape;
}
sysRevive();
HSD_SLIDER_SetValue(Slideres[0], SysConf.Skin);
HSD_SLIDER_SetValue(Slideres[5], 0);
GUI_Delay(1000);
HSD_SLIDER_SetValue(Slideres[1], SysConf.Brt);
HSD_SLIDER_SetValue(Slideres[5], 1);
GUI_Delay(1000);
HSD_SLIDER_SetValue(Slideres[2], SysConf.Vol);
HSD_SLIDER_SetValue(Slideres[5], 2);
GUI_Delay(1000);
HSD_SLIDER_SetValue(Slideres[3], SysConf.Unit);
HSD_SLIDER_SetValue(Slideres[5], 3);
GUI_Delay(1000);
HSD_SLIDER_SetValue(Slideres[4], SysConf.Shape);
HSD_SLIDER_SetValue(Slideres[5], 4);
GUI_Delay(1000);
HSD_SLIDER_SetValue(Slideres[5], 0);
NVIC_SystemReset();
}
break;
default:
//.........这里部分代码省略.........
开发者ID:SealedGhost,项目名称:AM128A-PCB5.5,代码行数:101,代码来源:subWin3.c
示例9: AT_Parse
//.........这里部分代码省略.........
case AT_PRODUCT_REV:
if (AT_argc == 0) {
if (TD_FLASH_DeviceRead(&device)) {
AT_printf("%02X\r\n", device.ProdResult);
} else {
result = AT_ERROR;
}
} else {
result = AT_ERROR;
}
break;
case AT_QUERY_BANNER:
if (AT_argc != 0) {
result = AT_ERROR;
} else {
AT_printf("0..1\r\n");
}
break;
case AT_RELEASE_DATE:
if (AT_argc == 0) {
AT_printf("%s\r\n", CONFIG_RELEASE_DATE);
} else {
result = AT_ERROR;
}
break;
case AT_RESET:
if (AT_argc == 0) {
AT_PrintResult(result);
TD_RTC_Delay(T100MS);
NVIC_SystemReset();
} else {
result = AT_ERROR;
}
break;
case AT_SERIAL_NUMBER:
if (AT_argc == 0) {
TD_FLASH_DeviceRead(&device);
AT_printf("%04X\r\n", device.Serial);
if (TD_FLASH_DeviceReadExtended(&device, &device_ext) == true) {
for (i = 0; i < 12; i++) {
td_serial[i] = device_ext.TDSerial[i];
}
td_serial[12] = '\0';
tfp_printf("TDID: %12s\r\n", td_serial);
}
} else {
result = AT_ERROR;
}
break;
case AT_SET_BANNER:
if (AT_argc == 1) {
banner = AT_atoll(AT_argv[0]);
if (banner > 1) {
result = AT_ERROR;
} else {
AT_banner = banner;
}
} else {
result = AT_ERROR;
}
开发者ID:jeromegros,项目名称:TD1208,代码行数:67,代码来源:at_parse.c
示例10: COMMAND_JUMP
/**
* @brief IAP jump to user program
* @param None
* @retval None
*/
void COMMAND_JUMP(void)
{
/* Software reset */
NVIC_SystemReset();
}
开发者ID:nguyentri,项目名称:UsbApplication,代码行数:10,代码来源:command.c
示例11: __reset_hardware
__reset_hardware()
{
NVIC_SystemReset();
}
开发者ID:colossus212,项目名称:RM_Driver,代码行数:4,代码来源:_reset_hardware.c
示例12: bootloader_restart
void bootloader_restart( void )
{
NVIC_SystemReset();
while(1){}
}
开发者ID:ngwese,项目名称:crow,代码行数:5,代码来源:bootloader.c
示例13: ResetMCU
/************************************************************************************
*************************************************************************************
* Public functions
*************************************************************************************
************************************************************************************/
void ResetMCU(void)
{
NVIC_SystemReset();
while(1);
}
开发者ID:Indemsys,项目名称:K66BLEZ1,代码行数:10,代码来源:Reset.c
示例14: stm32_interface_reset
vsf_err_t stm32_interface_reset(void *p)
{
NVIC_SystemReset();
return VSFERR_NONE;
}
开发者ID:kevin988,项目名称:vsf,代码行数:5,代码来源:core.c
示例15: app_error_handler
void app_error_handler(uint32_t error_code, uint32_t line_num, const uint8_t * p_file_name)
{
nrf_gpio_pin_clear(ASSERT_LED_PIN_NO);
NVIC_SystemReset();
}
开发者ID:ThoughtWorkshop,项目名称:eggBeacon,代码行数:6,代码来源:main_pxp.c
示例16: SystemInit
void SystemInit(void)
{
/* Workaround for Errata 16 "System: RAM may be corrupt on wakeup from CPU IDLE" found at the Errata document
for your device located at https://infocenter.nordicsemi.com/ */
if (errata_16()){
*(volatile uint32_t *)0x4007C074 = 3131961357ul;
}
/* Workaround for Errata 31 "CLOCK: Calibration values are not correctly loaded from FICR at reset" found at the Errata document
for your device located at https://infocenter.nordicsemi.com/ */
if (errata_31()){
*(volatile uint32_t *)0x4000053C = ((*(volatile uint32_t *)0x10000244) & 0x0000E000) >> 13;
}
/* Workaround for Errata 32 "DIF: Debug session automatically enables TracePort pins" found at the Errata document
for your device located at https://infocenter.nordicsemi.com/ */
if (errata_32()){
CoreDebug->DEMCR &= ~CoreDebug_DEMCR_TRCENA_Msk;
}
/* Workaround for Errata 36 "CLOCK: Some registers are not reset when expected" found at the Errata document
for your device located at https://infocenter.nordicsemi.com/ */
if (errata_36()){
NRF_CLOCK->EVENTS_DONE = 0;
NRF_CLOCK->EVENTS_CTTO = 0;
NRF_CLOCK->CTIV = 0;
}
/* Workaround for Errata 37 "RADIO: Encryption engine is slow by default" found at the Errata document
for your device located at https://infocenter.nordicsemi.com/ */
if (errata_37()){
*(volatile uint32_t *)0x400005A0 = 0x3;
}
/* Workaround for Errata 57 "NFCT: NFC Modulation amplitude" found at the Errata document
for your device located at https://infocenter.nordicsemi.com/ */
if (errata_57()){
*(volatile uint32_t *)0x40005610 = 0x00000005;
*(volatile uint32_t *)0x40005688 = 0x00000001;
*(volatile uint32_t *)0x40005618 = 0x00000000;
*(volatile uint32_t *)0x40005614 = 0x0000003F;
}
/* Workaround for Errata 66 "TEMP: Linearity specification not met with default settings" found at the Errata document
for your device located at https://infocenter.nordicsemi.com/ */
if (errata_66()){
NRF_TEMP->A0 = NRF_FICR->TEMP.A0;
NRF_TEMP->A1 = NRF_FICR->TEMP.A1;
NRF_TEMP->A2 = NRF_FICR->TEMP.A2;
NRF_TEMP->A3 = NRF_FICR->TEMP.A3;
NRF_TEMP->A4 = NRF_FICR->TEMP.A4;
NRF_TEMP->A5 = NRF_FICR->TEMP.A5;
NRF_TEMP->B0 = NRF_FICR->TEMP.B0;
NRF_TEMP->B1 = NRF_FICR->TEMP.B1;
NRF_TEMP->B2 = NRF_FICR->TEMP.B2;
NRF_TEMP->B3 = NRF_FICR->TEMP.B3;
NRF_TEMP->B4 = NRF_FICR->TEMP.B4;
NRF_TEMP->B5 = NRF_FICR->TEMP.B5;
NRF_TEMP->T0 = NRF_FICR->TEMP.T0;
NRF_TEMP->T1 = NRF_FICR->TEMP.T1;
NRF_TEMP->T2 = NRF_FICR->TEMP.T2;
NRF_TEMP->T3 = NRF_FICR->TEMP.T3;
NRF_TEMP->T4 = NRF_FICR->TEMP.T4;
}
/* Enable the FPU if the compiler used floating point unit instructions. __FPU_USED is a MACRO defined by the
* compiler. Since the FPU consumes energy, remember to disable FPU use in the compiler if floating point unit
* operations are not used in your code. */
#if (__FPU_USED == 1)
SCB->CPACR |= (3UL << 20) | (3UL << 22);
__DSB();
__ISB();
#endif
/* Configure NFCT pins as GPIOs if NFCT is not to be used in your code. If CONFIG_NFCT_PINS_AS_GPIOS is not defined,
two GPIOs (see Product Specification to see which ones) will be reserved for NFC and will not be available as
normal GPIOs. */
#if defined (CONFIG_NFCT_PINS_AS_GPIOS)
if ((NRF_UICR->NFCPINS & UICR_NFCPINS_PROTECT_Msk) == (UICR_NFCPINS_PROTECT_NFC << UICR_NFCPINS_PROTECT_Pos)){
NRF_NVMC->CONFIG = NVMC_CONFIG_WEN_Wen << NVMC_CONFIG_WEN_Pos;
while (NRF_NVMC->READY == NVMC_READY_READY_Busy){}
NRF_UICR->NFCPINS &= ~UICR_NFCPINS_PROTECT_Msk;
while (NRF_NVMC->READY == NVMC_READY_READY_Busy){}
NRF_NVMC->CONFIG = NVMC_CONFIG_WEN_Ren << NVMC_CONFIG_WEN_Pos;
while (NRF_NVMC->READY == NVMC_READY_READY_Busy){}
NVIC_SystemReset();
}
#endif
/* Configure GPIO pads as pPin Reset pin if Pin Reset capabilities desired. If CONFIG_GPIO_AS_PINRESET is not
defined, pin reset will not be available. One GPIO (see Product Specification to see which one) will then be
reserved for PinReset and not available as normal GPIO. */
#if defined (CONFIG_GPIO_AS_PINRESET)
if (((NRF_UICR->PSELRESET[0] & UICR_PSELRESET_CONNECT_Msk) != (UICR_PSELRESET_CONNECT_Connected << UICR_PSELRESET_CONNECT_Pos)) ||
((NRF_UICR->PSELRESET[1] & UICR_PSELRESET_CONNECT_Msk) != (UICR_PSELRESET_CONNECT_Connected << UICR_PSELRESET_CONNECT_Pos))){
NRF_NVMC->CONFIG = NVMC_CONFIG_WEN_Wen << NVMC_CONFIG_WEN_Pos;
while (NRF_NVMC->READY == NVMC_READY_READY_Busy){}
NRF_UICR->PSELRESET[0] = 21;
while (NRF_NVMC->READY == NVMC_READY_READY_Busy){}
NRF_UICR->PSELRESET[1] = 21;
//.........这里部分代码省略.........
开发者ID:AdySan,项目名称:arduino-nRF5,代码行数:101,代码来源:system_nrf52.c
示例17: main
/**
* \brief Main application
*/
int main(void)
{
uint32_t len;
uint32_t curr_prog_addr;
uint32_t tmp_len;
uint8_t buff[NVMCTRL_PAGE_SIZE];
struct nvm_config config;
/* Check switch state to enter boot mode or application mode */
check_boot_mode();
/*
* Application to be programmed from APP_START_ADDRESS defined in
* conf_bootloader.h
*/
curr_prog_addr = APP_START_ADDRESS;
/* Initialize system */
system_init();
/* Configure the SPI slave module */
configure_spi();
/* Get NVM default configuration and load the same */
nvm_get_config_defaults(&config);
config.manual_page_write = false;
nvm_set_config(&config);
/* Turn on LED */
port_pin_set_output_level(BOOT_LED, false);
/* Get the length to be programmed */
len = get_length();
do {
/* Get remaining or NVMCTRL_PAGE_SIZE as block length */
tmp_len = min(NVMCTRL_PAGE_SIZE, len);
/* Acknowledge last received data */
send_ack();
/* Read data from SPI master */
fetch_data(buff, tmp_len);
/* Program the data into Flash */
program_memory(curr_prog_addr, buff, tmp_len);
/* Increment the current programming address */
curr_prog_addr += tmp_len;
/* Update the length to remaining length to be programmed */
len -= tmp_len;
/* Do this for entire length */
} while (len != 0);
/* Acknowledge last block */
send_ack();
/* Reset module and boot into application */
NVIC_SystemReset();
while (1) {
/* Inf loop */
}
}
开发者ID:evarty,项目名称:Microcontroller,代码行数:70,代码来源:spi_slave_bootloader.c
示例18: machine_reset
// Resets the pyboard in a manner similar to pushing the external RESET button.
STATIC mp_obj_t machine_reset(void) {
NVIC_SystemReset();
return mp_const_none;
}
开发者ID:jaafarbarek,项目名称:pyrtos,代码行数:5,代码来源:modmachine.c
示例19: Soft_Reset
/*
* 系统软件复位
*/
void Soft_Reset(void)
{
__set_FAULTMASK(1); /* 关闭所有中断 */
NVIC_SystemReset(); /* 系统复位 */
}
开发者ID:WildfireTeamPRJ,项目名称:wildfire_stm32_iso,代码行数:8,代码来源:bsp_iso_test.c
示例20: sys_arch_reboot
void __weak sys_arch_reboot(int type)
{
ARG_UNUSED(type);
NVIC_SystemReset();
}
开发者ID:kraj,项目名称:zephyr,代码行数:6,代码来源:scb.c
注:本文中的NVIC_SystemReset函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论