irrigation_system/software/test_canbus/src/main.c

27 lines
638 B
C

/* Testing MODBUS functionality
This code initializes a Modbus client, sets the zero point and the 2m point for water level,
and reads the water level in both meters and millimeters.
It uses the Zephyr RTOS and its Modbus library to communicate with a Modbus server.
*/
#include <zephyr/logging/log.h>
#include <zephyr/kernel.h>
#include <zephyr/drivers/gpio.h>
#include "canbus.h"
LOG_MODULE_REGISTER(main, CONFIG_LOG_DEFAULT_LEVEL);
int main(void)
{
int rc;
rc = canbus_init();
if (rc != 0)
{
LOG_ERR("Failed to initialize CAN bus: %d", rc);
return rc;
}
LOG_INF("CAN bus initialized successfully");
return 0;
}