From 0c4a728c175baa76b83aa2c0bc92997f70ae3701 Mon Sep 17 00:00:00 2001 From: Eduard Iten Date: Tue, 22 Jul 2025 11:02:27 +0200 Subject: [PATCH] feat(can): Add CAN ID definitions This commit introduces the CAN ID definitions for the irrigation system. It defines the structure of the CAN IDs and macros for priority and function. Signed-off-by: Eduard Iten --- software/include/lib/can_ids.h | 41 ++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) diff --git a/software/include/lib/can_ids.h b/software/include/lib/can_ids.h index e69de29..01a73b3 100644 --- a/software/include/lib/can_ids.h +++ b/software/include/lib/can_ids.h @@ -0,0 +1,41 @@ +#ifndef CAN_IDS_H +#define CAN_IDS_H + +/* +CAN ID structure for the irrigation system. +PPP FFFF NNNN + +PPP: Priority + 000: Network segment + 001: Critical error + 010: Commands + 100: Status messages + 110: measurements + 111: Info messages + +FFFF: Function + 0001: Valve Commands + 0010: Valve States + 0011: IO Commands + 0100: IO States + 0101: Measurements + 0111: Sysem Functions (e.g. reset, firmware update) + +NNNN: Node ID +*/ + +#define CAN_ID_PRIORITY_NETWORK 0x000 +#define CAN_ID_PRIORITY_CRITICAL_ERROR 0x100 +#define CAN_ID_PRIORITY_COMMANDS 0x200 +#define CAN_ID_PRIORITY_STATUS 0x400 +#define CAN_ID_PRIORITY_MEASUREMENTS 0x600 +#define CAN_ID_PRIORITY_INFO 0x700 + +#define CAN_ID_FUNCTION_VALVE_COMMANDS 0x010 +#define CAN_ID_FUNCTION_VALVE_STATES 0x020 +#define CAN_ID_FUNCTION_IO_COMMANDS 0x030 +#define CAN_ID_FUNCTION_IO_STATES 0x040 +#define CAN_ID_FUNCTION_MEASUREMENTS 0x050 +#define CAN_ID_FUNCTION_SYSTEM_FUNCTIONS 0x070 + +#endif // CAN_IDS_H \ No newline at end of file