Added bacnet-basic callback in zephyr subsys to include init and task in same thread.

This commit is contained in:
Steve Karg
2024-07-23 15:27:39 -05:00
parent 39f08d253b
commit 4694b9b2eb
3 changed files with 87 additions and 6 deletions
+26 -6
View File
@@ -24,20 +24,40 @@
#include <zephyr/logging/log.h>
LOG_MODULE_DECLARE(bacnet, CONFIG_BACNETSTACK_LOG_LEVEL);
int main(void)
/**
* @brief BACnet Project Initialization Handler
* @param context [in] The context to pass to the callback function
* @note This is called from the BACnet task
*/
static void BACnet_Smart_Sensor_Init_Handler(void *context)
{
LOG_INF("\n*** BACnet Profile B-SS Sample ***\n");
LOG_INF("BACnet Stack Version " BACNET_VERSION_TEXT);
(void)context;
LOG_INF("BACnet Stack Initialized");
/* initialize objects for this basic sample */
Device_Init(NULL);
Device_Set_Object_Instance_Number(260123);
Analog_Input_Create(1);
Analog_Input_Name_Set(1, "Sensor");
LOG_INF("BACnet Device ID: %u", Device_Object_Instance_Number());
LOG_INF("BACnet Device Max APDU: %d", MAX_APDU);
}
/**
* @brief BACnet Project Task Handler
* @param context [in] The context to pass to the callback function
* @note This is called from the BACnet task
*/
static void BACnet_Smart_Sensor_Task_Handler(void *context)
{
}
int main(void)
{
LOG_INF("\n*** BACnet Profile B-SS Sample ***\n");
LOG_INF("BACnet Stack Version " BACNET_VERSION_TEXT);
LOG_INF("BACnet Stack Max APDU: %d", MAX_APDU);
bacnet_basic_init_callback_set(BACnet_Smart_Sensor_Init_Handler, NULL);
bacnet_basic_task_callback_set(BACnet_Smart_Sensor_Task_Handler, NULL);
/* work happens in server module */
return 0;