src.dualinventive.com/dinet/libdi_fw/include/di_fw/can/dncm.h

48 lines
1.8 KiB
C

/**
* DNCM CAN helper to configure GPS and Communication status reporting
* * When using this module the following defines need to set:
* * DI_FW_CAN_DNCM_COMM_STATUS_ON_CHANGE, boolean value (e.g true)
* * DI_FW_CAN_DNCM_COMM_STATUS_INTERVAL_SEC, unsigned integer value (e.g 300)
* * DI_FW_CAN_DNCM_GPS_INTERVAL_SEC, unsigned integer value (e.g 300)
*/
#ifndef LIBDI_FW_INCLUDE_DI_FW_CAN_DNCM_H_
#define LIBDI_FW_INCLUDE_DI_FW_CAN_DNCM_H_
#include <di/can/net/node.h>
struct di_can_net;
struct di_can_net_node;
#define DI_FW_CAN_DNCM_REQREP_TIMEOUT_MS 500
#define DI_FW_CAN_DNCM_PERIODIC_EVENT_TIME_MS 1000
/**
* Node event wrapper for gateway node events (DNCMs)
* * A configuration periodic is started as the event comes from a DNCM leader
* * The configuration periodic will delete itself as soon as the DNCM has send the correct
* replies after configuration
* @param ctx CAN Net subsystem context
* @param ev CAN node event
* @param node CAN node which triggered the event
*/
void di_fw_can_dncm_node_event_cb(const struct di_can_net *ctx,
const enum di_can_net_node_events ev, const struct di_can_net_node *node);
/**
* Starts (when not already started) the DNCM configuration asynchronous periodic task
* @param ctx CAN context
* @note The periodic tasks makes sure the DNCM is configured correctly even when there are
* timing problems and message drops on the CAN-bus
*/
void di_fw_can_dncm_configure(struct di_can_ctx *ctx);
/**
* Force a DNCM GPS sensor update (trigger) in a asynchronous periodic task
* @param ctx CAN context
* @note The periodic tasks makes sure the DNCM is triggered for GPS update correctly even when
* there are timing problems and message drops on the CAN-bus
*/
void di_fw_can_dncm_gps_sensor_trigger(struct di_can_ctx *ctx);
#endif /* LIBDI_FW_INCLUDE_DI_FW_CAN_DNCM_H_ */