optimize I2C and SPI codes and add rtc module

This commit is contained in:
wlyu
2022-03-04 15:54:43 +08:00
parent 06b2ed5235
commit 598f92babb
32 changed files with 398 additions and 3053 deletions

View File

@@ -41,13 +41,14 @@ typedef struct UaParam
UA_Client *client;
}UaParamType;
#define OPC_SERVER "opc.tcp://192.168.250.2:4840"
#define ua_print //KPrintf
#define ua_trace() //KPrintf("ua: [%s] line %d checked!\n", __func__, __LINE__)
#define ua_pr_info KPrintf
#define ua_debug //KPrintf
extern const char *opc_server_url;
extern char test_ua_ip[];
int ua_server_connect(void);
void ua_browser_nodes(UA_Client *client);
void ua_browser_id(UA_Client *client, UA_NodeId id);

View File

@@ -24,6 +24,8 @@
#define UA_RESPONSE_TIMEOUT 10000
const char *opc_server_url = {"opc.tcp://192.168.250.2:4840"};
#ifdef UA_ENABLE_SUBSCRIPTIONS
static void handler_TheAnswerChanged(UA_Client* client, UA_UInt32 subId, void* subContext,
UA_UInt32 monId, void* monContext, UA_DataValue* value)
@@ -52,7 +54,7 @@ int ua_get_points(UA_Client* client)
/* Listing endpoints */
UA_EndpointDescription* endpointArray = NULL;
size_t endpointArraySize = 0;
UA_StatusCode ret = UA_Client_getEndpoints(client, OPC_SERVER,
UA_StatusCode ret = UA_Client_getEndpoints(client, opc_server_url,
&endpointArraySize, &endpointArray);
if(ret != UA_STATUSCODE_GOOD)

View File

@@ -82,7 +82,7 @@ int ua_test_interact_server(UA_Client *client)
int16 ua_test(void)
{
UA_Client *client = UA_Client_new();
UA_StatusCode retval = UA_Client_connect(client, OPC_SERVER);
UA_StatusCode retval = UA_Client_connect(client, opc_server_url);
if(retval != UA_STATUSCODE_GOOD) {
UA_Client_delete(client);
return (int)retval;