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

This driver interfaces with the PROMiS PMT ASIC. More...

#include "drv/wb/i2c.h"
#include "util/macro.h"

Go to the source code of this file.

Data Structures

struct  PrmsConfig
 Configuration struct. More...
 
struct  PrmsStatus
 Status struct. More...
 

Macros

#define PRMS_THRS_MIN_MV   800
 Minimal output of threshold DAC in milliVolt.
 
#define PRMS_THRS_MAX_MV   2400
 Maximum output of threshold DAC in milliVolt.
 
#define PRMS_HV_MIN_V   -700
 Minimal value of HV DAC in volt.
 
#define PRMS_HV_MAX_V   -1500
 Maximum value of HV DAC in volt.
 
#define E_PRMS_ID_FAULT   ( E_PRMS + 1 )
 PROMiS ID is not consistent.
 
#define E_PRMS_ID_FAULT_DESCR   "PROMiS ID inconsistent"
 
#define PRMS_THRS_MV2DAC(MV)   RESCALE(MV, PRMS_THRS_MIN_MV, PRMS_THRS_MAX_MV, 0, 255)
 Converts a threshold value in milliVolts to the DAC value. More...
 
#define PRMS_THRS_DAC2MV(BYTE)   RESCALE(BYTE, 0, 255, PRMS_THRS_MIN_MV, PRMS_THRS_MAX_MV)
 Converts the threshold DAC byte value into milliVolts. More...
 
#define PRMS_HV_V2DAC(V)   RESCALE(V, PRMS_HV_MIN_V, PRMS_HV_MAX_V, 0, 255)
 Converts the high voltage value into the high voltage DAC byte value. More...
 
#define PRMS_HV_DAC2V(V)   RESCALE(V, 0, 255, PRMS_HV_MIN_V, PRMS_HV_MAX_V)
 Converts the high voltage DAC byte value into volts. More...
 

Functions

bool prmsID (I2C_Device *dev, uint8_t addr, uint8_t *id)
 Returns the burned ID of the PROMiS device. More...
 
bool prmsSetConfig (I2C_Device *dev, uint8_t addr, PrmsConfig *cfg)
 Sets the configuration on the PROMiS device. More...
 
bool prmsGetConfig (I2C_Device *dev, uint8_t addr, PrmsConfig *cfg)
 Gets the configuration from the PROMiS device. More...
 
bool prmsHighVolt (I2C_Device *dev, uint8_t addr, bool enable)
 Enables/Disables the high voltage. More...
 
bool prmsChainTest (I2C_Device *dev, uint8_t addr)
 Executes a chain test. More...
 
bool prmsStatus (I2C_Device *dev, uint8_t addr, PrmsStatus *status)
 Returns the status of the PROMiS device. More...
 

Detailed Description

This driver interfaces with the PROMiS PMT ASIC.

Definition in file promis.h.

Macro Definition Documentation

#define PRMS_HV_DAC2V (   V)    RESCALE(V, 0, 255, PRMS_HV_MIN_V, PRMS_HV_MAX_V)

Converts the high voltage DAC byte value into volts.

Parameters
BYTEThe high-voltage byte value
Returns
The resulting DAC output in volts

Definition at line 74 of file promis.h.

#define PRMS_HV_V2DAC (   V)    RESCALE(V, PRMS_HV_MIN_V, PRMS_HV_MAX_V, 0, 255)

Converts the high voltage value into the high voltage DAC byte value.

Note: The high voltage needs to be between HV_MIN_V and HV_MAX_V.

Parameters
VThe high-voltage output value in volts.
Returns
The resulting DAC byte value

Definition at line 65 of file promis.h.

#define PRMS_THRS_DAC2MV (   BYTE)    RESCALE(BYTE, 0, 255, PRMS_THRS_MIN_MV, PRMS_THRS_MAX_MV)

Converts the threshold DAC byte value into milliVolts.

Parameters
BYTEThe threshold DAC byte value
Returns
The resulting DAC value in millivolts

Definition at line 54 of file promis.h.

#define PRMS_THRS_MV2DAC (   MV)    RESCALE(MV, PRMS_THRS_MIN_MV, PRMS_THRS_MAX_MV, 0, 255)

Converts a threshold value in milliVolts to the DAC value.

Note: The threshold needs to be between THRS_MIN_MV and THRS_MAX_MV.

Parameters
MVThe threshold value in milliVolt
Returns
A byte value corresponding to the MV value entered.

Definition at line 45 of file promis.h.

Function Documentation

bool prmsChainTest ( I2C_Device dev,
uint8_t  addr 
)

Executes a chain test.

Note that DAC values will be modified after this test.

Parameters
devThe WB I2C device
addrThe I2C address
Return values
trueSuccess.
falseFailure, use err module to get error.

Definition at line 90 of file promis.c.

bool prmsGetConfig ( I2C_Device dev,
uint8_t  addr,
PrmsConfig cfg 
)

Gets the configuration from the PROMiS device.

Parameters
devThe WB I2C device
addrThe I2C address
cfgPoiner to the configuration struct to fill
Return values
trueSuccess.
falseFailure, use err module to get error.

Definition at line 75 of file promis.c.

bool prmsHighVolt ( I2C_Device dev,
uint8_t  addr,
bool  enable 
)

Enables/Disables the high voltage.

Note: Be careful when high voltage is on!

Parameters
devThe WB I2C device
addrThe I2C address
enableSet to true to enable, false to disable.
Return values
trueSuccess.
falseFailure, use err module to get error.

Definition at line 85 of file promis.c.

bool prmsID ( I2C_Device dev,
uint8_t  addr,
uint8_t *  id 
)

Returns the burned ID of the PROMiS device.

Parameters
devThe WB I2C device
addrThe I2C address
idPointer to an array of at least 3 bytes. ID will be written into it on success.
Return values
trueSuccess.
falseFailure, use err module to get error.

Definition at line 41 of file promis.c.

bool prmsSetConfig ( I2C_Device dev,
uint8_t  addr,
PrmsConfig cfg 
)

Sets the configuration on the PROMiS device.

Parameters
devThe WB I2C device
addrThe I2C address
cfgPointer to the configuration struct
Return values
trueSuccess.
falseFailure, use err module to get error.

Definition at line 68 of file promis.c.

bool prmsStatus ( I2C_Device dev,
uint8_t  addr,
PrmsStatus status 
)

Returns the status of the PROMiS device.

Parameters
devThe WB I2C device
addrThe I2C address
statusPointer to the status struct to fill.
Return values
trueSuccess.
falseFailure, use err module to get error.

Definition at line 105 of file promis.c.