74 gpio_setup[2].cfg.pin =
INV_PIN;
79 int i, gpio_count =
sizeof(gpio_setup) /
sizeof(gpio_setup[0]);
99 #define AFIO_MAPR_SWJ_CFG_NO_JTAG_SW (0x2 << 24) 105 for (i = 0; i < gpio_count; i++) {
106 gpioInit(gpio_setup[i].gpio, &gpio_setup[i].cfg);
123 while(
micros() < (now + us));
141 return *((uint16_t *)
BKP_BASE + 0x04) | *((uint16_t *)
BKP_BASE + 0x08) << 16;
149 *((uint16_t *)
BKP_BASE + 0x04) = value & 0xffff;
150 *((uint16_t *)
BKP_BASE + 0x08) = (value & 0xffff0000) >> 16;
153 #define AIRCR_VECTKEY_MASK ((uint32_t)0x05FA0000) 160 *((uint32_t *)0x20004FF0) = 0xDEADBEEF;
#define NVIC_PriorityGroup_4
void rccWriteBkpDr(uint32_t value)
void NVIC_PriorityGroupConfig(uint32_t NVIC_PriorityGroup)
Configures the priority grouping: pre-emption priority and subpriority.
void RCC_APB1PeriphClockCmd(uint32_t RCC_APB1Periph, FunctionalState NewState)
Enables or disables the Low Speed APB (APB1) peripheral clock.
#define RCC_APB2Periph_USART1
static void cycleCounterInit(void)
#define RCC_APB2Periph_GPIOB
__STATIC_INLINE void NVIC_SetPriority(IRQn_Type IRQn, uint32_t priority)
Set Interrupt Priority.
void RCC_APB2PeriphClockCmd(uint32_t RCC_APB2Periph, FunctionalState NewState)
Enables or disables the High Speed APB (APB2) peripheral clock.
void gpioInit(GPIO_TypeDef *gpio, gpio_config_t *config)
#define RCC_APB1Periph_TIM2
#define RCC_APB2Periph_TIM1
#define RCC_APB2Periph_ADC1
#define RCC_APB1Periph_TIM3
#define AFIO_MAPR_SWJ_CFG_NO_JTAG_SW
#define RCC_AHBPeriph_DMA1
#define RCC_APB1Periph_PWR
#define AIRCR_VECTKEY_MASK
#define RCC_APB1Periph_TIM4
#define RCC_APB2Periph_AFIO
__STATIC_INLINE uint32_t SysTick_Config(uint32_t ticks)
System Tick Configuration.
#define RCC_APB2Periph_GPIOA
void delayMicroseconds(uint32_t us)
static volatile uint64_t sysTickUptime
#define RCC_APB1Periph_BKP
void SysTick_Handler(void)
void RCC_ClearFlag(void)
Clears the RCC reset flags. The reset flags are: RCC_FLAG_PINRST, RCC_FLAG_PORRST, RCC_FLAG_SFTRST, RCC_FLAG_IWDGRST, RCC_FLAG_WWDGRST, RCC_FLAG_LPWRRST.
void RCC_AHBPeriphClockCmd(uint32_t RCC_AHBPeriph, FunctionalState NewState)
Enables or disables the AHB peripheral clock.
uint32_t rccReadBkpDr(void)
#define RCC_APB2Periph_GPIOC
void RCC_GetClocksFreq(RCC_ClocksTypeDef *RCC_Clocks)
Returns the frequencies of different on chip clocks; SYSCLK, HCLK, PCLK1 and PCLK2.
void systemReset(bool toBootloader)