KM3NeT CLB  2.0
KM3NeT CLB v2 Embedded Software
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
bps_v3.h File Reference

BPS Uart driver (. More...

#include "stdbool.h"
#include "cfg_board.h"
#include "errorcode.h"
#include "drv/wb/suart.h"

Go to the source code of this file.

Data Structures

struct  BpsRdSingleAnswV3
 
struct  BpsRdSensAnswV3
 
struct  BpsRdSensAverageAnswV3
 
struct  BspTh
 
struct  BspThV3
 
struct  SwCtrlV3
 
struct  BpsAlarmV3
 
struct  BpsAlarmTimeOutV3
 
struct  BpsRdVersionV3
 

Macros

#define E_BPS_TIMEOUT   E_BPS + 1
 Receive timeout.
 
#define E_BPS_TIMEOUT_DESCR   "BPS Response Timeout"
 
#define E_BPS_CHKERR   E_BPS + 2
 bad checksum received
 
#define E_BPS_CHKERR_DESCR   "BPS Bad checksum"
 
#define E_BPS_NOEOF   E_BPS + 3
 no EOF received when expected
 
#define E_BPS_NOEOF_DESCR   "BPS No EOF received"
 
#define E_BPS_RETADDR   E_BPS + 4
 
#define E_BPS_RETADDR_DESCR   "BPS Response Bad Addr"
 
#define E_BPS_RETCHK   E_BPS + 5
 
#define E_BPS_RETCHK_DESCR   "BPS Response Bad Checksum"
 
#define E_BPS_RETSTA   E_BPS + 6
 
#define E_BPS_RETSTA_DESCR   "BPS Response Bad Start"
 
#define E_BPS_RETTIM   E_BPS + 7
 
#define E_BPS_RETTIM_DESCR   "BPS Response Tx Was Timeouted"
 
#define E_BPS_RETUNK   E_BPS + 8
 
#define E_BPS_RETUNK_DESCR   "BPS Response Unknown"
 
#define E_BPS_NOSOF   E_BPS + 9
 no EOF received when expected
 
#define E_BPS_NOSOF_DESCR   "BPS No SOF received"
 
#define BPS_BAUDRATE_DEFAULT   SUART_BAUDRATE_19200
 Default Baudrate.
 

Functions

static void bpsInit ()
 Initializes the BPS. More...
 
bool bpsReadSensorV3 (BpsRdSensAnswV3 *stat)
 return all sensors' values More...
 
bool bpsReadSensorMaxV3 (BpsRdSensAnswV3 *stat)
 return all sensors' max values More...
 
bool bpsReadSensorSingleV3 (uint8_t single_var, BpsRdSingleAnswV3 *stat)
 return one sensor's current value, offset, max, mean value More...
 
bool bpsReadSensorAverageV3 (BpsRdSensAverageAnswV3 *stat)
 return all sensors' mean values More...
 
bool bpsAlarmEnV3 (uint8_t ch, uint8_t val, BpsAlarmV3 *AlarmEn_rd)
 Return current enable status. More...
 
bool bpsAlarmFiredGetV3 (uint8_t ch, BpsAlarmV3 *AlarmFiredGet)
 Return flag of one alarm. More...
 
bool bpsAlarmTimeOutSaveV3 (uint8_t time_out_ch, uint16_t time_out_val)
 Set the threshold value of one analog alarm. More...
 
bool bpsAlarmTimeOutLoadV3 (uint8_t time_out_ch, BpsAlarmTimeOutV3 *rdtout)
 
bool bpsSwitchControlV3 (uint8_t ch, uint8_t val, SwCtrlV3 *sw_rd)
 switch control More...
 
bool bpsRescueEnable (uint8_t set_val, uint8_t *rd_val)
 Version. More...
 
bool bpsSensorMaxvalueReset (uint8_t set_val)
 SENSOR_MAXVALUE_RESET set_val : Variable number.
 
bool bpsDbgCmdReply (uint8_t cmdCode, uint8_t *cmdPData, uint8_t cmdNData, uint8_t rplCode, uint8_t **rplPData, uint8_t rplNData)
 Toggle relay status. More...
 

Detailed Description

BPS Uart driver (.

Definition in file bps_v3.h.

Function Documentation

bool bpsAlarmEnV3 ( uint8_t  ch,
uint8_t  val,
BpsAlarmV3 AlarmEn_rd 
)

Return current enable status.

Parameters
ch= ALARM_NUMBER
val= ENABLESTATE_NC, Enable state
AlarmEn_rd= pointer to returned loaded value of alarm status

Definition at line 1074 of file bps_v3.c.

bool bpsAlarmFiredGetV3 ( uint8_t  ch,
BpsAlarmV3 AlarmFiredGet 
)

Return flag of one alarm.

Parameters
ch= ALARM_NUMBER
AlarmFiredGet= pointer to returned loaded value of alarm enable

Definition at line 1047 of file bps_v3.c.

bool bpsAlarmTimeOutLoadV3 ( uint8_t  time_out_ch,
BpsAlarmTimeOutV3 rdtout 
)
Parameters
th=
bool bpsAlarmTimeOutSaveV3 ( uint8_t  time_out_ch,
uint16_t  time_out_val 
)

Set the threshold value of one analog alarm.

Parameters
al_th_ch= ALARM_NUMBER_ANALOG
al_th_val= Threshold value Get the threshold value of one analog alarm
th_channel=ALARM_NUMBER_ANALOG
th= Threshold value Set the timeout of one alarm
time_out_ch= ALARM_NUMBER
time_out_val= Timeout value

Definition at line 665 of file bps_v3.c.

bool bpsDbgCmdReply ( uint8_t  cmdCode,
uint8_t *  cmdPData,
uint8_t  cmdNData,
uint8_t  rplCode,
uint8_t **  rplPData,
uint8_t  rplNData 
)

Toggle relay status.

Parameters
breakers= pointer to returned breakers value Ping Device
fw= pointer to returned firmware release Exposes the low-level interface to the BPS.
Note
The usage of this function is discouraged.
Parameters
cmdCodeThe command code
cmdPDataPointer to the command data
cmdNDataLength of the data
rplCodeExpected reply code
rplPDataPointer-Pointer which will point to the reply data buffer
rplNDataExpected length of the reply data.
Return values
trueSuccess
falseFailure, check error module for error

Toggle relay status.

Note
The usage of this function is discouraged.
Parameters
cmdCodeThe command code
cmdPDataPointer to the command data
cmdNDataLength of the data
rplCodeExpected reply code
rplPDataPointer-Pointer which will point to the reply data buffer
rplNDataExpected length of the reply data.
Return values
trueSuccess
falseFailure, check error module for error

Definition at line 788 of file bps.c.

static void bpsInit ( )
inlinestatic

Initializes the BPS.

Parameters

Definition at line 144 of file bps_v3.h.

bool bpsReadSensorAverageV3 ( BpsRdSensAverageAnswV3 stat)

return all sensors' mean values

Parameters
stat= pointer to Status structure

Definition at line 773 of file bps_v3.c.

bool bpsReadSensorMaxV3 ( BpsRdSensAnswV3 stat)

return all sensors' max values

Parameters
stat= pointer to Status structure

Definition at line 857 of file bps_v3.c.

bool bpsReadSensorSingleV3 ( uint8_t  single_var,
BpsRdSingleAnswV3 stat 
)

return one sensor's current value, offset, max, mean value

Parameters
single_var= VARIABLE_NUMBER
stat= pointer to Status structure

Definition at line 733 of file bps_v3.c.

bool bpsReadSensorV3 ( BpsRdSensAnswV3 stat)

return all sensors' values

Parameters
stat= pointer to Status structure

Definition at line 810 of file bps_v3.c.

bool bpsRescueEnable ( uint8_t  set_val,
uint8_t *  rd_val 
)

Version.

Parameters
stat= pointer to the Version Enable or disable auto-rescue (or read enable status)
set_val= Enable state
rd_val= returned Enable state set_val : [0] –> DISABLED;[1] –> ENABLED; [2] –> NO_CHANGE rd_val : [0] –> DISABLED;[1] –> ENABLED;

Definition at line 1106 of file bps_v3.c.

bool bpsSwitchControlV3 ( uint8_t  ch,
uint8_t  val,
SwCtrlV3 sw_rd 
)

switch control

Parameters
ch= Switch number
val= Switch state
sw_rd= point to Switch control structure

Definition at line 1014 of file bps_v3.c.