在线时间1019 小时
UID299704
注册时间2011-6-18
NXP金币2139
TA的每日心情 | 开心 6 天前 |
---|
签到天数: 1334 天 [LV.10]以坛为家III
版主
- 积分
- 9022
- 最后登录
- 2024-3-29
|
【智能家居挑战赛】我的节约行动之构建IAR开发环境
笔者使用windows系统下IAR+VScode+git的开发环境。编程所使用的SDK来自NXP官方,但考虑到其冗余的兼容性,对其代码进行了删减,保留了仅针对LPC51U68芯片及IAR环境上的代码部分与配置。
在部署的过程中,发现官方SDK对其代码仍有部分源代码未开放,原因并未探究。
我们将时钟配置为150MHz,并启动LED闪烁功能。
LED灯引脚初始化源代码:
- void front_led_init(void)
- {
- CLOCK_EnableClock(kCLOCK_Iocon); /* Enables the clock for the IOCON block. 0 = Disable; 1 = Enable.: 0x01u */
- CLOCK_EnableClock(kCLOCK_Gpio1); /* Enables the clock for the GPIO1 port registers. 0 = Disable; 1 = Enable. */
- gpio_pin_config_t LED_BLUE_io_config = {/* PORT1 PIN9 (number: 29) GPIO configuration structure */
- .pinDirection = kGPIO_DigitalOutput,
- .outputLogic = 1U};
- GPIO_PinInit(GPIO, 1, 9, &LED_BLUE_io_config); /* Initialize GPIO functionality on pin PIO1_9 (number: 29) */
- const uint32_t LED_BLUE_pin_config = (
- IOCON_FUNC0 | /* Pin is configured as PIO1_9 */
- IOCON_DIGITAL_EN | /* Enables digital function */
- IOCON_PIO_INPFILT_OFF | /* Input filter disabled */
- IOCON_PIO_SLEW_STANDARD | /* Standard mode, output slew rate control is enabled */
- IOCON_OPENDRAIN_EN
- );
- IOCON_PinMuxSet(IOCON, 1, 9, LED_BLUE_pin_config); /* PORT1 PIN9 (number: 29) is configured as PIO1_9 */
- }
复制代码 主程序源代码:
- void main(void)
- {
- main_clock_init();
- SysTick_Config(SystemCoreClock / 1000);
- front_led_init();
- sys_timeouts_init();
- while (1)
- {
- sys_check_timeouts();
- // __WFI;
- }
- }
复制代码 详解全部工程源代码请参考git:
https://gitee.com/jobszheng5/evk51u68
这款高性能MCU还是非常优秀的。
|
|