添加了4G部分函数
This commit is contained in:
parent
926187cd17
commit
a0b3ad50f3
|
@ -174,7 +174,7 @@
|
||||||
</toolChain>
|
</toolChain>
|
||||||
</folderInfo>
|
</folderInfo>
|
||||||
<sourceEntries>
|
<sourceEntries>
|
||||||
<entry excluding="libraries/hal_drivers/drv_usbh.h|libraries/hal_drivers/drv_usbh.c|libraries/hal_drivers/drv_usbd.h|libraries/hal_drivers/drv_usbd.c|libraries/hal_drivers/drv_i2c.h|libraries/hal_drivers/drv_i2c.c|libraries/hal_drivers/drv_eth.h|libraries/hal_drivers/drv_eth.c|common/mb26s|common/AT Command|rt-thread/components/net/at/src/at_server.c|libraries/hal_libraries/bmsis/source/startup_ch32v30x_D8C.S|libraries/hal_drivers/drv_spi.h|libraries/hal_drivers/drv_spi.c|libraries/hal_drivers/drv_soft_spi.h|libraries/hal_drivers/drv_soft_spi.c|libraries/hal_drivers/drv_soft_i2c.h|libraries/hal_drivers/drv_soft_i2c.c|libraries/hal_drivers/drv_rtc.h|libraries/hal_drivers/drv_rtc.c|libraries/hal_drivers/drv_pwm.h|libraries/hal_drivers/drv_pwm.c|libraries/hal_drivers/drv_log.h|libraries/hal_drivers/drv_iwdt.c|libraries/hal_drivers/drv_dac.h|libraries/hal_drivers/drv_dac.c|libraries/hal_drivers/drv_can.h|libraries/hal_drivers/drv_can.c|libraries/hal_drivers/drv_adc.h|libraries/hal_drivers/drv_adc.c|rt-thread/components/drivers/spi|rt-thread/components/libc|rt-thread/components/drivers/spi/sfud|bsp/src/bsp_aht20.c|Startup|Ld|Core" flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name=""/>
|
<entry excluding="libraries/hal_drivers/drv_usbh.h|libraries/hal_drivers/drv_usbh.c|libraries/hal_drivers/drv_usbd.h|libraries/hal_drivers/drv_usbd.c|libraries/hal_drivers/drv_i2c.h|libraries/hal_drivers/drv_i2c.c|libraries/hal_drivers/drv_eth.h|libraries/hal_drivers/drv_eth.c|common/ml307s|common/AT Command|rt-thread/components/net/at/src/at_server.c|libraries/hal_libraries/bmsis/source/startup_ch32v30x_D8C.S|libraries/hal_drivers/drv_spi.h|libraries/hal_drivers/drv_spi.c|libraries/hal_drivers/drv_soft_spi.h|libraries/hal_drivers/drv_soft_spi.c|libraries/hal_drivers/drv_soft_i2c.h|libraries/hal_drivers/drv_soft_i2c.c|libraries/hal_drivers/drv_rtc.h|libraries/hal_drivers/drv_rtc.c|libraries/hal_drivers/drv_pwm.h|libraries/hal_drivers/drv_pwm.c|libraries/hal_drivers/drv_log.h|libraries/hal_drivers/drv_iwdt.c|libraries/hal_drivers/drv_dac.h|libraries/hal_drivers/drv_dac.c|libraries/hal_drivers/drv_can.h|libraries/hal_drivers/drv_can.c|libraries/hal_drivers/drv_adc.h|libraries/hal_drivers/drv_adc.c|rt-thread/components/drivers/spi|rt-thread/components/libc|rt-thread/components/drivers/spi/sfud|bsp/src/bsp_aht20.c|Startup|Ld|Core" flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name=""/>
|
||||||
<entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name="Ld"/>
|
<entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name="Ld"/>
|
||||||
</sourceEntries>
|
</sourceEntries>
|
||||||
</configuration>
|
</configuration>
|
||||||
|
|
|
@ -4,10 +4,10 @@ encoding//applications/main.c=UTF-8
|
||||||
encoding//applications/user_sys.h=UTF-8
|
encoding//applications/user_sys.h=UTF-8
|
||||||
encoding//board/board.c=UTF-8
|
encoding//board/board.c=UTF-8
|
||||||
encoding//board/board.h=UTF-8
|
encoding//board/board.h=UTF-8
|
||||||
encoding//bsp/inc/at_device_mb26.h=GBK
|
encoding//bsp/inc/at_device_ml307.h=GBK
|
||||||
encoding//bsp/inc/bsp_hr.h=GBK
|
encoding//bsp/inc/bsp_hr.h=GBK
|
||||||
encoding//bsp/inc/bsp_led.h=UTF-8
|
encoding//bsp/inc/bsp_led.h=UTF-8
|
||||||
encoding//bsp/src/at_device_mb26.c=UTF-8
|
encoding//bsp/src/at_device_ml307.c=UTF-8
|
||||||
encoding//bsp/src/bsp_button.c=GBK
|
encoding//bsp/src/bsp_button.c=GBK
|
||||||
encoding//bsp/src/bsp_flash.c=UTF-8
|
encoding//bsp/src/bsp_flash.c=UTF-8
|
||||||
encoding//bsp/src/bsp_led.c=GBK
|
encoding//bsp/src/bsp_led.c=GBK
|
||||||
|
|
|
@ -37,7 +37,7 @@
|
||||||
"pin.h": "c",
|
"pin.h": "c",
|
||||||
"cstring": "c",
|
"cstring": "c",
|
||||||
"bsp_beep.h": "c",
|
"bsp_beep.h": "c",
|
||||||
"at_device_mb26.h": "c",
|
"at_device_ml307.h": "c",
|
||||||
"at_log.h": "c",
|
"at_log.h": "c",
|
||||||
"at_device.h": "c",
|
"at_device.h": "c",
|
||||||
"stdlib.h": "c",
|
"stdlib.h": "c",
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
* @Author: mbw
|
* @Author: mbw
|
||||||
* @Date: 2024-10-23 17:14:16
|
* @Date: 2024-10-23 17:14:16
|
||||||
* @LastEditors: mbw && 1600520629@qq.com
|
* @LastEditors: mbw && 1600520629@qq.com
|
||||||
* @LastEditTime: 2024-12-01 15:55:01
|
* @LastEditTime: 2024-12-02 09:03:56
|
||||||
* @FilePath: \ble_bjq_ch303rct6_ml307\applications\main.c
|
* @FilePath: \ble_bjq_ch303rct6_ml307\applications\main.c
|
||||||
* @Descrt_thread_
|
* @Descrt_thread_
|
||||||
*
|
*
|
||||||
|
@ -22,7 +22,7 @@
|
||||||
#include "bsp_hr.h"
|
#include "bsp_hr.h"
|
||||||
#include "bsp_mq.h"
|
#include "bsp_mq.h"
|
||||||
#include "bsp_button.h"
|
#include "bsp_button.h"
|
||||||
#include "bsp_mb26.h"
|
#include "bsp_ml307.h"
|
||||||
#include "bsp_vin_detection.h"
|
#include "bsp_vin_detection.h"
|
||||||
#include "user_sys.h"
|
#include "user_sys.h"
|
||||||
|
|
||||||
|
@ -39,6 +39,8 @@ rt_bool_t is_event_initialized = RT_FALSE; // 是否初始化完成
|
||||||
TsSysControl SysControl;
|
TsSysControl SysControl;
|
||||||
|
|
||||||
struct rt_timer work_cnt_timer;
|
struct rt_timer work_cnt_timer;
|
||||||
|
struct rt_timer preheat_timer;//传统模式需要进行预热,
|
||||||
|
|
||||||
void Send_Laser_Alarm_Event(AlarmEvent event_type);
|
void Send_Laser_Alarm_Event(AlarmEvent event_type);
|
||||||
|
|
||||||
TeCalibrationStatus g_Calibration_status = kNotCalibrated;
|
TeCalibrationStatus g_Calibration_status = kNotCalibrated;
|
||||||
|
@ -137,6 +139,11 @@ void Work_Cnt_Timer_Callback(void *parameter)
|
||||||
Send_Laser_Alarm_Event(kSensorFailureEvent);
|
Send_Laser_Alarm_Event(kSensorFailureEvent);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Preheat_Timer_Callback(void *parameter)
|
||||||
|
{
|
||||||
|
Send_Laser_Alarm_Event(kNormalDetectionEvents);
|
||||||
|
}
|
||||||
int main(void)
|
int main(void)
|
||||||
{
|
{
|
||||||
// 定义超时时间,单位为毫秒
|
// 定义超时时间,单位为毫秒
|
||||||
|
@ -195,8 +202,14 @@ int main(void)
|
||||||
Work_Cnt_Timer_Callback,
|
Work_Cnt_Timer_Callback,
|
||||||
RT_NULL,
|
RT_NULL,
|
||||||
WORK_TIMER_CNT,
|
WORK_TIMER_CNT,
|
||||||
RT_TIMER_FLAG_PERIODIC);
|
RT_TIMER_FLAG_SOFT_TIMER|RT_TIMER_FLAG_PERIODIC);
|
||||||
rt_timer_start(&work_cnt_timer);
|
rt_timer_start(&work_cnt_timer);
|
||||||
|
rt_timer_init(&preheat_timer,
|
||||||
|
"preheat_timer",
|
||||||
|
Preheat_Timer_Callback,
|
||||||
|
RT_NULL,
|
||||||
|
TIMEOUT_MS,
|
||||||
|
RT_TIMER_FLAG_SOFT_TIMER|RT_TIMER_FLAG_ONE_SHOT);
|
||||||
if (Get_VIN_VoltageInt1000x() > 10000)
|
if (Get_VIN_VoltageInt1000x() > 10000)
|
||||||
{
|
{
|
||||||
// 检测上电/掉电复位标志
|
// 检测上电/掉电复位标志
|
||||||
|
@ -270,7 +283,8 @@ int main(void)
|
||||||
LED_STOP(g);
|
LED_STOP(g);
|
||||||
LED_STOP(y);
|
LED_STOP(y);
|
||||||
LOG_D("预热完成");
|
LOG_D("预热完成");
|
||||||
Send_Laser_Alarm_Event(kNormalDetectionEvents);
|
rt_timer_start(&preheat_timer);
|
||||||
|
|
||||||
}
|
}
|
||||||
else if (received_event & Get_Sys_Event_Flag(kNormalDetectionEvents)) // 正常检测
|
else if (received_event & Get_Sys_Event_Flag(kNormalDetectionEvents)) // 正常检测
|
||||||
{
|
{
|
||||||
|
@ -278,8 +292,8 @@ int main(void)
|
||||||
|
|
||||||
SysControl.last_status = SysControl.status;
|
SysControl.last_status = SysControl.status;
|
||||||
SysControl.status = kNormalDetectionEvents;
|
SysControl.status = kNormalDetectionEvents;
|
||||||
#if (NB_MODULE_SWITCH == 1)
|
#if (IOT_MODULE_SWITCH == 1)
|
||||||
if (mb26_conncet_tcp_flag)
|
if (ml307_conncet_tcp_flag)
|
||||||
{
|
{
|
||||||
LED_G_INTERNET;
|
LED_G_INTERNET;
|
||||||
}
|
}
|
||||||
|
@ -287,7 +301,7 @@ int main(void)
|
||||||
{
|
{
|
||||||
#endif
|
#endif
|
||||||
LED_G_NORMAL;
|
LED_G_NORMAL;
|
||||||
#if (NB_MODULE_SWITCH == 1)
|
#if (IOT_MODULE_SWITCH == 1)
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
rt_thread_mdelay(10);
|
rt_thread_mdelay(10);
|
||||||
|
@ -315,8 +329,8 @@ int main(void)
|
||||||
LED_R_ALARM;
|
LED_R_ALARM;
|
||||||
BEEP_ALARM;
|
BEEP_ALARM;
|
||||||
|
|
||||||
#if (NB_MODULE_SWITCH == 1)
|
#if (IOT_MODULE_SWITCH == 1)
|
||||||
Mb26_Send_Event(kMb26AlarmEvent);
|
Ml307_Send_Event(kMl307AlarmEvent);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
else if (received_event & Get_Sys_Event_Flag(kAlarmRcyEvent)) // 报警恢复
|
else if (received_event & Get_Sys_Event_Flag(kAlarmRcyEvent)) // 报警恢复
|
||||||
|
@ -330,8 +344,8 @@ int main(void)
|
||||||
|
|
||||||
BEEP_STOP;
|
BEEP_STOP;
|
||||||
|
|
||||||
#if (NB_MODULE_SWITCH == 1)
|
#if (IOT_MODULE_SWITCH == 1)
|
||||||
Mb26_Send_Event(kMb26AlarmRcyEvent);
|
Ml307_Send_Event(kMl307AlarmRcyEvent);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
Send_Laser_Alarm_Event(kNormalDetectionEvents);
|
Send_Laser_Alarm_Event(kNormalDetectionEvents);
|
||||||
|
@ -348,8 +362,8 @@ int main(void)
|
||||||
LED_Y_FAULT;
|
LED_Y_FAULT;
|
||||||
BEEP_FAULT;
|
BEEP_FAULT;
|
||||||
|
|
||||||
#if (NB_MODULE_SWITCH == 1)
|
#if (IOT_MODULE_SWITCH == 1)
|
||||||
Mb26_Send_Event(kMb26FaultEvent);
|
Ml307_Send_Event(kMl307FaultEvent);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
else if (received_event & Get_Sys_Event_Flag(kFaultRcyEvent)) // 故障恢复
|
else if (received_event & Get_Sys_Event_Flag(kFaultRcyEvent)) // 故障恢复
|
||||||
|
@ -364,8 +378,8 @@ int main(void)
|
||||||
BEEP_STOP;
|
BEEP_STOP;
|
||||||
|
|
||||||
Send_Laser_Alarm_Event(kNormalDetectionEvents);
|
Send_Laser_Alarm_Event(kNormalDetectionEvents);
|
||||||
#if (NB_MODULE_SWITCH == 1)
|
#if (IOT_MODULE_SWITCH == 1)
|
||||||
Mb26_Send_Event(kMb26FaultRcyEvent);
|
Ml307_Send_Event(kMl307FaultRcyEvent);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
else if (received_event & Get_Sys_Event_Flag(KMuteEvent)) // 消音
|
else if (received_event & Get_Sys_Event_Flag(KMuteEvent)) // 消音
|
||||||
|
@ -374,8 +388,8 @@ int main(void)
|
||||||
SysControl.last_status = SysControl.status;
|
SysControl.last_status = SysControl.status;
|
||||||
SysControl.status = KMuteEvent;
|
SysControl.status = KMuteEvent;
|
||||||
|
|
||||||
#if (NB_MODULE_SWITCH == 1)
|
#if (IOT_MODULE_SWITCH == 1)
|
||||||
Mb26_Send_Event(kMb26SilenceEvent);
|
Ml307_Send_Event(kMl307SilenceEvent);
|
||||||
#endif
|
#endif
|
||||||
BEEP_STOP;
|
BEEP_STOP;
|
||||||
}
|
}
|
||||||
|
@ -391,8 +405,8 @@ int main(void)
|
||||||
Flash_Write_Record(kRecordPowerDown);
|
Flash_Write_Record(kRecordPowerDown);
|
||||||
|
|
||||||
Flash_Set_WorkDuration(work_duration); // 写入工作时长
|
Flash_Set_WorkDuration(work_duration); // 写入工作时长
|
||||||
#if (NB_MODULE_SWITCH == 1)
|
#if (IOT_MODULE_SWITCH == 1)
|
||||||
Mb26_Send_Event(kMb26PowerDownEvent);
|
Ml307_Send_Event(kMl307PowerDownEvent);
|
||||||
#endif
|
#endif
|
||||||
LOG_D("Enter AnalogWatchdog Interrupt");
|
LOG_D("Enter AnalogWatchdog Interrupt");
|
||||||
|
|
||||||
|
@ -415,8 +429,8 @@ int main(void)
|
||||||
|
|
||||||
_Self_Check_Mode();
|
_Self_Check_Mode();
|
||||||
Send_Laser_Alarm_Event(SysControl.last_status);
|
Send_Laser_Alarm_Event(SysControl.last_status);
|
||||||
#if (NB_MODULE_SWITCH == 1)
|
#if (IOT_MODULE_SWITCH == 1)
|
||||||
Mb26_Send_Event(kMb26SelfCheckEvent);
|
Ml307_Send_Event(kMl307SelfCheckEvent);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
else if (received_event & Get_Sys_Event_Flag(kSensorFailureEvent)) // 失效
|
else if (received_event & Get_Sys_Event_Flag(kSensorFailureEvent)) // 失效
|
||||||
|
|
|
@ -2,8 +2,8 @@
|
||||||
* @Author: mbw
|
* @Author: mbw
|
||||||
* @Date: 2024-10-09 08:42:14
|
* @Date: 2024-10-09 08:42:14
|
||||||
* @LastEditors: mbw && 1600520629@qq.com
|
* @LastEditors: mbw && 1600520629@qq.com
|
||||||
* @LastEditTime: 2024-11-07 14:21:17
|
* @LastEditTime: 2024-12-02 16:54:17
|
||||||
* @FilePath: \JT-DT-YD4N02A_RTT_MRS\bsp\inc\at_device_mb26.h
|
* @FilePath: \ble_bjq_ch303rct6_ml307\bsp\inc\at_device_ml307.h
|
||||||
* @Description:
|
* @Description:
|
||||||
* @
|
* @
|
||||||
* @Copyright (c) 2024 by ${git_name_email}, All Rights Reserved.
|
* @Copyright (c) 2024 by ${git_name_email}, All Rights Reserved.
|
||||||
|
@ -13,25 +13,25 @@
|
||||||
* @Date: 2024-10-09 08:42:14
|
* @Date: 2024-10-09 08:42:14
|
||||||
* @LastEditors: mbw && 1600520629@qq.com
|
* @LastEditors: mbw && 1600520629@qq.com
|
||||||
* @LastEditTime: 2024-10-14 14:25:58
|
* @LastEditTime: 2024-10-14 14:25:58
|
||||||
* @FilePath: \JT-DT-YD4N02A_RTT_MRS\bsp\inc\at_device_mb26.h
|
* @FilePath: \JT-DT-YD4N02A_RTT_MRS\bsp\inc\at_device_ml307.h
|
||||||
* @Description:
|
* @Description:
|
||||||
* @
|
* @
|
||||||
* @Copyright (c) 2024 by ${git_name_email}, All Rights Reserved.
|
* @Copyright (c) 2024 by ${git_name_email}, All Rights Reserved.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef __AT_DEVICE_MB26_H__
|
#ifndef __AT_DEVICE_ML307_H__
|
||||||
#define __AT_DEVICE_MB26_H__
|
#define __AT_DEVICE_ML307_H__
|
||||||
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
|
||||||
#include <at_device.h>
|
#include <at_device.h>
|
||||||
#include "completion.h"
|
#include "completion.h"
|
||||||
|
|
||||||
#define TCP_SERVER_URL ("47.94.169.135") //
|
/*测试地址*/
|
||||||
#define TCP_SERVER_PORT ("7150")
|
#if 0
|
||||||
|
#define TCP_SERVER_URL ("8.135.10.183 ") //
|
||||||
//#define TCP_SERVER_URL ("8.135.10.183 ") //
|
#define TCP_SERVER_PORT ("35383")
|
||||||
//#define TCP_SERVER_PORT ("35383")
|
#endif
|
||||||
|
|
||||||
#define AT_NSONMI_MODE_1 1
|
#define AT_NSONMI_MODE_1 1
|
||||||
#define AT_NSONMI_MODE_2 2
|
#define AT_NSONMI_MODE_2 2
|
||||||
|
@ -44,24 +44,23 @@
|
||||||
#define AT_SEND_MSOSD_FLAG_DEFAULT AT_SEND_MSOSD_FLAG_100
|
#define AT_SEND_MSOSD_FLAG_DEFAULT AT_SEND_MSOSD_FLAG_100
|
||||||
|
|
||||||
#define TCP_GET_SOCKET_STATUS ("AT+NSOSTATUS=%d")
|
#define TCP_GET_SOCKET_STATUS ("AT+NSOSTATUS=%d")
|
||||||
#define TCP_SOCKET_CREAT ("AT+NSOCR=STREAM,6,%s") // port socket_port
|
#define TCP_CONNECT_CMD ("AT+MIPOPEN=%d,\"TCP\",\"%s\",%s") //AT+MIPOPEN=0,"TCP","120.27.12.119",2040 建立TCP连接
|
||||||
#define TCP_CONNECT_CMD ("AT+NSOCO=%d,%s,%s")
|
#define TCP_CONNECT_STATE ("AT+MIPSTATE=%d")//AT+MIPSTATE=0 //查询指定连接的连接状态
|
||||||
#define TCP_READ_SET_CMD ("AT+NSORF=%d,%d") /* socket_id,length */
|
#define TCP_SEND_DATA ("AT+MIPSEND=%d,%d,\"%s\"") //第一个参数一般设为0,表示使用自动分配的
|
||||||
#define TCP_SET_NSONMI ("AT+NSONMI=%d")
|
#define TCP_CLOSE_SOCKET ("AT+MIPCLOSE=%d") /* close socket_id */
|
||||||
#define TCP_SEND_DATA ("AT+NSOSD=%d,%d,%s,%s")
|
|
||||||
#define TCP_CLOSE_SOCKET ("AT+NSOCL=%d") /* close socket_id */
|
|
||||||
|
|
||||||
#define AT_DEVICE_MB26_SOCKETS_NUM 5
|
#define AT_DEVICE_ML307_SOCKETS_NUM 5
|
||||||
/* The maximum number of sockets supported by the mb26 device */
|
/* The maximum number of sockets supported by the ml307 device */
|
||||||
|
|
||||||
struct at_device_mb26
|
struct at_device_ml307
|
||||||
{
|
{
|
||||||
char *device_name;
|
char *device_name;
|
||||||
char *client_name;
|
char *client_name;
|
||||||
|
|
||||||
int pwr_en_pin;
|
int pwr_en_pin;
|
||||||
|
int power_pin;
|
||||||
int rst_pin;
|
int rst_pin;
|
||||||
int wkp_pin;
|
int power_status_pin;
|
||||||
size_t recv_line_num;
|
size_t recv_line_num;
|
||||||
struct at_device device;
|
struct at_device device;
|
||||||
|
|
||||||
|
@ -82,13 +81,13 @@ typedef struct __attribute__((packed))
|
||||||
uint8_t rsrq; // RSRQ
|
uint8_t rsrq; // RSRQ
|
||||||
uint16_t pci; // PCI
|
uint16_t pci; // PCI
|
||||||
uint8_t snr; // SNR
|
uint8_t snr; // SNR
|
||||||
} mb26_sys_info;
|
} ml307_sys_info;
|
||||||
|
|
||||||
extern mb26_sys_info mb26;
|
extern ml307_sys_info ml307;
|
||||||
extern rt_uint8_t mb26_init_complate_flag;
|
extern rt_uint8_t ml307_init_complate_flag;
|
||||||
extern struct rt_completion mb26_init_complate;
|
extern struct rt_completion ml307_init_complate;
|
||||||
|
|
||||||
int at_send_data(struct at_device *device, const char *data, rt_size_t size);
|
int at_send_data(struct at_device *device, const char *data, rt_size_t size);
|
||||||
rt_err_t Mb26_Reset(struct at_device *device);
|
rt_err_t Ml307_Reset(struct at_device *device);
|
||||||
int Time_Calibration(struct at_device *device);
|
int Time_Calibration(struct at_device *device);
|
||||||
#endif /* __AT_DEVICE_MB26_H__ */
|
#endif /* __AT_DEVICE_ML307_H__ */
|
|
@ -224,14 +224,14 @@ typedef enum
|
||||||
kSwVerId,
|
kSwVerId,
|
||||||
kAlarmLValueId,
|
kAlarmLValueId,
|
||||||
kAlarmHValueId,
|
kAlarmHValueId,
|
||||||
kNbUploadCycleId,
|
kIotUploadCycleId,
|
||||||
kNbRetryId,
|
kIotRetryId,
|
||||||
kTempAlarmThresholdId, // 温度报警阈值
|
kTempAlarmThresholdId, // 温度报警阈值
|
||||||
kEmagneticSwitchId, // 电磁阀功能开启
|
kEmagneticSwitchId, // 电磁阀功能开启
|
||||||
kRelaySwitchId, // 继电器功能开启
|
kRelaySwitchId, // 继电器功能开启
|
||||||
kNbImeiId,
|
kIotImeiId,
|
||||||
kNbImsiId,
|
kIotImsiId,
|
||||||
kNbIccidId,
|
kIotIccidId,
|
||||||
kCnt
|
kCnt
|
||||||
} TeFlashCfgInfoId;
|
} TeFlashCfgInfoId;
|
||||||
|
|
||||||
|
@ -261,9 +261,9 @@ struct flash_sever_info
|
||||||
extern struct flash_sever_info sever_info;
|
extern struct flash_sever_info sever_info;
|
||||||
|
|
||||||
void Flash_Write_Record(TeRecord record);
|
void Flash_Write_Record(TeRecord record);
|
||||||
int Get_Nb_Imei(char *buf, rt_size_t len);
|
int Get_Iot_Imei(char *buf, rt_size_t len);
|
||||||
int Get_Nb_Imsi(char *buf, rt_size_t len);
|
int Get_Iot_Imsi(char *buf, rt_size_t len);
|
||||||
int Get_Nb_Iccid(char *buf, rt_size_t len);
|
int Get_Iot_Iccid(char *buf, rt_size_t len);
|
||||||
|
|
||||||
rt_uint8_t Flash_GetNum_Records(TeRecord record);
|
rt_uint8_t Flash_GetNum_Records(TeRecord record);
|
||||||
|
|
||||||
|
@ -296,8 +296,8 @@ rt_uint8_t Flash_Sys_Cfg(TeFlashCfgInfoId id, rt_uint8_t *buf, rt_size_t len);
|
||||||
|
|
||||||
size_t Flash_Get_SysCfg(TeFlashCfgInfoId id);
|
size_t Flash_Get_SysCfg(TeFlashCfgInfoId id);
|
||||||
int BSP_Flash_Write_Info(rt_uint8_t *buf, rt_size_t len);
|
int BSP_Flash_Write_Info(rt_uint8_t *buf, rt_size_t len);
|
||||||
int Flash_Get_Sever_Data(struct flash_sever_info *sever_info);
|
int Flash_Get_Sever_Addr_Info(struct flash_sever_info *sever_info);
|
||||||
int Flash_Set_Sever_Data(rt_uint8_t *data);
|
int Flash_Set_Sever_Addr_Info(rt_uint8_t *data);
|
||||||
rt_uint16_t Flash_Get_WorkDuration(void);
|
rt_uint16_t Flash_Get_WorkDuration(void);
|
||||||
int Flash_Set_WorkDuration(rt_uint16_t value);
|
int Flash_Set_WorkDuration(rt_uint16_t value);
|
||||||
|
|
||||||
|
|
|
@ -73,7 +73,7 @@ extern agile_led_t *led_y;
|
||||||
LED_STOP(r); \
|
LED_STOP(r); \
|
||||||
LED_STOP(g); \
|
LED_STOP(g); \
|
||||||
LED_STOP(y); \
|
LED_STOP(y); \
|
||||||
LED_CTRL(g, "200,200", -1);\
|
LED_CTRL(g, "100,2000", -1);\
|
||||||
LED_START(g);\
|
LED_START(g);\
|
||||||
} while (0U)
|
} while (0U)
|
||||||
|
|
||||||
|
|
|
@ -3,30 +3,20 @@
|
||||||
* @Date: 2024-10-09 08:42:14
|
* @Date: 2024-10-09 08:42:14
|
||||||
* @LastEditors: mbw && 1600520629@qq.com
|
* @LastEditors: mbw && 1600520629@qq.com
|
||||||
* @LastEditTime: 2024-10-17 09:26:13
|
* @LastEditTime: 2024-10-17 09:26:13
|
||||||
* @FilePath: \JT-DT-YD4N02A_RTT_MRS\bsp\inc\bsp_mb26.h
|
* @FilePath: \JT-DT-YD4N02A_RTT_MRS\bsp\inc\bsp_ml307.h
|
||||||
* @Description:
|
* @Description:
|
||||||
* @
|
* @
|
||||||
* @Copyright (c) 2024 by ${git_name_email}, All Rights Reserved.
|
* @Copyright (c) 2024 by ${git_name_email}, All Rights Reserved.
|
||||||
*/
|
*/
|
||||||
/***
|
#include <at_device_ml307.h>
|
||||||
* @Author: mbw
|
|
||||||
* @Date: 2024-10-09 08:42:14
|
|
||||||
* @LastEditors: mbw && 1600520629@qq.com
|
|
||||||
* @LastEditTime: 2024-10-16 09:03:41
|
|
||||||
* @FilePath: \JT-DT-YD4N02A_RTT_MRS\bsp\inc\bsp_mb26.h
|
|
||||||
* @Description:
|
|
||||||
* @
|
|
||||||
* @Copyright (c) 2024 by ${git_name_email}, All Rights Reserved.
|
|
||||||
*/
|
|
||||||
#include <at_device_mb26.h>
|
|
||||||
#include "drv_gpio.h"
|
#include "drv_gpio.h"
|
||||||
|
|
||||||
#define MB26_PWR_EN_PIN GET_PIN(B, 3)
|
#define ML307_ENABLE_3_8_V GET_PIN(A, 4)
|
||||||
#define MB26_RST_PIN GET_PIN(A, 11)
|
#define ML307_PWR_PIN GET_PIN(B, 4)
|
||||||
#define MB26_WKP_PIN GET_PIN(C, 7)
|
#define ML307_RST_PIN GET_PIN(B, 5)
|
||||||
|
#define ML307_USIM_DECT_PIN GET_PIN(B, 6)
|
||||||
|
|
||||||
|
#define ML307_SAMPLE_DEIVCE_NAME "ml307"
|
||||||
#define MB26_SAMPLE_DEIVCE_NAME "mb26"
|
|
||||||
|
|
||||||
/*默认参数*/
|
/*默认参数*/
|
||||||
#define DEVICE_MANUFACTURE 0x4454 // DT
|
#define DEVICE_MANUFACTURE 0x4454 // DT
|
||||||
|
@ -44,7 +34,7 @@
|
||||||
#define DATA_SERIAL_NUM 0x0001 // 1
|
#define DATA_SERIAL_NUM 0x0001 // 1
|
||||||
|
|
||||||
/*设备类型*/
|
/*设备类型*/
|
||||||
#define DEVICE_TYPE_MB26 0x20
|
#define DEVICE_TYPE_ML307 0x20
|
||||||
/*事件类型*/
|
/*事件类型*/
|
||||||
#define EVENT_TYPE_HEARTBEAT 0x30 // 心跳事件
|
#define EVENT_TYPE_HEARTBEAT 0x30 // 心跳事件
|
||||||
#define EVENT_TYPE_SELF_CHECK 0x31 // 自检事件
|
#define EVENT_TYPE_SELF_CHECK 0x31 // 自检事件
|
||||||
|
@ -84,8 +74,7 @@
|
||||||
|
|
||||||
#define MAX_DATA_LEN 256 // 数据长度
|
#define MAX_DATA_LEN 256 // 数据长度
|
||||||
|
|
||||||
#define MB26_DEFIENE_DATA "000000000000000000000000000000"
|
#define ML307_DEFIENE_DATA "000000000000000000000000000000"
|
||||||
|
|
||||||
|
|
||||||
#define DEVICE_DEFINE 1 // 具备该设备功能
|
#define DEVICE_DEFINE 1 // 具备该设备功能
|
||||||
#define DEVICE_NOT_DEFINE 0 // 不具备该功能
|
#define DEVICE_NOT_DEFINE 0 // 不具备该功能
|
||||||
|
@ -96,27 +85,27 @@
|
||||||
typedef enum
|
typedef enum
|
||||||
{
|
{
|
||||||
/****************优先级最低***************** */
|
/****************优先级最低***************** */
|
||||||
kMb26HeartbeatEvent, // 定时心跳事件
|
kMl307HeartbeatEvent, // 定时心跳事件
|
||||||
kMb26SilenceEvent, // 消音事件
|
kMl307SilenceEvent, // 消音事件
|
||||||
kMb26ExceptionEvent, // 异常事件
|
kMl307ExceptionEvent, // 异常事件
|
||||||
kMb26ValveStatusEvent, // 电磁阀状态改变事件
|
kMl307ValveStatusEvent, // 电磁阀状态改变事件
|
||||||
kMb26FanStatusEvent, // 风机状态改变事件
|
kMl307FanStatusEvent, // 风机状态改变事件
|
||||||
kMb26TempAnomalyEvent, // 产品工作温度异常事件
|
kMl307TempAnomalyEvent, // 产品工作温度异常事件
|
||||||
kMb26AlarmEvent, // 报警事件
|
kMl307AlarmEvent, // 报警事件
|
||||||
kMb26AlarmRcyEvent, // 报警恢复事件
|
kMl307AlarmRcyEvent, // 报警恢复事件
|
||||||
kMb26FaultEvent, // 故障事件
|
kMl307FaultEvent, // 故障事件
|
||||||
kMb26FaultRcyEvent, // 故障恢复事件
|
kMl307FaultRcyEvent, // 故障恢复事件
|
||||||
kMb26DeviceFailureEvent, // 设备失效事件
|
kMl307DeviceFailureEvent, // 设备失效事件
|
||||||
kMb26TimeCalibrationEvent, // 时间校准事件
|
kMl307TimeCalibrationEvent, // 时间校准事件
|
||||||
/**********************优先级第三************************* */
|
/**********************优先级第三************************* */
|
||||||
kMb26SelfCheckEvent, // 自检事件
|
kMl307SelfCheckEvent, // 自检事件
|
||||||
/**********************优先级第二************************* */
|
/**********************优先级第二************************* */
|
||||||
kMb26PowerDownEvent, // 掉电事件
|
kMl307PowerDownEvent, // 掉电事件
|
||||||
/**********************优先级第一************************* */
|
/**********************优先级第一************************* */
|
||||||
kMb26PowerOnEvent, // 上电事件
|
kMl307PowerOnEvent, // 上电事件
|
||||||
|
|
||||||
kMb26MaxEventcnt // 最大事件计数
|
kMl307MaxEventcnt // 最大事件计数
|
||||||
} Mb26Event; // 当前所处的事件类型
|
} Ml307Event; // 当前所处的事件类型
|
||||||
|
|
||||||
typedef enum
|
typedef enum
|
||||||
{
|
{
|
||||||
|
@ -128,14 +117,13 @@ typedef enum
|
||||||
kSensorFaultStatus, // 传感器故障触发状态
|
kSensorFaultStatus, // 传感器故障触发状态
|
||||||
kSensorRecoveredStatus, // 传感器故障解除状态
|
kSensorRecoveredStatus, // 传感器故障解除状态
|
||||||
kPowerDownStatus, // 掉电状态
|
kPowerDownStatus, // 掉电状态
|
||||||
} Mb26Status; // 当前所处的上报状态
|
} Ml307Status; // 当前所处的上报状态
|
||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
Mb26Event current_event;//当前事件
|
Ml307Event current_event; // 当前事件
|
||||||
Mb26Event last_event;//上次事件
|
Ml307Event last_event; // 上次事件
|
||||||
}Mb26EventIndex;
|
} Ml307EventIndex;
|
||||||
|
|
||||||
|
|
||||||
struct __attribute__((packed)) DataBody
|
struct __attribute__((packed)) DataBody
|
||||||
{
|
{
|
||||||
|
@ -165,7 +153,7 @@ struct __attribute__((packed)) DataBody
|
||||||
};
|
};
|
||||||
|
|
||||||
// 定义数据帧结构体
|
// 定义数据帧结构体
|
||||||
struct __attribute__((packed)) Mb26DataFrame
|
struct __attribute__((packed)) Ml307DataFrame
|
||||||
{
|
{
|
||||||
uint8_t header[3]; // 帧头
|
uint8_t header[3]; // 帧头
|
||||||
uint8_t version; // 协议版本
|
uint8_t version; // 协议版本
|
||||||
|
@ -178,7 +166,7 @@ struct __attribute__((packed)) Mb26DataFrame
|
||||||
uint8_t tail[3]; // 帧尾
|
uint8_t tail[3]; // 帧尾
|
||||||
};
|
};
|
||||||
|
|
||||||
struct __attribute__((packed)) Mb26Data
|
struct __attribute__((packed)) Ml307Data
|
||||||
{
|
{
|
||||||
rt_uint8_t device_type; // 设备类型
|
rt_uint8_t device_type; // 设备类型
|
||||||
rt_uint8_t event_type; // 事件类型
|
rt_uint8_t event_type; // 事件类型
|
||||||
|
@ -186,7 +174,7 @@ struct __attribute__((packed)) Mb26Data
|
||||||
rt_uint8_t res_num;
|
rt_uint8_t res_num;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct __attribute__((packed)) Mb26RecvData
|
struct __attribute__((packed)) Ml307RecvData
|
||||||
{
|
{
|
||||||
rt_uint8_t header[3]; // 帧头
|
rt_uint8_t header[3]; // 帧头
|
||||||
rt_uint8_t version; // 协议版本
|
rt_uint8_t version; // 协议版本
|
||||||
|
@ -194,26 +182,25 @@ struct __attribute__((packed)) Mb26RecvData
|
||||||
rt_uint16_t datanumber; // 数据序列号
|
rt_uint16_t datanumber; // 数据序列号
|
||||||
rt_uint8_t cmd; // 命令位
|
rt_uint8_t cmd; // 命令位
|
||||||
rt_uint16_t datalen; // 数据长度
|
rt_uint16_t datalen; // 数据长度
|
||||||
struct Mb26Data recv_data; // 接收数据体
|
struct Ml307Data recv_data; // 接收数据体
|
||||||
rt_uint16_t crc16; // 校验位
|
rt_uint16_t crc16; // 校验位
|
||||||
rt_uint8_t tail[3]; // 帧尾
|
rt_uint8_t tail[3]; // 帧尾
|
||||||
};
|
};
|
||||||
|
|
||||||
struct Mb26_Ops
|
struct Ml307_Ops
|
||||||
{
|
{
|
||||||
struct DataBody *body;
|
struct DataBody *body;
|
||||||
struct Mb26DataFrame *frame;
|
struct Ml307DataFrame *frame;
|
||||||
struct Mb26RecvData *recv;
|
struct Ml307RecvData *recv;
|
||||||
int (*init)(struct Mb26_Ops *ops, rt_uint8_t version);
|
int (*init)(struct Ml307_Ops *ops, rt_uint8_t version);
|
||||||
int (*update_data)(struct Mb26_Ops *ops, rt_uint8_t device_type, rt_uint8_t cmd);
|
int (*update_data)(struct Ml307_Ops *ops, rt_uint8_t device_type, rt_uint8_t cmd);
|
||||||
int (*send)(struct Mb26_Ops *ops, rt_uint8_t data_num, rt_uint8_t cmd, rt_uint8_t device_type, rt_uint8_t event_type);
|
int (*send)(struct Ml307_Ops *ops, rt_uint8_t data_num, rt_uint8_t cmd, rt_uint8_t device_type, rt_uint8_t event_type);
|
||||||
int (*Resp)(struct Mb26_Ops *ops, rt_uint8_t data_num, rt_uint8_t cmd, rt_uint8_t device_type, rt_uint8_t event_type, char *data, rt_uint8_t res);
|
int (*Resp)(struct Ml307_Ops *ops, rt_uint8_t data_num, rt_uint8_t cmd, rt_uint8_t device_type, rt_uint8_t event_type, char *data, rt_uint8_t res);
|
||||||
int (*Recv)(struct Mb26_Ops *ops, char *data); // 解析数据
|
int (*Recv)(struct Ml307_Ops *ops, char *data); // 解析数据
|
||||||
};
|
};
|
||||||
|
|
||||||
extern struct Mb26_Ops mb26_ops;
|
extern struct Ml307_Ops ml307_ops;
|
||||||
extern rt_sem_t mb26_recv_sem;
|
extern rt_sem_t ml307_recv_sem;
|
||||||
extern rt_uint8_t mb26_conncet_tcp_flag;
|
extern rt_uint8_t ml307_conncet_tcp_flag;
|
||||||
|
|
||||||
|
void Ml307_Send_Event(Ml307Event event_type);
|
||||||
void Mb26_Send_Event(Mb26Event event_type);
|
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
@ -90,7 +90,7 @@ int BSP_ADC_Init(void)
|
||||||
ADC_InitStructure.ADC_ContinuousConvMode = ENABLE; // 连续转换
|
ADC_InitStructure.ADC_ContinuousConvMode = ENABLE; // 连续转换
|
||||||
ADC_InitStructure.ADC_ExternalTrigConv = ADC_ExternalTrigConv_None; // 禁止外部边沿触发
|
ADC_InitStructure.ADC_ExternalTrigConv = ADC_ExternalTrigConv_None; // 禁止外部边沿触发
|
||||||
ADC_InitStructure.ADC_DataAlign = ADC_DataAlign_Right; // 数据右对齐
|
ADC_InitStructure.ADC_DataAlign = ADC_DataAlign_Right; // 数据右对齐
|
||||||
ADC_InitStructure.ADC_NbrOfChannel = NUM_OF_CHANNEL; // 转换通道 (NUM_OF_CHANNEL) 个
|
ADC_InitStructure.ADC_IotrOfChannel = NUM_OF_CHANNEL; // 转换通道 (NUM_OF_CHANNEL) 个
|
||||||
ADC_Init(USED_ADC, &ADC_InitStructure);
|
ADC_Init(USED_ADC, &ADC_InitStructure);
|
||||||
|
|
||||||
// 设置指定ADC的规则组通道,设置它们的转化顺序和采样时间
|
// 设置指定ADC的规则组通道,设置它们的转化顺序和采样时间
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
#include "lwutil.h"
|
#include "lwutil.h"
|
||||||
#include "bsp_rtc.h"
|
#include "bsp_rtc.h"
|
||||||
#include "bsp_hr.h"
|
#include "bsp_hr.h"
|
||||||
#include "at_device_mb26.h"
|
#include "at_device_ml307.h"
|
||||||
#include <rtthread.h>
|
#include <rtthread.h>
|
||||||
#include <rthw.h>
|
#include <rthw.h>
|
||||||
|
|
||||||
|
@ -18,13 +18,13 @@ extern int Convert_To_Hex(const struct flash_sever_info *sever_info, uint8_t *he
|
||||||
: (id) == kAlarmLValueId ? (&(info)->alarm_l_value) \
|
: (id) == kAlarmLValueId ? (&(info)->alarm_l_value) \
|
||||||
: (id) == kAlarmHValueId ? (&(info)->alarm_h_value) \
|
: (id) == kAlarmHValueId ? (&(info)->alarm_h_value) \
|
||||||
: (id) == kTempAlarmThresholdId ? (&(info)->temp_alarm_threshold) \
|
: (id) == kTempAlarmThresholdId ? (&(info)->temp_alarm_threshold) \
|
||||||
: (id) == kNbUploadCycleId ? (&(info)->nb_upload_cycle) \
|
: (id) == kIotUploadCycleId ? (&(info)->nb_upload_cycle) \
|
||||||
: (id) == kNbRetryId ? (&(info)->nb_retry) \
|
: (id) == kIotRetryId ? (&(info)->nb_retry) \
|
||||||
: (id) == kEmagneticSwitchId ? (&(info)->emagnetic_switch) \
|
: (id) == kEmagneticSwitchId ? (&(info)->emagnetic_switch) \
|
||||||
: (id) == kRelaySwitchId ? (&(info)->relay_switch) \
|
: (id) == kRelaySwitchId ? (&(info)->relay_switch) \
|
||||||
: (id) == kNbImeiId ? ((info)->nb_imei) \
|
: (id) == kIotImeiId ? ((info)->nb_imei) \
|
||||||
: (id) == kNbImsiId ? ((info)->nb_imsi) \
|
: (id) == kIotImsiId ? ((info)->nb_imsi) \
|
||||||
: (id) == kNbIccidId ? ((info)->nb_iccid) \
|
: (id) == kIotIccidId ? ((info)->nb_iccid) \
|
||||||
: NULL)
|
: NULL)
|
||||||
|
|
||||||
TsTotalRecords TotalRecords;
|
TsTotalRecords TotalRecords;
|
||||||
|
@ -82,7 +82,7 @@ static rt_base_t interrupt_value;
|
||||||
rt_uint8_t sys_hw_ver = 0x10;
|
rt_uint8_t sys_hw_ver = 0x10;
|
||||||
rt_uint8_t sys_sw_ver = 0x11;
|
rt_uint8_t sys_sw_ver = 0x11;
|
||||||
rt_uint8_t sys_nb_retry = 0x03; // 重试次数3次
|
rt_uint8_t sys_nb_retry = 0x03; // 重试次数3次
|
||||||
rt_uint16_t sys_nb_upload_cycle = 0x7800; // 120分钟一次 ,低位在前,高为在后,为了和服务器下发时保持一致,有利于读取
|
rt_uint16_t sys_nb_upload_cycle = 0x0078; // 120分钟一次
|
||||||
rt_uint16_t sys_alarm_h_value = 0x0032; // 50
|
rt_uint16_t sys_alarm_h_value = 0x0032; // 50
|
||||||
rt_uint16_t sys_alarm_l_value = 0x09C4; // 10
|
rt_uint16_t sys_alarm_l_value = 0x09C4; // 10
|
||||||
rt_uint8_t sys_temp_alarm_threshold = 0x32;
|
rt_uint8_t sys_temp_alarm_threshold = 0x32;
|
||||||
|
@ -91,8 +91,10 @@ rt_uint8_t sys_relay_switch = 0x04; // 具备继电器功能
|
||||||
|
|
||||||
struct flash_sever_info sever_info =
|
struct flash_sever_info sever_info =
|
||||||
{
|
{
|
||||||
.server_url = "47.94.169.135",
|
// .server_url = "47.94.169.135",
|
||||||
.server_port = "7150",
|
// .server_port = "7150",
|
||||||
|
.server_port = "34215",
|
||||||
|
.server_url = "8.135.10.183",
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -150,7 +152,7 @@ static rt_size_t Flash_Read(rt_uint32_t addr, rt_uint8_t *buf, rt_size_t len)
|
||||||
return read_len;
|
return read_len;
|
||||||
}
|
}
|
||||||
|
|
||||||
int Get_Nb_Imei(char *buf, rt_size_t len)
|
int Get_Iot_Imei(char *buf, rt_size_t len)
|
||||||
{
|
{
|
||||||
if ((*(rt_uint8_t *)FLASH_NB_IMEI_ADDR != 0xE3)&&(*(rt_uint8_t *)FLASH_NB_IMEI_ADDR != 0x39))
|
if ((*(rt_uint8_t *)FLASH_NB_IMEI_ADDR != 0xE3)&&(*(rt_uint8_t *)FLASH_NB_IMEI_ADDR != 0x39))
|
||||||
{
|
{
|
||||||
|
@ -171,7 +173,7 @@ int Get_Nb_Imei(char *buf, rt_size_t len)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int Get_Nb_Imsi(char *buf, rt_size_t len)
|
int Get_Iot_Imsi(char *buf, rt_size_t len)
|
||||||
{
|
{
|
||||||
if ((*(rt_uint8_t *)FLASH_NB_IMSI_ADDR != 0xE3)&&(*(rt_uint8_t *)FLASH_NB_IMSI_ADDR != 0x39))
|
if ((*(rt_uint8_t *)FLASH_NB_IMSI_ADDR != 0xE3)&&(*(rt_uint8_t *)FLASH_NB_IMSI_ADDR != 0x39))
|
||||||
{
|
{
|
||||||
|
@ -192,7 +194,7 @@ int Get_Nb_Imsi(char *buf, rt_size_t len)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int Get_Nb_Iccid(char *buf, rt_size_t len)
|
int Get_Iot_Iccid(char *buf, rt_size_t len)
|
||||||
{
|
{
|
||||||
if ((*(rt_uint8_t *)FLASH_NB_ICCID_ADDR != 0xE3)&&(*(rt_uint8_t *)FLASH_NB_ICCID_ADDR != 0x39))
|
if ((*(rt_uint8_t *)FLASH_NB_ICCID_ADDR != 0xE3)&&(*(rt_uint8_t *)FLASH_NB_ICCID_ADDR != 0x39))
|
||||||
{
|
{
|
||||||
|
@ -281,13 +283,13 @@ int Flash_Set_WorkDuration(rt_uint16_t value)
|
||||||
return Flash_Write_ConfigInfo(page_buf);
|
return Flash_Write_ConfigInfo(page_buf);
|
||||||
}
|
}
|
||||||
|
|
||||||
int Flash_Get_Sever_Data(struct flash_sever_info *sever_info)
|
int Flash_Get_Sever_Addr_Info(struct flash_sever_info *sever_info)
|
||||||
{
|
{
|
||||||
rt_uint8_t data[FLASH_SERVER_LEN];
|
rt_uint8_t data[FLASH_SERVER_LEN];
|
||||||
rt_memcpy(data, (rt_uint8_t *)FLASH_SERVER_ADDR_ADDR, FLASH_SERVER_LEN);
|
rt_memcpy(data, (rt_uint8_t *)FLASH_SERVER_ADDR_ADDR, FLASH_SERVER_LEN);
|
||||||
if (data == RT_NULL)
|
if (data == RT_NULL)
|
||||||
{
|
{
|
||||||
LOG_E("Flash_Get_Sever_Data failed");
|
LOG_E("Flash_Get_Sever_Addr_Info failed");
|
||||||
return -RT_ERROR;
|
return -RT_ERROR;
|
||||||
}
|
}
|
||||||
LOG_D("data[%d] = %x data[%d] = %x data[%d] = %x data[%d] = %x data[%d] = %x data[%d] = %x", 0, data[0], 1, data[1], 2, data[2], 3, data[3], 4, data[4], 5, data[5]);
|
LOG_D("data[%d] = %x data[%d] = %x data[%d] = %x data[%d] = %x data[%d] = %x data[%d] = %x", 0, data[0], 1, data[1], 2, data[2], 3, data[3], 4, data[4], 5, data[5]);
|
||||||
|
@ -298,12 +300,12 @@ int Flash_Get_Sever_Data(struct flash_sever_info *sever_info)
|
||||||
LOG_D("port_num = %d", port_num);
|
LOG_D("port_num = %d", port_num);
|
||||||
rt_snprintf(sever_info->server_port, sizeof(sever_info->server_port), "%d", port_num);
|
rt_snprintf(sever_info->server_port, sizeof(sever_info->server_port), "%d", port_num);
|
||||||
|
|
||||||
LOG_D("server_url:%s, server_port:%s", sever_info->server_url, sever_info->server_port);
|
// LOG_D("server_url:%s, server_port:%s", sever_info->server_url, sever_info->server_port);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int Flash_Set_Sever_Data(rt_uint8_t *data)
|
int Flash_Set_Sever_Addr_Info(rt_uint8_t *data)
|
||||||
{
|
{
|
||||||
rt_uint8_t page_buf[FLASH_PAGE_SIZE] = {0};
|
rt_uint8_t page_buf[FLASH_PAGE_SIZE] = {0};
|
||||||
rt_uint8_t in_page_offset = (FLASH_SERVER_ADDR_ADDR - FLASH_CONFIG_INFO_START_ADDR);
|
rt_uint8_t in_page_offset = (FLASH_SERVER_ADDR_ADDR - FLASH_CONFIG_INFO_START_ADDR);
|
||||||
|
@ -871,9 +873,9 @@ int BSP_Flash_Init(void)
|
||||||
LOG_D("%02x", sever_data[i]);
|
LOG_D("%02x", sever_data[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(Flash_Set_Sever_Data(sever_data) <= 0)
|
if(Flash_Set_Sever_Addr_Info(sever_data) <= 0)
|
||||||
{
|
{
|
||||||
LOG_D("Flash_Set_Sever_Data error!");
|
LOG_D("Flash_Set_Sever_Addr_Info error!");
|
||||||
}
|
}
|
||||||
Flash_Set_Calibration_State(kNotCalibrated);//未标定状态
|
Flash_Set_Calibration_State(kNotCalibrated);//未标定状态
|
||||||
|
|
||||||
|
|
|
@ -12,7 +12,7 @@
|
||||||
#include "lwrb.h"
|
#include "lwrb.h"
|
||||||
#include "bsp_flash.h"
|
#include "bsp_flash.h"
|
||||||
#include "bsp_rtc.h"
|
#include "bsp_rtc.h"
|
||||||
#include "at_device_mb26.h"
|
#include "at_device_ml307.h"
|
||||||
#include "user_sys.h"
|
#include "user_sys.h"
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
|
@ -464,9 +464,9 @@ int Process_Factor_Cmd(const char *rx_buff, size_t length)
|
||||||
}
|
}
|
||||||
rt_uint32_t cnt = (rt_uint32_t)((time_buf[2]<<16)| (time_buf[1] << 8)|time_buf[0]);
|
rt_uint32_t cnt = (rt_uint32_t)((time_buf[2]<<16)| (time_buf[1] << 8)|time_buf[0]);
|
||||||
LOG_D("time_buf[2] = %02x time_buf[1] = %02x time_buf[0] = %02x cnt = %04d", time_buf[2], time_buf[1], time_buf[0], cnt);
|
LOG_D("time_buf[2] = %02x time_buf[1] = %02x time_buf[0] = %02x cnt = %04d", time_buf[2], time_buf[1], time_buf[0], cnt);
|
||||||
Get_Nb_Imei(imei, FLASH_NB_IMEI_LEN);
|
Get_Iot_Imei(imei, FLASH_NB_IMEI_LEN);
|
||||||
Get_Nb_Imsi(imsi, FLASH_NB_IMSI_LEN);
|
Get_Iot_Imsi(imsi, FLASH_NB_IMSI_LEN);
|
||||||
Get_Nb_Iccid(iccid, FLASH_NB_ICCID_LEN);
|
Get_Iot_Iccid(iccid, FLASH_NB_ICCID_LEN);
|
||||||
rt_sprintf(buf,
|
rt_sprintf(buf,
|
||||||
"\r\n[ID :YD4N02/%02d%02d%02d%04d]\r\n"
|
"\r\n[ID :YD4N02/%02d%02d%02d%04d]\r\n"
|
||||||
"[IMEI:%s]\r\n"
|
"[IMEI:%s]\r\n"
|
||||||
|
|
1616
bsp/src/bsp_mb26.c
1616
bsp/src/bsp_mb26.c
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
@ -29,7 +29,7 @@ static ADC_HandleTypeDef adc_config[] =
|
||||||
.Init.ADC_ContinuousConvMode = DISABLE, \
|
.Init.ADC_ContinuousConvMode = DISABLE, \
|
||||||
.Init.ADC_ExternalTrigConv = ADC_ExternalTrigConv_None, \
|
.Init.ADC_ExternalTrigConv = ADC_ExternalTrigConv_None, \
|
||||||
.Init.ADC_DataAlign = ADC_DataAlign_Right, \
|
.Init.ADC_DataAlign = ADC_DataAlign_Right, \
|
||||||
.Init.ADC_NbrOfChannel = 1, \
|
.Init.ADC_IotrOfChannel = 1, \
|
||||||
},
|
},
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -41,7 +41,7 @@ static ADC_HandleTypeDef adc_config[] =
|
||||||
.Init.ADC_ContinuousConvMode = DISABLE, \
|
.Init.ADC_ContinuousConvMode = DISABLE, \
|
||||||
.Init.ADC_ExternalTrigConv = ADC_ExternalTrigConv_None, \
|
.Init.ADC_ExternalTrigConv = ADC_ExternalTrigConv_None, \
|
||||||
.Init.ADC_DataAlign = ADC_DataAlign_Right, \
|
.Init.ADC_DataAlign = ADC_DataAlign_Right, \
|
||||||
.Init.ADC_NbrOfChannel = 1, \
|
.Init.ADC_IotrOfChannel = 1, \
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
};
|
};
|
||||||
|
|
|
@ -42,7 +42,7 @@ typedef struct
|
||||||
uint32_t ADC_DataAlign; /* Specifies whether the ADC data alignment is left or right.
|
uint32_t ADC_DataAlign; /* Specifies whether the ADC data alignment is left or right.
|
||||||
This parameter can be a value of @ref ADC_data_align */
|
This parameter can be a value of @ref ADC_data_align */
|
||||||
|
|
||||||
uint8_t ADC_NbrOfChannel; /* Specifies the number of ADC channels that will be converted
|
uint8_t ADC_IotrOfChannel; /* Specifies the number of ADC channels that will be converted
|
||||||
using the sequencer for regular channel group.
|
using the sequencer for regular channel group.
|
||||||
This parameter must range from 1 to 16. */
|
This parameter must range from 1 to 16. */
|
||||||
|
|
||||||
|
|
|
@ -783,7 +783,7 @@ typedef struct __attribute__((packed)) _USB_HUB_DESCR
|
||||||
{
|
{
|
||||||
uint8_t bDescLength;
|
uint8_t bDescLength;
|
||||||
uint8_t bDescriptorType;
|
uint8_t bDescriptorType;
|
||||||
uint8_t bNbrPorts;
|
uint8_t bIotrPorts;
|
||||||
uint8_t wHubCharacteristicsL;
|
uint8_t wHubCharacteristicsL;
|
||||||
uint8_t wHubCharacteristicsH;
|
uint8_t wHubCharacteristicsH;
|
||||||
uint8_t bPwrOn2PwrGood;
|
uint8_t bPwrOn2PwrGood;
|
||||||
|
|
|
@ -163,7 +163,7 @@ void ADC_Init(ADC_TypeDef *ADCx, ADC_InitTypeDef *ADC_InitStruct)
|
||||||
|
|
||||||
tmpreg1 = ADCx->RSQR1;
|
tmpreg1 = ADCx->RSQR1;
|
||||||
tmpreg1 &= RSQR1_CLEAR_Mask;
|
tmpreg1 &= RSQR1_CLEAR_Mask;
|
||||||
tmpreg2 |= (uint8_t)(ADC_InitStruct->ADC_NbrOfChannel - (uint8_t)1);
|
tmpreg2 |= (uint8_t)(ADC_InitStruct->ADC_IotrOfChannel - (uint8_t)1);
|
||||||
tmpreg1 |= (uint32_t)tmpreg2 << 20;
|
tmpreg1 |= (uint32_t)tmpreg2 << 20;
|
||||||
ADCx->RSQR1 = tmpreg1;
|
ADCx->RSQR1 = tmpreg1;
|
||||||
}
|
}
|
||||||
|
@ -186,7 +186,7 @@ void ADC_StructInit(ADC_InitTypeDef *ADC_InitStruct)
|
||||||
ADC_InitStruct->ADC_ContinuousConvMode = DISABLE;
|
ADC_InitStruct->ADC_ContinuousConvMode = DISABLE;
|
||||||
ADC_InitStruct->ADC_ExternalTrigConv = ADC_ExternalTrigConv_T1_CC1;
|
ADC_InitStruct->ADC_ExternalTrigConv = ADC_ExternalTrigConv_T1_CC1;
|
||||||
ADC_InitStruct->ADC_DataAlign = ADC_DataAlign_Right;
|
ADC_InitStruct->ADC_DataAlign = ADC_DataAlign_Right;
|
||||||
ADC_InitStruct->ADC_NbrOfChannel = 1;
|
ADC_InitStruct->ADC_IotrOfChannel = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*********************************************************************
|
/*********************************************************************
|
||||||
|
|
|
@ -113,8 +113,8 @@ typedef unsigned int rt_size_t; /**< Type for size numbe
|
||||||
#endif /* RT_USING_ARCH_DATA_TYPE */
|
#endif /* RT_USING_ARCH_DATA_TYPE */
|
||||||
|
|
||||||
typedef int rt_bool_t; /**< boolean type */
|
typedef int rt_bool_t; /**< boolean type */
|
||||||
typedef long rt_base_t; /**< Nbit CPU related date type */
|
typedef long rt_base_t; /**< Iotit CPU related date type */
|
||||||
typedef unsigned long rt_ubase_t; /**< Nbit unsigned CPU related data type */
|
typedef unsigned long rt_ubase_t; /**< Iotit unsigned CPU related data type */
|
||||||
|
|
||||||
typedef rt_base_t rt_err_t; /**< Type for error number */
|
typedef rt_base_t rt_err_t; /**< Type for error number */
|
||||||
typedef rt_uint32_t rt_time_t; /**< Type for time stamp */
|
typedef rt_uint32_t rt_time_t; /**< Type for time stamp */
|
||||||
|
|
|
@ -149,7 +149,7 @@
|
||||||
#define AT_SW_VERSION_NUM 0x10301
|
#define AT_SW_VERSION_NUM 0x10301
|
||||||
/* end of Network */
|
/* end of Network */
|
||||||
|
|
||||||
#define NB_MODULE_SWITCH 0 // 开启NB物联网功能
|
#define IOT_MODULE_SWITCH 1 // 开启NB物联网功能
|
||||||
/* Utilities */
|
/* Utilities */
|
||||||
|
|
||||||
// #define TEST_ENABLE //打开所有的终端测试程序
|
// #define TEST_ENABLE //打开所有的终端测试程序
|
||||||
|
@ -198,18 +198,14 @@
|
||||||
|
|
||||||
/* end of CYW43439 WiFi */
|
/* end of CYW43439 WiFi */
|
||||||
/* end of Wi-Fi */
|
/* end of Wi-Fi */
|
||||||
// #define PKG_USING_AT_DEVICE
|
|
||||||
// #define AT_DEVICE_USING_MB26
|
|
||||||
// #define AT_DEVICE_MB26_INIT_ASYN //
|
|
||||||
// #define AT_DEVICE_MB26_SAMPLE
|
|
||||||
|
|
||||||
// #define MB26_SAMPLE_CLIENT_NAME "uart1"
|
|
||||||
// #define MB26_SAMPLE_RECV_BUFF_LEN 512
|
|
||||||
// #define PKG_USING_AT_DEVICE_LATEST_VERSION
|
|
||||||
// #define PKG_AT_DEVICE_VER_NUM 0x99999
|
|
||||||
|
|
||||||
/* IoT Cloud */
|
/* IoT Cloud */
|
||||||
|
#define AT_DEVICE_USING_ML307
|
||||||
|
#define AT_DEVICE_ML307_INIT_ASYN //
|
||||||
|
|
||||||
|
#define ML307_SAMPLE_CLIENT_NAME "uart3"
|
||||||
|
#define ML307_SAMPLE_RECV_BUFF_LEN 512
|
||||||
/* end of IoT Cloud */
|
/* end of IoT Cloud */
|
||||||
/* end of IoT - internet of things */
|
/* end of IoT - internet of things */
|
||||||
|
|
||||||
|
@ -258,11 +254,6 @@
|
||||||
#define PKG_VSNPRINTF_DEFAULT_FLOAT_PRECISION 6
|
#define PKG_VSNPRINTF_DEFAULT_FLOAT_PRECISION 6
|
||||||
#define PKG_VSNPRINTF_MAX_INTEGRAL_DIGITS_FOR_DECIMAL 9
|
#define PKG_VSNPRINTF_MAX_INTEGRAL_DIGITS_FOR_DECIMAL 9
|
||||||
#define PKG_VSNPRINTF_LOG10_TAYLOR_TERMS 4
|
#define PKG_VSNPRINTF_LOG10_TAYLOR_TERMS 4
|
||||||
// #define RT_VSNPRINTF_FULL_REPLACING_SPRINTF
|
|
||||||
// #define RT_VSNPRINTF_FULL_REPLACING_SNPRINTF
|
|
||||||
// #define RT_VSNPRINTF_FULL_REPLACING_PRINTF
|
|
||||||
// #define RT_VSNPRINTF_FULL_REPLACING_VSPRINTF
|
|
||||||
// #define RT_VSNPRINTF_FULL_REPLACING_VSNPRINTF
|
|
||||||
#define PKG_USING_RT_VSNPRINTF_FULL_LATEST_VERSION
|
#define PKG_USING_RT_VSNPRINTF_FULL_LATEST_VERSION
|
||||||
/* end of enhanced kernel services */
|
/* end of enhanced kernel services */
|
||||||
|
|
||||||
|
@ -388,6 +379,7 @@
|
||||||
#define BSP_USING_UART
|
#define BSP_USING_UART
|
||||||
#define BSP_USING_UART1
|
#define BSP_USING_UART1
|
||||||
// #define BSP_USING_UART2
|
// #define BSP_USING_UART2
|
||||||
|
#define BSP_USING_UART3
|
||||||
// #define BSP_USING_UART4
|
// #define BSP_USING_UART4
|
||||||
// #define BSP_USING_UART5
|
// #define BSP_USING_UART5
|
||||||
#define LSI_VALUE 40000
|
#define LSI_VALUE 40000
|
||||||
|
|
Loading…
Reference in New Issue