irrigation_system/software/lib/valve.h

27 lines
966 B
C

#ifndef __VALVE_H__
#define __VALVE_H__
#define VALVE_OPENING_TIME K_MSEC(4500) // Time to open the valve
#define VALVE_CLOSING_TIME K_MSEC(4500) // Time to close the valve
#define VALVE_MAX_OPENING_TIME K_MSEC(5000) // Maximum time to open the valve
#define VALVE_MAX_CLOSING_TIME K_MSEC(5000) // Maximum time to close the valve
#define VALVE_STATE_INTERVAL K_SECONDS(5 * 60) // Interval to check the valve state
#define VALVE_THREAD_STACK_SIZE (512) // Stack size for the valve thread
#define VALVE_THREAD_PRIORITY (2) // Priority for the valve thread
#define VALVE_MSGQ_SIZE (5) // Size of the message queue for valve operations
#include <stdint.h>
#include "canbus_registers.h"
typedef struct {
uint8_t valve_state;
uint8_t valve_operation;
} valve_status_t;
int valve_init(void);
int valve_cmd(int cmd);
int valve_send_status(void);
int valve_send_operation(void);
#endif // __VALVE_H__