1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071 |
- #include "rs485.h"
- //-------------参数定义
- rs485RecDate s_rs485RecDate;
- rs485SendDate s_rs485SendDate;
- /**
- * @brief crc16计算
- * @param ptr: 数据首地址
- * @param len: 数据长度
- * @return
- */
- unsigned short mb_crc16(unsigned char *ptr, int len)
- {
- unsigned int i;
- unsigned short crc = 0xFFFF;
-
- while(len--)
- {
- crc ^= *ptr++;
- for (i = 0; i < 8; ++i)
- {
- if (crc & 1)
- crc = (crc >> 1) ^ 0xA001;
- else
- crc = (crc >> 1);
- }
- }
-
- return crc;
- }
- /**
- * @brief 485发送函数
- * @param data: 发送的数据
- * @param dataLen: 发送的数据长度
- * @note
- * @retval 无
- */
- void rs485_sendDate(uint8 data[], uint32_t dataLen){
-
- }
- /**
- * @brief 485接收分析函数
- * @param data: 接收到的数据
- * @note
- * @retval 无
- */
- void rs485_recDateAnalyse(uint8 data[]){
-
- }
- /**
- * @brief 轮询发送接收
- * @note
- * @retval 无
- */
- void rs485_poll_sendReceive(void){
- static uint8_t rs485Step = 0;
- switch(rs485Step){
- case 0:
- break;
- case 1:
- break;
- default: break;
- }
- }
|