43
300
900
高级技术员
使用特权
#define _MAIN_C_ #include "chip.h" #include "stdint.h" #include "main.h" #include "chip.h" #include "stdint.h" #include "board_pinmuxing.h" //#include "board_led.h" #include "glcd.h" #include "board_led.h" #include "utility.h"
#define TICKRATE_HZ1 (1)/* 1 ticks per second */ #define TICKRATE_HZ2 (2)/* 2 ticks per second */ #define PRESCALE_HZ2 (0xFFFF) /* 16-bit prescale count */ volatile uint32_t SYS_ms = 0; void SysTick_Handler ( void ) { SYS_ms++; }
void delay(int count) { int i=0; int j=0; for(i=0;i<count;i++) for(j=0;j<20000;j++); }
int32_t Board_LED_SetBitState ( uint32_t bitn, uint32_t sta ) { int32_t retval = 1; switch ( bitn ) { case 0: (sta > 0) ? Chip_GPIO_SetPinState(LPC_GPIO, 0, 30, true) : Chip_GPIO_SetPinState(LPC_GPIO, 0, 30, false); break;
case 1: (sta > 0) ? Chip_GPIO_SetPinState(LPC_GPIO, 0, 29, true) : Chip_GPIO_SetPinState(LPC_GPIO, 0, 29, false); break; case 2: (sta > 0) ? Chip_GPIO_SetPinState(LPC_GPIO, 0, 8, true) : Chip_GPIO_SetPinState(LPC_GPIO, 0, 8, false); break;
case 3: (sta > 0) ? Chip_GPIO_SetPinState(LPC_GPIO, 0, 7, true) : Chip_GPIO_SetPinState(LPC_GPIO, 0, 7, false); break; default: retval = 0; } return retval; }
int32_t main(void) { uint32_t timerBaseClock; // Setup SystemCoreClock and any needed board code SystemCoreClockUpdate(); SysTick_Config(SystemCoreClock/1000); Board_SetupMuxing(); Board_LED_Init ();
while (1) { delay(1000); Board_LED_SetBitState ( 0, 1 ); delay(1000); Board_LED_SetBitState ( 1, 1 ); //Board_LED_SetBitState ( 1, 0 ); delay(1000); Board_LED_SetBitState ( 2, 1 ); delay(1000); Board_LED_SetBitState ( 3, 1 ); // Board_LED_SetBitState ( 1, 1 ); // Board_LED_SetBitState ( 2, 1 ); delay(1000);
Board_LED_SetBitState ( 0, 0 ); delay(1000); Board_LED_SetBitState ( 1, 0 ); //Board_LED_SetBitState ( 1, 0 ); delay(1000); Board_LED_SetBitState ( 2, 0 ); delay(1000); Board_LED_SetBitState ( 3, 0 ); // Board_LED_SetBitState ( 1, 1 ); // Board_LED_SetBitState ( 2, 0 ); } }
发表回复 本版积分规则 回帖后跳转到最后一页
1
扫码关注 21ic 官方微信
扫码关注嵌入式微处理器
扫码关注21ic项目外包
扫码关注21ic视频号
扫码关注21ic抖音号
本站介绍 | 申请友情链接 | 欢迎投稿 | 隐私声明 | 广告业务 | 网站地图 | 联系我们 | 诚聘英才 | 论坛帮助
京公网安备 11010802024343号