關(guān)注+星標(biāo)公眾號(hào),不錯(cuò)過精彩內(nèi)容

作者 | strongerHuang

cm3.h與cm85.h

雖然,左側(cè)“紅色”比較多,但大部分都是多出來的行數(shù)以及宏定義。仔細(xì)對(duì)比,其實(shí)很多都是一樣的,比如我們常用的系統(tǒng)復(fù)位函數(shù):

__NO_RETURN __STATIC_INLINE void __NVIC_SystemReset(void){__DSB(); /* Ensure all outstanding memory accesses includedbuffered write are completed before reset */SCB->AIRCR = (uint32_t)((0x5FAUL << SCB_AIRCR_VECTKEY_Pos) |(SCB->AIRCR & SCB_AIRCR_PRIGROUP_Msk) |SCB_AIRCR_SYSRESETREQ_Msk ); /* Keep priority group unchanged */__DSB(); /* Ensure completion of memory access */for(;;) /* wait until reset */{__NOP();}}

__STATIC_INLINE uint32_t SysTick_Config(uint32_t ticks){if ((ticks - 1UL) > SysTick_LOAD_RELOAD_Msk){return (1UL); /* Reload value impossible */}SysTick->LOAD = (uint32_t)(ticks - 1UL); /* set reload register */NVIC_SetPriority (SysTick_IRQn, (1UL << __NVIC_PRIO_BITS) - 1UL); /* set Priority for Systick Interrupt */SysTick->VAL = 0UL; /* Load the SysTick Counter Value */SysTick->CTRL = SysTick_CTRL_CLKSOURCE_Msk |SysTick_CTRL_TICKINT_Msk |SysTick_CTRL_ENABLE_Msk; /* Enable SysTick IRQ and SysTick Timer */return (0UL); /* Function successful */}
Cortex-M85單片機(jī)SysTick












while(1){R_PORT10->PODR ^= 1<<(BSP_IO_PORT_10_PIN_01 & 0xFF); //PA01亮滅翻轉(zhuǎn)R_BSP_SoftwareDelay(1, BSP_DELAY_UNITS_MILLISECONDS); //SysTick延時(shí)}



PODR ^= 1<<(BSP_IO_PORT_10_PIN_01 & 0xFF);R_BSP_SoftwareDelay(1, BSP_DELAY_UNITS_MILLISECONDS);typedef enum{BSP_DELAY_UNITS_SECONDS = 1000000, ///< Requested delay amount is in secondsBSP_DELAY_UNITS_MILLISECONDS = 1000, ///< Requested delay amount is in millisecondsBSP_DELAY_UNITS_MICROSECONDS = 1 ///< Requested delay amount is in microseconds} bsp_delay_units_t;

