资源简介

考虑到官网给的都是IAR工程,自己又习惯Keil开发环境,在网上检索了下LPC1768+FreeRTOS的Keil工程几乎没有,只能亲力亲为了,以方便以后平台组合功能块的开发移植,并将FreeRTOS+LPC1768功能实例源码上传以便分享。

资源截图

代码片段和文件信息

#include “stdint.h“
#include “channel.h“
#include “lpc17xx_pinsel.h“
#include “lpc17xx_gpio.h“

/* 定义通道号(必须连续) */
typedef enum{
    CHN_A_NUM       = ‘A‘
    CHN_B_NUM       = ‘B‘
    CHN_C_NUM       = ‘C‘
    CHN_D_NUM       = ‘D‘
CHN_F_NUM = ‘F‘//4个端口同时控制
} CHN_NUM;

void setPinPortFunc(uint8_t portuint8_t pinuint8_t value){
PINSEL_CFG_Type PinCfg;

    PinCfg.Funcnum = 0;
    PinCfg.OpenDrain = 0;
    PinCfg.Pinmode = 0;

PinCfg.Portnum = port;

PinCfg.Pinnum = pin;
PINSEL_ConfigPin(&PinCfg);

GPIO_SetDir(port(1< if(value == 0){
GPIO_ClearValue(port(1< }else{
GPIO_SetValue(port(1< }
}
void setPinPortValue(uint8_t portuint8_t pinuint8_t value){
if(value == 0){
GPIO_ClearValue(port(1< }else{
GPIO_SetValue(port(1< }
}

void channel_pin_init(void){
// 设置P0[20 21 22]P2[0] 为GPIO 且为低默认断开红灯
setPinPortFunc(DEVICE_A_PORTDEVICE_A_PIN0);
setPinPortFunc(DEVICE_B_PORTDEVICE_B_PIN0);
setPinPortFunc(DEVICE_C_PORTDEVICE_C_PIN0);
setPinPortFunc(DEVICE_D_PORTDEVICE_D_PIN0);
}


/* 通道设置 */
void channel_set(unsigned char ucChn unsigned char ucState)
{
    //if(ucState == TRUE)      // 通道开
switch(ucChn)
{
case CHN_A_NUM:     // 通道A
setPinPortValue(DEVICE_A_PORTDEVICE_A_PINucState);
break;
case CHN_B_NUM:     // 通道B
setPinPortValue(DEVICE_B_PORTDEVICE_B_PINucState);
break;
case CHN_C_NUM:     // 通道C
setPinPortValue(DEVICE_C_PORTDEVICE_C_PINucState);
break;
case CHN_D_NUM:     // 通道D
setPinPortValue(DEVICE_D_PORTDEVICE_D_PINucState);
break;
case CHN_F_NUM:     // 4个通道F
setPinPortValue(DEVICE_A_PORTDEVICE_A_PINucState);
setPinPortValue(DEVICE_B_PORTDEVICE_B_PINucState);
setPinPortValue(DEVICE_C_PORTDEVICE_C_PINucState);
setPinPortValue(DEVICE_D_PORTDEVICE_D_PINucState);
break;
default :
break;
}
}

/* 通道初始化 */
void channel_init(void)
{
channel_pin_init();
}


 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----

     文件       2049  2018-03-05 15:01  newproject\APP\channel.c

     文件        386  2018-01-06 10:20  newproject\APP\channel.h

     文件       2199  2018-03-05 16:02  newproject\APP\main.c

     文件      19029  2018-03-05 15:32  newproject\APP\uartx.c

     文件       1224  2018-01-05 16:05  newproject\APP\uartx.h

     文件      28771  2014-01-20 10:07  newproject\CMSIS\core_cm3.c

     文件      64932  2014-01-20 10:07  newproject\CMSIS\core_cm3.h

     文件      38542  2018-03-05 14:52  newproject\CMSIS\LPC17xx.h

     文件      10843  2018-03-05 15:18  newproject\CMSIS\startup_LPC17xx.s

     文件      23817  2018-03-05 13:40  newproject\CMSIS\system_LPC17xx.c

     文件       2221  2014-01-20 10:07  newproject\CMSIS\system_LPC17xx.h

     文件      14889  2010-03-14 04:38  newproject\FreeRTOS\croutine.c

     文件      28495  2010-03-14 04:38  newproject\FreeRTOS\include\croutine.h

     文件      14334  2010-03-14 04:38  newproject\FreeRTOS\include\FreeRTOS.h

     文件       7621  2018-03-01 15:00  newproject\FreeRTOS\include\FreeRTOSConfig.h

     文件      13033  2010-03-14 04:38  newproject\FreeRTOS\include\list.h

     文件       6585  2010-03-14 04:38  newproject\FreeRTOS\include\mpu_wrappers.h

     文件      12179  2016-11-30 10:15  newproject\FreeRTOS\include\portable.h

     文件       3699  2010-03-14 04:38  newproject\FreeRTOS\include\projdefs.h

     文件      43833  2010-03-14 04:38  newproject\FreeRTOS\include\queue.h

     文件      28131  2016-12-05 08:55  newproject\FreeRTOS\include\semphr.h

     文件       9217  2010-03-14 04:38  newproject\FreeRTOS\include\StackMacros.h

     文件      44864  2018-03-05 14:25  newproject\FreeRTOS\include\task.h

     文件       8289  2010-04-20 20:45  newproject\FreeRTOS\list.c

     文件       5963  2010-03-14 04:38  newproject\FreeRTOS\portable\MemMang\heap_1.c

     文件      11104  2010-03-14 04:38  newproject\FreeRTOS\portable\MemMang\heap_2.c

     文件       4527  2010-03-14 04:38  newproject\FreeRTOS\portable\MemMang\heap_3.c

     文件          0  2010-04-22 09:52  newproject\FreeRTOS\portable\MemMang\mylib.h

     文件      10156  2010-03-14 19:38  newproject\FreeRTOS\portable\RVDS\ARM_CM3\port.c

     文件       5634  2010-03-14 19:38  newproject\FreeRTOS\portable\RVDS\ARM_CM3\portmacro.h

............此处省略86个文件信息

评论

共有 条评论