新手,刚刚接触stm32,有一块onenet迷你板。
用以下代码点亮灯 led2。
编译未报错,但是灯就是不亮。
#include "stm32f10x.h"
int main(void)
{
RCC_APB2ENR |= ((1) << 3);
GPIOB_CRL &= ~(0x0f << (4*6)); //先清零
GPIOB_CRL |= (1 << (4*6));
GPIOB_ODR &= ~(1 << 6);
}
void SystemInit(void)
{
}
//stm32f10x.h
//外设 peripheral
#define PERIPH_BASE ((unsigned int*)0x40000000)
#define APB1PERIPH_BASE PERIPH_BASE
#define APB2PERIPH_BASE (PERIPH_BASE + 0x10000)
#define AHBPERIPH_BASE (PERIPH_BASE + 0x20000)
#define RCC_BASE (AHBPERIPH_BASE + 0x1000)
#define GPIOB_BASE (APB2PERIPH_BASE + 0x0C00)
#define RCC_APB2ENR *(unsigned int*)(RCC_BASE + 0x18)
#define GPIOB_CRL *(unsigned int*)(GPIOB_BASE + 0x00)
#define GPIOB_CRH *(unsigned int*)(GPIOB_BASE + 0x04)
#define GPIOB_ODR *(unsigned int*)(GPIOB_BASE + 0x0C) |