-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
128 changed files
with
92,164 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,142 @@ | ||
/*! | ||
* COPYRIGHT NOTICE | ||
* Copyright (c) 2013,山外科技 | ||
* All rights reserved. | ||
* 技术讨论:山外论坛 http://www.vcan123.com | ||
* | ||
* 除注明出处外,以下所有内容版权均属山外科技所有,未经允许,不得用于商业用途, | ||
* 修改内容时必须保留山外科技的版权声明。 | ||
* | ||
* @file MK60_conf.h | ||
* @brief 山外K60 平台配置文件 | ||
* @author 山外科技 | ||
* @version v5.1 | ||
* @date 2013-06-26 | ||
*/ | ||
|
||
#ifndef __MK60_CONF_H__ | ||
#define __MK60_CONF_H__ | ||
|
||
/* | ||
* 定义平台[放在工程选项里定义] | ||
*/ | ||
//#define MK60DZ10 | ||
//#define MK60F15 | ||
|
||
|
||
|
||
|
||
/* | ||
* 选择是否输出调试信息,不输出则注释下面的宏定义 | ||
*/ | ||
#define DEBUG_PRINT | ||
|
||
/* | ||
* 定义晶振时钟,单位为MHz | ||
*/ | ||
#define EXTAL_IN_MHz (50) | ||
|
||
/* | ||
* 定义 PLL 超频 频率 (不同的平台,有不同的超频配置) | ||
* | ||
* 如果对超频配置不熟悉,可以看如下帖子: | ||
* K60 KL26 主频和总线频率的关系 - 智能车资料区 - 山外论坛 | ||
* http://www.vcan123.com/forum.php?mod=viewthread&tid=81&page=1&extra=#pid419 | ||
*/ | ||
#if defined(MK60DZ10) //以下为 MK60DZ10 的超频配置 | ||
/* | ||
* 定义 PLL 超频 频率 | ||
*/ | ||
#define CORE_CLK PLL96 // 从 PLL_e 里选择 已提供的 配置方案 | ||
// bus 、 flex bus 、 flash 频率 都是 core 整数倍分频而来 | ||
#define MAX_BUS_CLK 48 // bus (bus >= core/16 ) | ||
#define MAX_FLEXBUS_CLK 25 // flex bus (flex bus >= core/16 ) | ||
#define MAX_FLASH_CLK 25 // flash (flash >= core/16 ) | ||
|
||
#elif defined(MK60F15) //以下为 MK60F15 的超频配置 | ||
|
||
#define CORE_CLK PLL120 // 从 PLL_e 里选择 已提供的 配置方案 | ||
// bus 、 flex bus 、 flash 频率 都是 core 整数倍分频而来 | ||
#define MAX_BUS_CLK 60 // bus (bus >= core/16 ) | ||
#define MAX_FLEXBUS_CLK 25 // flex bus (flex bus >= core/16 ) | ||
#define MAX_FLASH_CLK 25 // flash (flash >= core/16 ) | ||
|
||
#endif | ||
|
||
/********************* 自定义 时钟频率 分频因子 ********************/ | ||
//如果 CORE_CLK 为 PLLUSR ,则为自定义模式 ,如下配置生效 | ||
//如果是 F15 系列: MCG_CLK_MHZ = 50u*(VDIV+16)/(PRDIV+1)/2 | ||
//如果是 DZ10 系列:MCG_CLK_MHZ = ( 50u/(PRDIV+1) ) * (VDIV+24) | ||
#define PRDIV 10 | ||
#define VDIV 29 | ||
#define CORE_DIV 0 // core = mcg/ ( CORE_DIV + 1 ) | ||
#define BUS_DIV 1 // bus = mcg/ ( BUS_DIV + 1 ) | ||
#define FLEX_DIV 9 // flex = mcg/ ( FLEX_DIV + 1 ) | ||
#define FLASH_DIV 8 // flash= mcg/ ( FLASH_DIV + 1 ) | ||
|
||
/* | ||
* 定义 printf函数 的 串口输出端口 和 串口信息 | ||
*/ | ||
#define VCAN_PORT UART3 | ||
#define VCAN_BAUD 115200 | ||
|
||
/* | ||
* 配置延时函数 | ||
*/ | ||
#if 0 | ||
#include "MK60_DWT.h" //有可能不稳定 | ||
#define DELAY() dwt_delay_ms(500) | ||
#define DELAY_MS(ms) dwt_delay_ms(ms) | ||
#define DELAY_US(us) dwt_delay_us(us) | ||
#elif 0 | ||
#include "MK60_lptmr.h" | ||
#define DELAY() lptmr_delay_ms(500) | ||
#define DELAY_MS(ms) lptmr_delay_ms(ms) | ||
#define DELAY_US(us) lptmr_delay_us(us) | ||
#elif 1 | ||
#include "MK60_pit.h" | ||
#define DELAY() pit_delay_ms(PIT3,500) | ||
#define DELAY_MS(ms) pit_delay_ms(PIT3,ms) | ||
#define DELAY_US(us) pit_delay_us(PIT3,us) | ||
#else | ||
#include "MK60_SysTick.h" | ||
#define DELAY() systick_delay_ms(500) | ||
#define DELAY_MS(ms) systick_delay_ms(ms) | ||
#define DELAY_US(us) systick_delay_us(us) | ||
#endif | ||
|
||
|
||
/* | ||
* 配置断言和其实现函数 | ||
*/ | ||
void assert_failed(char *, int); | ||
|
||
#if defined( DEBUG ) | ||
#define ASSERT(expr) \ | ||
if (!(expr)) \ | ||
assert_failed(__FILE__, __LINE__) | ||
#else | ||
#define ASSERT(expr) | ||
#endif | ||
|
||
/* | ||
* 配置调试输出函数 | ||
*/ | ||
#if( defined(DEBUG) && defined(DEBUG_PRINT)) | ||
#define DEBUG_PRINTF(FORMAT,...) do{printf(FORMAT,##__VA_ARGS__);}while(0) /*无需打印调试信息时,请将宏内容注释掉*/ | ||
#else | ||
#define DEBUG_PRINTF(FORMAT,...) | ||
#endif | ||
|
||
/* | ||
* 启动前检测,防止 复用下载口 | ||
*/ | ||
void start_check(); | ||
#ifdef DEBUG | ||
#define SRART_CHECK() start_check() | ||
#else | ||
#define SRART_CHECK() | ||
#endif | ||
|
||
|
||
#endif /* __MK60_CONF_H__ */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
/*! | ||
* COPYRIGHT NOTICE | ||
* Copyright (c) 2013,山外科技 | ||
* All rights reserved. | ||
* 技术讨论:山外论坛 http://www.vcan123.com | ||
* | ||
* 除注明出处外,以下所有内容版权均属山外科技所有,未经允许,不得用于商业用途, | ||
* 修改内容时必须保留山外科技的版权声明。 | ||
* | ||
* @file MK60_it.h | ||
* @brief 山外K60 平台中断服务重定向头文件 | ||
* @author 山外科技 | ||
* @version v5.0 | ||
* @date 2013-06-26 | ||
*/ | ||
|
||
|
||
#ifndef __MK60_IT_H__ | ||
#define __MK60_IT_H__ | ||
|
||
/* 重新定义中断向量表 | ||
* 先取消默认的中断向量元素宏定义 #undef VECTOR_xxx | ||
* 在重新定义到自己编写的中断函数 #define VECTOR_xxx xxx_IRQHandler | ||
* 例如: | ||
* #undef VECTOR_003 先取消映射到中断向量表里的中断函数地址宏定义 | ||
* #define VECTOR_003 HardFault_Handler 重新定义硬件上访中断服务函数 | ||
*/ | ||
|
||
//---------重定义中断----------// | ||
#undef VECTOR_069 | ||
#define VECTOR_069 UART4_IRQHandler | ||
|
||
#undef VECTOR_084 | ||
#define VECTOR_084 PIT0_Isr | ||
|
||
#undef VECTOR_085 | ||
#define VECTOR_085 PIT1_Isr | ||
|
||
#undef VECTOR_107 | ||
#define VECTOR_107 PORTE_IRQHandler | ||
|
||
#undef VECTOR_103 | ||
#define VECTOR_103 PORTA_IRQHandler | ||
|
||
#undef VECTOR_101 | ||
#define VECTOR_101 lptmr_hander | ||
|
||
|
||
|
||
extern void UART4_IRQHandler(void); | ||
extern void PIT1_Isr(void); | ||
extern void PIT0_Isr(void); | ||
extern void PORTE_IRQHandler(); | ||
extern void PORTA_IRQHandler(); | ||
extern void lptmr_hander(); | ||
#endif //__MK60_IT_H__ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,138 @@ | ||
/*! | ||
* COPYRIGHT NOTICE | ||
* Copyright (c) 2013,山外科技 | ||
* All rights reserved. | ||
* 技术讨论:山外论坛 http://www.vcan123.com | ||
* | ||
* 除注明出处外,以下所有内容版权均属山外科技所有,未经允许,不得用于商业用途, | ||
* 修改内容时必须保留山外科技的版权声明。 | ||
* | ||
* @file port_cfg.h | ||
* @brief 山外K60 复用管脚配置 | ||
* @author 山外科技 | ||
* @version v5.1 | ||
* @date 2013-06-26 | ||
*/ | ||
#ifndef _PORT_CFG_H_ | ||
#define _PORT_CFG_H_ | ||
|
||
#include "MK60_port.h" | ||
|
||
/********************************** UART ***************************************/ | ||
|
||
// 模块通道 端口 可选范围 建议 | ||
#define UART0_RX_PIN PTD6 //PTA1、PTA15、PTB16、PTD6 PTA1不要用(与Jtag冲突) | ||
#define UART0_TX_PIN PTD7 //PTA2、PTA14、PTB17、PTD7 PTA2不要用(与Jtag冲突) | ||
|
||
#define UART1_RX_PIN PTC3 //PTC3、PTE1 | ||
#define UART1_TX_PIN PTC4 //PTC4、PTE0 | ||
|
||
#define UART2_RX_PIN PTD2 //PTD2 | ||
#define UART2_TX_PIN PTD3 //PTD3 | ||
|
||
#define UART3_RX_PIN PTC16 //PTB10、PTC16、PTE5 | ||
#define UART3_TX_PIN PTC17 //PTB11、PTC17、PTE4 | ||
|
||
#define UART4_RX_PIN PTC14 //PTC14、PTE25 | ||
#define UART4_TX_PIN PTC15 //PTC15、PTE24 | ||
|
||
#define UART5_RX_PIN PTE9 //PTD8、PTE9 | ||
#define UART5_TX_PIN PTE8 //PTD9、PTE8 | ||
|
||
/********************************** FTM ***************************************/ | ||
|
||
// 模块通道 端口 可选范围 建议 | ||
#define FTM0_CH0_PIN PTC1 //PTC1、PTA3 PTA3不要用(与Jtag、SWD冲突) | ||
#define FTM0_CH1_PIN PTC2 //PTC2、PTA4 | ||
#define FTM0_CH2_PIN PTC3 //PTC3、PTA5 | ||
#define FTM0_CH3_PIN PTC4 //PTC4、PTA6 | ||
#define FTM0_CH4_PIN PTA7 //PTD4、PTA7 | ||
#define FTM0_CH5_PIN PTD5 //PTD5、PTA0 PTA0不要用(与Jtag、SWD冲突) | ||
#define FTM0_CH6_PIN PTD6 //PTD6、PTA1 PTA1不要用(与Jtag冲突) | ||
#define FTM0_CH7_PIN PTD7 //PTD7、PTA2 PTA2不要用(与Jtag冲突) | ||
|
||
|
||
// 模块通道 端口 可选范围 建议 | ||
#define FTM1_CH0_PIN PTA12 //PTA8、PTA12、PTB0 | ||
#define FTM1_CH1_PIN PTA13 //PTA9、PTA13、PTB1 | ||
|
||
// 模块通道 端口 可选范围 建议 | ||
#define FTM2_CH0_PIN PTA10 //PTA10、PTB18 | ||
#define FTM2_CH1_PIN PTA11 //PTA11、PTB19 | ||
|
||
|
||
#ifdef MK60F15 //ALT6 ALT3 ALT4 FX 才有FTM3模块 | ||
|
||
#define FTM3_CH0_PIN PTE5 //PTE5 PTD0 | ||
#define FTM3_CH1_PIN PTE6 //PTE6 PTD1 | ||
#define FTM3_CH2_PIN PTE7 //PTE7 PTD2 | ||
#define FTM3_CH3_PIN PTE8 //PTE8 PTD3 | ||
#define FTM3_CH4_PIN PTE9 //PTE9 PTC8 | ||
#define FTM3_CH5_PIN PTE10 //PTE10 PTC9 | ||
#define FTM3_CH6_PIN PTE11 //PTE11 PTC10 | ||
#define FTM3_CH7_PIN PTE12 //PTE12 PTC11 | ||
|
||
#endif | ||
|
||
//正交解码模块通道 端口 可选范围 建议 | ||
#define FTM1_QDPHA_PIN PTA12 //PTA8、PTA12、PTB0 | ||
#define FTM1_QDPHB_PIN PTA13 //PTA9、PTA13、PTB1 | ||
|
||
#define FTM2_QDPHA_PIN PTA10 //PTA10、PTB18 | ||
#define FTM2_QDPHB_PIN PTA11 //PTA11、PTB19 | ||
|
||
|
||
/********************************** I2C ***************************************/ | ||
|
||
// 模块通道 端口 可选范围 建议 | ||
#define I2C0_SCL_PIN PTD8 // PTB0、PTB2、PTD8 | ||
#define I2C0_SDA_PIN PTD9 // PTB1、PTB3、PTD9 | ||
|
||
#define I2C1_SCL_PIN PTC10 // PTE1、PTC10 | ||
#define I2C1_SDA_PIN PTC11 // PTE0、PTC11 | ||
|
||
|
||
/********************************** SPI ***************************************/ | ||
//PCS接口,不用的时候需要注释,就不会进行初始化对应的管脚 | ||
// 模块通道 端口 可选范围 建议 | ||
|
||
#define SPI0_SCK_PIN PTA15 // PTA15、PTC5、PTD1 全部都是 ALT2 | ||
#define SPI0_SOUT_PIN PTA16 // PTA16、PTC6、PTD2 全部都是 ALT2 | ||
#define SPI0_SIN_PIN PTA17 // PTA17、PTC7、PTD3 全部都是 ALT2 | ||
|
||
#define SPI0_PCS0_PIN PTA14 // PTA14、PTC4、PTD0、 全部都是 ALT2 | ||
#define SPI0_PCS1_PIN PTC3 // PTC3、PTD4 全部都是 ALT2 | ||
#define SPI0_PCS2_PIN PTC2 // PTC2、PTD5 全部都是 ALT2 | ||
#define SPI0_PCS3_PIN PTC1 // PTC1、PTD6 全部都是 ALT2 | ||
#define SPI0_PCS4_PIN PTC0 // PTC0、 全部都是 ALT2 | ||
#define SPI0_PCS5_PIN PTB23 // PTB23 ALT3 | ||
|
||
|
||
#define SPI1_SCK_PIN PTB11 // PTE2、PTB11、 全部都是 ALT2 | ||
#define SPI1_SOUT_PIN PTB16 // PTE1、PTB16、 全部都是 ALT2 | ||
#define SPI1_SIN_PIN PTB17 // PTE3、PTB17、 全部都是 ALT2 | ||
|
||
#define SPI1_PCS0_PIN PTB10 // PTE4、PTB10、 全部都是 ALT2 | ||
#define SPI1_PCS1_PIN PTE0 // PTE0、PTB9、 全部都是 ALT2 | ||
#define SPI1_PCS2_PIN PTE5 // PTE5、 全部都是 ALT2 | ||
#define SPI1_PCS3_PIN PTE6 // PTE6、 全部都是 ALT2 | ||
|
||
|
||
#define SPI2_SCK_PIN PTB21 // PTB21、PTD12 全部都是 ALT2 | ||
#define SPI2_SOUT_PIN PTB22 // PTB22、PTD13 全部都是 ALT2 | ||
#define SPI2_SIN_PIN PTB23 // PTB23、PTD14 全部都是 ALT2 | ||
#define SPI2_PCS0_PIN PTB20 // PTB20、PTD11 全部都是 ALT2 | ||
#define SPI2_PCS1_PIN PTD15 // PTD15 全部都是 ALT2 | ||
|
||
|
||
/********************************** CAN ***************************************/ | ||
#define CAN0_TX_PIN PTA12 //PTA12、PTB18 全部都是 ALT2 | ||
#define CAN0_RX_PIN PTA13 //PTA13、PTB19 全部都是 ALT2 | ||
|
||
#define CAN1_TX_PIN PTE24 //PTE24、PTC17 全部都是 ALT2 | ||
#define CAN1_RX_PIN PTE25 //PTE25、PTC16 全部都是 ALT2 | ||
|
||
|
||
#endif //_PORT_CFG_H_ | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
#ifndef __INCLUDE_H__ | ||
#define __INCLUDE_H__ | ||
|
||
#include "common.h" | ||
|
||
/* | ||
* Include 用户自定义的头文件 | ||
*/ | ||
#include "MK60_wdog.h" | ||
#include "MK60_gpio.h" //IO口操作 | ||
#include "MK60_uart.h" //串口 | ||
#include "MK60_SysTick.h" | ||
#include "MK60_lptmr.h" //低功耗定时器(延时) | ||
#include "MK60_pit.h" //PIT | ||
#include "MK60_FLASH.h" //FLASH | ||
#include "MK60_ftm.h" | ||
|
||
#include "VCAN_LED.H" //LED | ||
#include "VCAN_KEY.H" //KEY | ||
#include "MK60_adc.h" | ||
|
||
//#define LQ | ||
|
||
#ifndef LQ | ||
#include "MK60_i2c.h" | ||
#endif | ||
|
||
#include "OLED.h" | ||
#include "stand.h" | ||
#include "parameter.h" | ||
#include "VCAN_NRF24L0.h" | ||
#include "upper.h" | ||
#include "L3G4200D.h" | ||
#include "sensor.h" | ||
#include "8700_2100.h" | ||
#include "I2C.h" | ||
|
||
|
||
|
||
|
||
|
||
|
||
#endif //__INCLUDE_H__ |
Oops, something went wrong.