You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
557 lines
16 KiB
557 lines
16 KiB
////////////////////////////////////////////////////////////////////////////
|
|
///@copyright Copyright (c) 2017, 传控科技 All rights reserved.
|
|
///-------------------------------------------------------------------------
|
|
/// @file hard_config.h
|
|
/// @brief hard config include
|
|
/// @info FILE FOR HARDWARE SETUP AND SOFTWARE SETUP///FOR EXAMPLE: BAORD ,MCU,IDE
|
|
/// @info YOU CAN CHANGE OR ADD THE DEFINE IF YOU NEED
|
|
/// @info 整个嵌入式项目的入口 首先是确认电路板 然后确认cpu 芯片型号 然后确认编译器 之后是软件框架 最后是应用程序
|
|
/// @info bsp_CONFIG 为其他头文件的始祖 TYPE_BOARD_xx
|
|
///-------------------------------------------------------------------------
|
|
/// @version 1.1
|
|
/// @author CC
|
|
/// @date 20180308
|
|
/// @note
|
|
//////////////////////////////////////////////////////////////////////////////
|
|
/// @version 5.1
|
|
/// @author CC
|
|
/// @date 20200301
|
|
/// @note
|
|
//////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
//////////////////////////////////////////////////////////////////////////
|
|
#ifndef _BSP_CONFIG_H
|
|
#define _BSP_CONFIG_H
|
|
|
|
#include <INTRINS.H>
|
|
|
|
#include "c_bit.h"
|
|
#include "bsp_config_const.h"//
|
|
|
|
//STEP 1 TYPE_UASER_BOARD SELECT >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
|
|
#define TYPE_UASER_BOARD TYPE_BOARD_TTSS2_w5
|
|
|
|
|
|
//STEP 2 TYPE_UASER_BOARD CONFIG >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
|
|
#if(TYPE_UASER_BOARD == TYPE_BOARD_TTSS2_w5)
|
|
#include <stdio.h>
|
|
#include <string.h>
|
|
#include <intrins.h>
|
|
|
|
|
|
//基本配置(工作频率、时钟、看门狗、字节序)
|
|
#define TYPE_MCU TYPE_MCU_STC_8H
|
|
#define TYPE_IDE TYPE_IDE_KEIL
|
|
/// #define D_sys_MainFre MainFre_11M////STC8A8K64D4 z最大45M
|
|
#define D_sys_MainFre MainFre_22M////STC8A8K64D4 z最大45M
|
|
/// #define D_sys_MainFre MainFre_44M////STC8A8K64D4 z最大45M
|
|
#define D_sys_Jiffies TYPE_JIFFIES_12MS
|
|
|
|
#warning "MainFre_22M"
|
|
|
|
#define D_MCU_NAME "STC8A8K64U4"
|
|
#define D_str_version "\r\n stcTTSS2NB2_"
|
|
#define D_BOARD_NAME " NB2"
|
|
#include "c_type51.h"
|
|
|
|
/**************
|
|
正在检测目标单片机 ...
|
|
单片机型号: STC8H3K48S2
|
|
固件版本号: 7.4.1U
|
|
|
|
当前芯片的硬件选项为:
|
|
. 系统ISP工作频率: 23.844MHz
|
|
. 内部IRC振荡器的频率: 11.057MHz
|
|
. 掉电唤醒定时器的频率: 35.250KHz
|
|
. 振荡器放大增益使能
|
|
. P3.2和P3.3与下次下载无关
|
|
. 上电复位时增加额外的复位延时
|
|
. 复位引脚用作普通I/O口
|
|
. 检测到低压时复位
|
|
. 低压检测门槛电压 : 2.00 V
|
|
. 上电复位时,硬件不启动内部看门狗
|
|
. 上电自动启动内部看门狗时的预分频数为 : 256
|
|
. 空闲状态时看门狗定时器停止计数
|
|
. 下次下载用户程序时,将用户EEPROM区一并擦除
|
|
. 下次下载用户程序时,没有相关的端口控制485
|
|
. 下次下载时不需要校验下载口令
|
|
. 内部参考电压: 1195 mV (参考范围: 1100~1300mV)
|
|
. 内部安排测试时间: 2021年9月2日
|
|
|
|
单片机型号: STC8H3K48S2
|
|
固件版本号: 7.4.1U
|
|
|
|
开始调节频率 ... [0.906"]
|
|
调节后的频率: 22.094MHz (-0.109%)
|
|
|
|
正在重新握手 ... 成功 [0.125"]
|
|
当前的波特率: 460800
|
|
正在擦除目标区域 ... 完成 ! [0.656"]
|
|
正在下载用户代码 ... 完成 ! [2.860"]
|
|
正在设置硬件选项 ... 完成 ! [0.016"]
|
|
|
|
更新后的硬件选项为:
|
|
. 系统ISP工作频率: 23.844MHz
|
|
. 内部IRC振荡器的频率: 22.094MHz
|
|
. 掉电唤醒定时器的频率: 35.250KHz
|
|
. 振荡器放大增益使能
|
|
. P3.2和P3.3与下次下载无关
|
|
. 上电复位时增加额外的复位延时
|
|
. 复位引脚用作普通I/O口
|
|
. 检测到低压时复位
|
|
. 低压检测门槛电压 : 2.00 V
|
|
. 上电复位时,硬件不启动内部看门狗
|
|
. 上电自动启动内部看门狗时的预分频数为 : 256
|
|
. 空闲状态时看门狗定时器停止计数
|
|
. 下次下载用户程序时,将用户EEPROM区一并擦除
|
|
. 下次下载用户程序时,没有相关的端口控制485
|
|
. 下次下载时不需要校验下载口令
|
|
. 内部参考电压: 1195 mV (参考范围: 1100~1300mV)
|
|
. 内部安排测试时间: 2021年9月2日
|
|
芯片出厂序列号 : F74DC52602599C
|
|
|
|
单片机型号: STC8H3K48S2
|
|
固件版本号: 7.4.1U
|
|
|
|
. 用户设定频率: 22.118MHz
|
|
. 调节后的频率: 22.094MHz (主时钟分频系数 = 1)
|
|
. 频率调节误差: -0.109%
|
|
|
|
|
|
操作成功 !(2023-04-06 21:16:42)
|
|
|
|
|
|
--------------------------------------------------------------
|
|
电源开关
|
|
EN_DEC3V3 P14 PIN8 网络模块
|
|
EN_DC5V P37 PIN28
|
|
LED5VEN1 P20 PIN33 4位数码管 LED5VEN4
|
|
RFID5VEN P41 PIN29 RFID
|
|
|
|
--------------------------------------------------------------
|
|
|
|
蜂鸣器
|
|
BEE P22
|
|
--------------------------------------------------------------
|
|
20230317_ CCmodify
|
|
|
|
U1 DEBUG
|
|
U2 5311
|
|
U3 485
|
|
U4 xx
|
|
|
|
--------------------------------------------------------------
|
|
|
|
TTSS 使用定时器0 作为任务的主要时间
|
|
定时器1 作为溢出的工123
|
|
|
|
uart1 使用定时器2 实现文件 uart1.c
|
|
uart2 使 实现文件 uart2.c
|
|
|
|
|
|
modbus使用定时器2 作为uart空闲状态的判定 (区分协议的结束) 定时器有限的情况下可以使用定时器0,只是关联受限
|
|
|
|
|
|
*******************************************************/
|
|
|
|
|
|
|
|
|
|
#include "bsp_config_stc.h"
|
|
#define D_WDT_STATUS TYPE_WDT_DISABLE //如果配置为enable,请在bsp_config.c中设置wdt溢出时间
|
|
#define D_MCU_ENDIAN TYPE_MCU_BIGENDIAN
|
|
#define D_CODE_ENCRYPTION_TYPE TYPE_ENCRYPTION_ENABLE //是否代码加密
|
|
|
|
//串口配置
|
|
/// #define D_UART1_BRT BRT_460800
|
|
/// #define D_UART1_BRT BRT_921600
|
|
// #define D_UART1_BRT BRT_115200
|
|
#define D_UART1_BRT BRT_9600
|
|
#define D_UART1_SBIT SBIT_1
|
|
#define D_PIN_UART1 PIN_UART1_Rxd_30_Txd_31
|
|
#define D_UART2_BRT BRT_115200///BRT_921600///BRT_115200///
|
|
#define D_UART3_BRT BRT_115200///BRT_921600///BRT_115200
|
|
#define D_UART4_BRT BRT_115200///BRT_921600///BRT_115200
|
|
|
|
//485配置
|
|
#define D_UART1_485_TYPE TYPE_485_SLAVER //UART1启用485
|
|
#define D_UART1_485_SLAVER_ID_BROADCAST 0xFF //485从机总是响应0xFF消息
|
|
#define D_UART1_485_SLAVER_ID 0x11 //板卡作为485从机 slaverId
|
|
#define D_UART1_485_TX() D_P55_stdIO();D_P55_ON();
|
|
#define D_UART1_485_RX() D_P55_stdIO();D_P55_OFF();
|
|
#define D_UART2_485_TYPE TYPE_485_NONE //UART2不启用485
|
|
#define D_UART3_485_TYPE TYPE_485_NONE //UART2不启用485
|
|
#define D_UART4_485_TYPE TYPE_485_NONE //UART2不启用485
|
|
|
|
//MODBUS协议配置
|
|
#define D_MODBUS_ENABLE //MODBS启用开关,如果不使用modbus,可以注释掉本行
|
|
#define D_MODBUS_SPLIT_ENTRY L1_modbus_split //modbus切割函数,在tpc_modbus.c中实现,依据实际情况修改
|
|
#define D_MODBUS_REG_MAX_NUM 32 //每次最多读取/写入的寄存器数量,此处的数量要注意和 D_tp_handle_x_len 对应
|
|
|
|
//外设定义
|
|
|
|
#define D_LED1_INIT() D_LED1_OFF()
|
|
#define D_LED1_ON() D_P12_stdIO();D_P12_OFF()
|
|
#define D_LED1_OFF() D_P12_stdIO();D_P12_ON()
|
|
#define D_LED1_REV() D_P12_stdIO();D_P12_REV()
|
|
|
|
// #define D_LED2_INIT() D_LED2_OFF()
|
|
// #define D_LED2_ON() D_P54_stdIO();D_P54_OFF()
|
|
// #define D_LED2_OFF() D_P54_stdIO();D_P54_ON()
|
|
// #define D_LED2_REV() D_P54_stdIO();D_P54_REV()
|
|
|
|
|
|
|
|
//EEP存储地址定义
|
|
#define D_EEP_SECTOR_SIZE 0x200
|
|
#define D_EEP_PARAM_ADDR (D_EEP_SECTOR_SIZE * 0) //eeprom参数区扇区地址
|
|
|
|
//存储器特殊参数地址配置
|
|
#define D_MCU_SPEC_PARAM_CHIPID 0xFDF9
|
|
//...其他参数
|
|
|
|
|
|
#define D_iicch_0 0
|
|
#define D_iicch_1 1
|
|
#define D_iicch_2 2
|
|
#define D_iicch_3 3
|
|
#define D_iicch_4 4
|
|
#define D_iicch_5 5
|
|
#define D_iicch_6 6
|
|
#define D_iicch_7 7
|
|
#define D_iicch_8 8
|
|
#define D_iicch_9 9
|
|
|
|
#define D_iic_chnum 2
|
|
|
|
|
|
#define D_SIIC_USE_0
|
|
#define D_SIIC_USE_1
|
|
///#define D_SIIC_USE_2
|
|
///#define D_SIIC_USE_3
|
|
///#define D_SIIC_USE_4
|
|
///#define D_SIIC_USE_5
|
|
///#define D_SIIC_USE_6
|
|
///#define D_SIIC_USE_7
|
|
///#define D_SIIC_USE_8
|
|
|
|
#define D_iicch_MSA D_iicch_1///第3路iic配置程mas301加速度传感器
|
|
#define D_iicch_CLK D_iicch_0
|
|
|
|
|
|
|
|
///////////////////////////3//////////////////////////////////////////////
|
|
|
|
//////////////////////////ch=1 /0///////////////////////////////////////////////
|
|
|
|
|
|
#ifdef D_SIIC_USE_0
|
|
|
|
//IICM0 SDA
|
|
//IICM0 SDA
|
|
#define L0_IICM0_SDA_init() D_PUON_P2(BITN2) ;D_OpenD_P4(BITN2)
|
|
#define L0_IICM0_SDA_OUT() D_P22_OUT()
|
|
#define L0_IICM0_SDA_IN() D_P22_IN()
|
|
#define L0_IICM0_SDA_ON() D_P22_ON()
|
|
#define L0_IICM0_SDA_OFF() D_P22_OFF()
|
|
#define L0_IICM0_SDA_AT() D_P22_AT()
|
|
|
|
|
|
//IICM0 SCL
|
|
#define L0_IICM0_SCL_init() D_PUON_P2(BITN3) ;D_stdIO_P2(BITN3)
|
|
|
|
#define L0_IICM0_SCL_OUT() D_P23_OUT()
|
|
#define L0_IICM0_SCL_IN() D_P23_IN()
|
|
#define L0_IICM0_SCL_ON() D_P23_ON()
|
|
#define L0_IICM0_SCL_OFF() D_P23_OFF()
|
|
#endif
|
|
|
|
//--------------------------------------------
|
|
|
|
|
|
#ifdef D_SIIC_USE_1
|
|
|
|
#define L0_IICM1_SDA_init() D_PUON_P4(BITN1);D_OpenD_P4(BITN1)
|
|
#define L0_IICM1_SDA_OUT() D_P41_OUT()
|
|
#define L0_IICM1_SDA_IN() D_P41_IN()
|
|
#define L0_IICM1_SDA_ON() D_P41_ON()
|
|
#define L0_IICM1_SDA_OFF() D_P41_OFF()
|
|
#define L0_IICM1_SDA_AT() D_P41_AT()
|
|
|
|
#define L0_IICM1_SCL_init() D_PUON_P4(BITN2);D_stdIO_P4(BITN2)
|
|
|
|
#define L0_IICM1_SCL_OUT() D_P42_OUT()
|
|
#define L0_IICM1_SCL_IN() D_P42_IN()
|
|
#define L0_IICM1_SCL_ON() D_P42_ON()
|
|
#define L0_IICM1_SCL_OFF() D_P42_OFF()
|
|
#endif
|
|
|
|
|
|
#ifdef D_SIIC_USE_2
|
|
|
|
///DOUT2 P04 sch;MAS_SDA MAS_SCL P50
|
|
#define L0_IICM2_SDA_init() D_PUON_P3(BITN4) ;D_OpenD_P3(BITN4)
|
|
#define L0_IICM2_SDA_OUT() D_P34_OUT()
|
|
#define L0_IICM2_SDA_IN() D_P34_IN()
|
|
#define L0_IICM2_SDA_ON() D_P34_ON()
|
|
#define L0_IICM2_SDA_OFF() D_P34_OFF()
|
|
#define L0_IICM2_SDA_AT() D_P34_AT()
|
|
|
|
#define L0_IICM2_SCL_init() D_PUON_P5(BITN0) ;D_stdIO_P5(BITN0)
|
|
#define L0_IICM2_SCL_OUT() D_P50_OUT()
|
|
#define L0_IICM2_SCL_IN() D_P50_IN()
|
|
#define L0_IICM2_SCL_ON() D_P50_ON()
|
|
#define L0_IICM2_SCL_OFF() D_P50_OFF()
|
|
/////////////////////////ch=3 //2//////////////////////////////////////////////
|
|
#endif
|
|
|
|
#ifdef D_SIIC_USE_3
|
|
|
|
#define L0_IICM3_SDA_init() D_PUON_P3(BITN7) ;D_OpenD_P3(BITN7)
|
|
#define L0_IICM3_SDA_OUT() D_P37_OUT()
|
|
#define L0_IICM3_SDA_IN() D_P37_IN()
|
|
#define L0_IICM3_SDA_ON() D_P37_ON()
|
|
#define L0_IICM3_SDA_OFF() D_P37_OFF()
|
|
#define L0_IICM3_SDA_AT() D_P37_AT()
|
|
|
|
#define L0_IICM3_SCL_init() D_PUON_P4(BITN1) ;D_stdIO_P4(BITN1)
|
|
#define L0_IICM3_SCL_OUT() D_P41_OUT()
|
|
#define L0_IICM3_SCL_IN() D_P41_IN()
|
|
#define L0_IICM3_SCL_ON() D_P41_ON()
|
|
#define L0_IICM3_SCL_OFF() D_P41_OFF()
|
|
|
|
#endif
|
|
|
|
|
|
#ifdef D_SIIC_USE_4
|
|
|
|
/////////////////////////ch=4 //2//////////////////////////////////////////////
|
|
|
|
|
|
|
|
#define L0_IICM4_SDA_init() D_PUON_P3(BITN7) ;D_OpenD_P3(BITN7)
|
|
#define L0_IICM4_SDA_OUT() D_P37_OUT()
|
|
#define L0_IICM4_SDA_IN() D_P37_IN()
|
|
#define L0_IICM4_SDA_ON() D_P37_ON()
|
|
#define L0_IICM4_SDA_OFF() D_P37_OFF()
|
|
#define L0_IICM4_SDA_AT() D_P37_AT()
|
|
|
|
#define L0_IICM4_SCL_init() D_PUON_P4(BITN1) ;D_stdIO_P4(BITN1)
|
|
#define L0_IICM4_SCL_OUT() D_P41_OUT()
|
|
#define L0_IICM4_SCL_IN() D_P41_IN()
|
|
#define L0_IICM4_SCL_ON() D_P41_ON()
|
|
#define L0_IICM4_SCL_OFF() D_P41_OFF()
|
|
|
|
#endif
|
|
|
|
#ifdef D_SIIC_USE_5
|
|
|
|
|
|
//IICM5 SDA
|
|
#define L0_IICM5_SDA_init() D_stdIO_P1(BITN5)
|
|
#define L0_IICM5_SDA_OUT() D_P15_OUT()
|
|
#define L0_IICM5_SDA_IN() D_P15_IN()
|
|
#define L0_IICM5_SDA_ON() D_P15_ON()
|
|
#define L0_IICM5_SDA_OFF() D_P15_OFF()
|
|
#define L0_IICM5_SDA_AT() D_P15_AT()
|
|
|
|
|
|
|
|
//IICM5 SCL
|
|
#define L0_IICM5_SCL_init() D_stdIO_P1(BITN4)
|
|
|
|
#define L0_IICM5_SCL_OUT() D_P14_OUT()
|
|
#define L0_IICM5_SCL_IN() D_P14_IN()
|
|
#define L0_IICM5_SCL_ON() D_P14_ON()
|
|
#define L0_IICM5_SCL_OFF() D_P14_OFF()
|
|
|
|
#endif
|
|
|
|
|
|
#ifdef D_SIIC_USE_6
|
|
|
|
|
|
|
|
//IICM6 SDA
|
|
#define L0_IICM6_SDA_init() D_stdIO_P1(BITN5)
|
|
#define L0_IICM6_SDA_OUT() D_P15_OUT()
|
|
#define L0_IICM6_SDA_IN() D_P15_IN()
|
|
#define L0_IICM6_SDA_ON() D_P15_ON()
|
|
#define L0_IICM6_SDA_OFF() D_P15_OFF()
|
|
#define L0_IICM6_SDA_AT() D_P15_AT()
|
|
|
|
//IICM6 SCL
|
|
#define L0_IICM6_SCL_init() D_stdIO_P1(BITN4)
|
|
|
|
#define L0_IICM6_SCL_OUT() D_P14_OUT()
|
|
#define L0_IICM6_SCL_IN() D_P14_IN()
|
|
#define L0_IICM6_SCL_ON() D_P14_ON()
|
|
#define L0_IICM6_SCL_OFF() D_P14_OFF()
|
|
#endif
|
|
|
|
|
|
#ifdef D_SIIC_USE_7
|
|
|
|
//IICM7 SDA
|
|
#define L0_IICM7_SDA_init() D_stdIO_P1(BITN5)
|
|
#define L0_IICM7_SDA_OUT() D_P15_OUT()
|
|
#define L0_IICM7_SDA_IN() D_P15_IN()
|
|
#define L0_IICM7_SDA_ON() D_P15_ON()
|
|
#define L0_IICM7_SDA_OFF() D_P15_OFF()
|
|
#define L0_IICM7_SDA_AT() D_P15_AT()
|
|
|
|
//IICM7 SCL
|
|
#define L0_IICM7_SCL_init() D_stdIO_P1(BITN4)
|
|
|
|
#define L0_IICM7_SCL_OUT() D_P14_OUT()
|
|
#define L0_IICM7_SCL_IN() D_P14_IN()
|
|
#define L0_IICM7_SCL_ON() D_P14_ON()
|
|
#define L0_IICM7_SCL_OFF() D_P14_OFF()
|
|
#endif
|
|
|
|
|
|
#ifdef D_SIIC_USE_8
|
|
|
|
//IICM8 SDA
|
|
#define L0_IICM8_SDA_init() D_stdIO_P1(BITN5)
|
|
#define L0_IICM8_SDA_OUT() D_P15_OUT()
|
|
#define L0_IICM8_SDA_IN() D_P15_IN()
|
|
#define L0_IICM8_SDA_ON() D_P15_ON()
|
|
#define L0_IICM8_SDA_OFF() D_P15_OFF()
|
|
#define L0_IICM8_SDA_AT() D_P15_AT()
|
|
|
|
|
|
//IICM8 SCL
|
|
#define L0_IICM8_SCL_init() D_stdIO_P1(BITN4)
|
|
|
|
#define L0_IICM8_SCL_OUT() D_P14_OUT()
|
|
#define L0_IICM8_SCL_IN() D_P14_IN()
|
|
#define L0_IICM8_SCL_ON() D_P14_ON()
|
|
#define L0_IICM8_SCL_OFF() D_P14_OFF()
|
|
#endif
|
|
|
|
#define D_LPCD_INT_INIT(); P_SW2|=0x80;IT0 = 1;//下降沿中断
|
|
#define D_LPCD_INT_OPEN(); EX0 = 1;
|
|
#define D_LPCD_INT_CLOSE(); EX0 = 0;
|
|
|
|
#define D_RTC_INT_INIT(); INTCLKO = EX2;
|
|
#define D_RTC_INT_OPEN(); INTCLKO = EX2;
|
|
#define D_RTC_INT_CLOSE(); INTCLKO = 0;
|
|
|
|
|
|
#define D_MSA_INT_INIT(); IT1 = 1;//下降沿中断
|
|
#define D_MSA_INT_OPEN(); EX1 = 1;
|
|
#define D_MSA_INT_CLOSE(); EX1 = 0;
|
|
|
|
|
|
typedef struct
|
|
{
|
|
U8 time_f;
|
|
U8 clear_dog;
|
|
U8 weak_up;
|
|
U8 dog_ok;
|
|
U8 who_wake; /// 谁让我醒来 =D_int_RTC 20221002_18542 CCmodify
|
|
vU16 sleeptime; ///系统休眠的时间间隔
|
|
vU16 sleeptime_left; ///系统休眠的时间间隔
|
|
U8 start_sleep; ///上电后多久进入睡眠状态 时间颗粒1秒
|
|
U8 nb_status;
|
|
}TS_low_time;
|
|
extern TS_low_time ts_low_time;
|
|
|
|
|
|
|
|
/***********
|
|
|
|
|
|
|
|
#define L0_IICM1_SDA_init() D_stdIO_P4(BITN2)
|
|
#define L0_IICM1_SDA_OUT() D_P42_OUT()
|
|
#define L0_IICM1_SDA_IN() D_P42_IN()
|
|
#define L0_IICM1_SDA_ON() D_P42_ON()
|
|
#define L0_IICM1_SDA_OFF() D_P42_OFF()
|
|
#define L0_IICM1_SDA_AT() D_P42_AT()
|
|
|
|
#define L0_IICM1_SCL_init() D_stdIO_P4(BITN1)
|
|
|
|
#define L0_IICM1_SCL_OUT() D_P41_OUT()
|
|
#define L0_IICM1_SCL_IN() D_P41_IN()
|
|
#define L0_IICM1_SCL_ON() D_P41_ON()
|
|
#define L0_IICM1_SCL_OFF() D_P41_OFF()
|
|
|
|
***********/
|
|
|
|
#else
|
|
#error "未指定当前板卡"
|
|
|
|
|
|
#endif///#if(TYPE_UASER_BOARD
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//STEP 3 Register CONFIG >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
|
|
|
|
|
|
//STEP 5 <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<Uart CONFIG
|
|
#define SERIAL_MAX_NUM 1
|
|
////fixme:和cpu的程序容量息息相关
|
|
/// 9600bps = 10000bps = 1000 Bps = 1Byte/ms
|
|
/// 19200bps = 20000bps = 2000Bps = 2Byte/ms = 1Byte/0.5ms
|
|
/// 128Bytes = 128*0.5ms = 64ms
|
|
#define D_UART_send_buf2_max 8 //此处改动会影响L0_uartN_ulhex函数
|
|
//STEP 5 <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<Uart CONFIG End
|
|
|
|
|
|
|
|
//======================================================== 以下为协议配置 ====================================================
|
|
#define D_CMD_Filter1_ff 0xFF
|
|
#define D_CMD_Filter2_fe 0xFE
|
|
#define D_HETU_FX_fi 0xF0
|
|
#define D_HETU_FX_MASK 0x0F
|
|
#define D_tp_handle_x_len 32
|
|
|
|
//STEP 6 <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<Transmission Protocol Config
|
|
#define D_TPC_CCMODBUS_Filter0 0xFF
|
|
#define D_TPC_CCMODBUS_Filter1 0xFE
|
|
#define D_TPC_DEBUG_FX_fi 0xF0
|
|
#define D_TPC_DEBUG_FX_MASK 0x0F
|
|
#define D_TPC_HANDLER_X_LEN 128
|
|
|
|
extern void L0_board_config(void);
|
|
extern void L0_reg_init(void);
|
|
extern void L3_reg_2_iap(void);
|
|
extern void L3_iap_2_reg(void);
|
|
extern void L0_uartboard_config(void);
|
|
|
|
void L0_moto_init(unsigned char onf);
|
|
|
|
void L0_moto_run(unsigned char mode);
|
|
|
|
////#pragma message("#pragma message验证测试")
|
|
/// pack(4)
|
|
|
|
typedef struct
|
|
{
|
|
u8 req;
|
|
u8 mac[6];/// 1、帧头: 帧起始标志,固定值为 0x68。
|
|
u8 netid;
|
|
u8 band;
|
|
u8 buf[12];
|
|
}TS_para_;
|
|
extern TS_para_ ts_para;
|
|
|
|
///#pragma pack()
|
|
|
|
|
|
void L0_board_key(void);
|
|
|
|
#endif//_BSP_CONFIG_H
|
|
/*********************************end file*********************************************/
|
|
|
|
|
|
|
|
|
|
|