74 lines
1.9 KiB
C
Executable File
74 lines
1.9 KiB
C
Executable File
/**
|
|
* @file include/di_fw/battery_indicator.h
|
|
* @brief battery indicator header file
|
|
* @date September 2, 2016
|
|
* @author A.A.W.M. Ruijs
|
|
* @copyright 2016 Dual Inventive Technology Centre B.V.
|
|
*/
|
|
#ifndef INCLUDE_DI_FW_CAN_H_
|
|
#define INCLUDE_DI_FW_CAN_H_
|
|
|
|
#include <stdint.h>
|
|
#include <stdbool.h>
|
|
#include <di/can.h>
|
|
#include <di_fw/os.h>
|
|
|
|
enum di_fw_charger;
|
|
enum di_fw_batteries;
|
|
|
|
/**
|
|
* Initial DI-Can stack
|
|
* @note di_device_uid_set needs be set before calling this function
|
|
* @note di_fw_can_start will start the threads
|
|
* @param uid pointer to the node id of the can
|
|
*/
|
|
void di_fw_can_init(const char *uid);
|
|
|
|
/**
|
|
*
|
|
*/
|
|
void di_fw_can_init_for_drv(const char *uid, CANDriver *drv);
|
|
|
|
/**
|
|
* Send battery voltage and state
|
|
* @param battery Battery
|
|
* @param voltage Measured voltage
|
|
* @param state Batterystate. Use enum di_device_battery_state
|
|
*/
|
|
void di_fw_can_rpc_send_battery(enum di_fw_batteries battery, double voltage, uint8_t state);
|
|
|
|
/**
|
|
* Send charger voltage and state
|
|
* @param charger ID
|
|
* @param voltage Measured voltage
|
|
* @param state charger state. Use enum di_device_charger_state.
|
|
*/
|
|
void di_fw_can_rpc_send_charger(enum di_fw_charger charger, double voltage, uint8_t state);
|
|
|
|
/**
|
|
* Get CAN context of first registered di_fw CANDriver
|
|
* @return returns pointer to can context
|
|
*/
|
|
struct di_can_ctx *di_fw_can_get_ctx(void);
|
|
|
|
/**
|
|
* Get CAN context based on CANDriver
|
|
* @param drv ChibiOS CANxN driver address, when NULL given the first registered di_fw CANDriver is returned
|
|
*/
|
|
struct di_can_ctx *di_fw_can_get_ctx_for_drv(const CANDriver *drv);
|
|
|
|
/**
|
|
* control execution of RPC callback functions
|
|
* @param exclude if true, don't execute callbacks for RPC messages
|
|
*/
|
|
void di_fw_can_exclude_rpc_messages(bool exclude);
|
|
|
|
#ifndef DI_FW_CAN_RECV_TIMEOUT_MS
|
|
#error DI_FW_CAN_RECV_TIMEOUT_MS undefined
|
|
#endif
|
|
#ifndef DI_FW_CAN_RECV_STACK_SIZE
|
|
#error DI_FW_CAN_RECV_STACK_SIZE undefined
|
|
#endif
|
|
|
|
#endif /* INCLUDE_DI_FW_CAN_H_ */
|