本文整理汇总了C++中NVIC_SystemReset函数的典型用法代码示例。如果您正苦于以下问题:C++ NVIC_SystemReset函数的具体用法?C++ NVIC_SystemReset怎么用?C++ NVIC_SystemReset使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了NVIC_SystemReset函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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;
//.........这里部分代码省略.........
示例2: reboot
static void reboot(uint8_t argc, char **argv) {
NVIC_SystemReset();
}
示例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();
}
示例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;
}
示例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();
}
示例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;
}
示例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;
}
//.........这里部分代码省略.........
示例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:
//.........这里部分代码省略.........
示例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;
}
示例10: COMMAND_JUMP
/**
* @brief IAP jump to user program
* @param None
* @retval None
*/
void COMMAND_JUMP(void)
{
/* Software reset */
NVIC_SystemReset();
}
示例11: __reset_hardware
__reset_hardware()
{
NVIC_SystemReset();
}
示例12: bootloader_restart
void bootloader_restart( void )
{
NVIC_SystemReset();
while(1){}
}
示例13: ResetMCU
/************************************************************************************
*************************************************************************************
* Public functions
*************************************************************************************
************************************************************************************/
void ResetMCU(void)
{
NVIC_SystemReset();
while(1);
}
示例14: stm32_interface_reset
vsf_err_t stm32_interface_reset(void *p)
{
NVIC_SystemReset();
return VSFERR_NONE;
}
示例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();
}