monoZ docs
MZ_i2c_example.h File Reference

Go to the source code of this file.

Data Structures

struct  SI_CMD
 
struct  SENSOR_Coeff_TypeDef
 
struct  SENSOR_LuxCoeff_TypeDef
 
struct  PAYLOAD_ST
 

Macros

#define SI_REG_RD   0x01
 
#define SI_REG_WR   0x00
 
#define SI_REG_RA(x)   (x)
 
#define SI_ID_REG_PART_ID   0X00
 
#define SI_ID_REG_HW_ID   0X01
 
#define SI_ID_REG_REV_ID   0X02
 
#define SI_SL_ADD   (SLAVE_ADD)
 
#define ENMASK_UV_INDEX   (1u << 6)
 
#define RETRY_MAX   2
 
#define TIMEOUT_5_SECS   5000UL
 
#define TIMEOUT_15_SECS   15000UL
 
#define TIMEOUT_25_SECS   25000UL
 
#define TIMEOUT_35_SECS   35000UL
 
#define TIMEOUT_90_SECS   90000UL
 
#define TIMEOUT_120_SECS   120000UL
 
#define TIMEOUT_180_SECS   180000UL
 
#define TIMEOUT_360_SECS   360000UL
 
#define SENSOR_REG_IRQ_ENABLE   0x0F
 
#define SENSOR_REG_IRQ_STATUS   0x12
 
#define SENSOR_REG_HOSTOUT0   0x13
 
#define SENSOR_REG_HOSTOUT1   0x14
 
#define SENSOR_REG_HOSTOUT2   0x15
 
#define SENSOR_REG_HOSTOUT3   0x16
 
#define SENSOR_REG_HOSTOUT4   0x17
 
#define SENSOR_REG_HOSTOUT5   0x18
 
#define SENSOR_REG_HOSTOUT6   0x19
 
#define SENSOR_REG_HOSTOUT7   0x1A
 
#define SENSOR_REG_HOSTOUT8   0x1B
 
#define SENSOR_REG_HOSTOUT9   0x1C
 
#define SENSOR_REG_HOSTOUT10   0x1D
 
#define SENSOR_REG_HOSTOUT11   0x1E
 
#define SENSOR_REG_HOSTOUT12   0x1F
 
#define SENSOR_REG_HOSTOUT13   0x20
 
#define SENSOR_REG_HOSTOUT14   0x21
 
#define SENSOR_REG_HOSTOUT15   0x22
 
#define SENSOR_REG_HOSTOUT16   0x23
 
#define SENSOR_REG_HOSTOUT17   0x24
 
#define SENSOR_REG_HOSTOUT18   0x25
 
#define SENSOR_REG_HOSTOUT19   0x26
 
#define SENSOR_REG_HOSTOUT20   0x27
 
#define SENSOR_REG_HOSTOUT21   0x28
 
#define SENSOR_REG_HOSTOUT22   0x29
 
#define SENSOR_REG_HOSTOUT23   0x2A
 
#define SENSOR_REG_HOSTOUT24   0x2B
 
#define SENSOR_REG_HOSTOUT25   0x2C
 
#define UV_INPUT_FRACTION   15
 
#define UV_OUTPUT_FRACTION   12
 
#define UV_NUMCOEFF   2
 
#define ADC_THRESHOLD   16000
 
#define INPUT_FRACTION_HIGH   7
 
#define INPUT_FRACTION_LOW   15
 
#define LUX_OUTPUT_FRACTION   12
 
#define NUMCOEFF_LOW   9
 
#define NUMCOEFF_HIGH   4
 
#define X_ORDER_MASK   0x0070
 
#define Y_ORDER_MASK   0x0007
 
#define SIGN_MASK   0x0080
 
#define get_x_order(m)   ( (m & X_ORDER_MASK) >> 4)
 
#define get_y_order(m)   ( (m & Y_ORDER_MASK) )
 
#define get_sign(m)   ( (m & SIGN_MASK) >> 7)
 
#define SENSOR_PARAM_I2C_ADDR   0x00
 
#define SENSOR_PARAM_CH_LIST   0x01
 
#define SENSOR_PARAM_ADCCONFIG0   0x02
 
#define SENSOR_PARAM_ADCSENS0   0x03
 
#define SENSOR_PARAM_ADCPOST0   0x04
 
#define SENSOR_PARAM_MEASCONFIG0   0x05
 
#define SENSOR_PARAM_ADCCONFIG1   0x06
 
#define SENSOR_PARAM_ADCSENS1   0x07
 
#define SENSOR_PARAM_ADCPOST1   0x08
 
#define SENSOR_PARAM_MEASCONFIG1   0x09
 
#define SENSOR_PARAM_ADCCONFIG2   0x0A
 
#define SENSOR_PARAM_ADCSENS2   0x0B
 
#define SENSOR_PARAM_ADCPOST2   0x0C
 
#define SENSOR_PARAM_MEASCONFIG2   0x0D
 
#define SENSOR_PARAM_ADCCONFIG3   0x0E
 
#define SENSOR_PARAM_ADCSENS3   0x0F
 
#define SENSOR_PARAM_ADCPOST3   0x10
 
#define SENSOR_PARAM_MEASCONFIG3   0x11
 
#define SENSOR_PARAM_ADCCONFIG4   0x12
 
#define SENSOR_PARAM_ADCSENS4   0x13
 
#define SENSOR_PARAM_ADCPOST4   0x14
 
#define SENSOR_PARAM_MEASCONFIG4   0x15
 
#define SENSOR_REG_HOSTIN0   0x0A
 
#define SENSOR_REG_COMMAND   0x0B
 
#define SENSOR_REG_IRQ_ENABLE   0x0F
 
#define SENSOR_REG_RESPONSE1   0x10
 
#define SENSOR_REG_RESPONSE0   0x11
 
#define SENSOR_REG_IRQ_STATUS   0x12
 
#define SENSOR_REG_BURST   0x2B
 
#define RESET_CMD_CTR   0x00
 
#define FORCE_CMD   0x11
 
#define SENSOR_RSP0_COUNTER_MASK   0x1F
 
#define SENSOR_OK   0000
 

Enumerations

enum  SISER_RCVD { SISER_NONE_RCVD , SISER_VALID_RESP_RCVD , SISER_INVALID_RESP_RCVD , SISER_TIMEOUT_RCVD }
 
enum  SICMD_RESP {
  SICMD_NOT_DONE , SICMD_ERROR , SICMD_TIMEOUT , SICMD_NG ,
  SICMD_DONE
}
 
enum  SICMD_REQ { SI_CMD_NONE , SI_CMD_READ_ALS , SI_CMD_READ_UV }
 

Functions

void SENSOR_Init ()
 Function Sensor Initialisation. More...
 
mz_error_t SENSOR_Config ()
 Function to config the sensor. More...
 
int32_t SENSOR_getUv (int32_t uv, SENSOR_Coeff_TypeDef *uk)
 Function to Conversion of Raw Data. More...
 
int32_t SENSOR_calcEvalPoly (int32_t x, int32_t y, uint8_t input_fraction, uint8_t output_fraction, uint8_t num_coeff, SENSOR_Coeff_TypeDef *kp)
 Function to Conversion of Raw Data. More...
 
int32_t SENSOR_calcPolyInner (int32_t input, int8_t fraction, uint16_t mag, int8_t shift)
 Function to Conversion of Raw Data. More...
 
mz_error_t Sensor_ReadID (uint8_t *buf)
 Function to read the content from ID register of SENSOR. More...
 
mz_error_t Sensor_cmd_data_conf (uint8_t addr, uint8_t data)
 Function to write data for Sensor Configuration. More...
 
mz_error_t I2C_ReadID_Reg (uint8_t *buf)
 
mz_error_t I2C_Read_Reg (uint8_t addr, uint32_t *buf)
 Function to read from the specific register. More...
 
mz_error_t I2C_Write_Reg (uint8_t addr, uint8_t data)
 Function to write into the specific register. More...
 
uint8_t * Get_SenPayload_UV_DataStr (void)
 
SISER_RCVD send_SI_cmd_and_wait_resp (SICMD_REQ req, uint32_t timeout)
 
mz_error_t param_table_write (uint8_t addr, uint8_t data)
 Function to read from the specific register. More...
 
mz_error_t i2c_app_init (void)
 
SISER_RCVD SI_Read_UV (void)
 Function to read the data from SENSOR. More...
 
void reset_resp_counter (void)
 Reset register. More...
 
void int8buf_to_asciibuf (uint8_t *destbuf, uint8_t *srcbuf, uint16_t len)
 Function to Conversion of Int to ascii data. More...
 
uint16_t Get_String_len (uint8_t *buf)
 Function to get string length. More...
 
uint8_t string_append (uint8_t *srcstr, uint8_t *apstr)
 Function to append the string. More...
 
uint16_t string_copy (uint8_t *dststr, uint8_t *srcstr)
 Function to Copy the data from source to destination. More...
 
void calib_uv_index (float uv_raw_data)
 Function to calibrate the raw data. More...
 

Variables

static SENSOR_LuxCoeff_TypeDef lk
 
static SENSOR_Coeff_TypeDef uk [2]
 
PAYLOAD_ST SENSOR_payload
 
uint8_t N
 

Macro Definition Documentation

◆ SI_REG_RD

#define SI_REG_RD   0x01

Definition at line 12 of file MZ_i2c_example.h.

◆ SI_REG_WR

#define SI_REG_WR   0x00

Definition at line 13 of file MZ_i2c_example.h.

◆ SI_REG_RA

#define SI_REG_RA (   x)    (x)

Definition at line 15 of file MZ_i2c_example.h.

◆ SI_ID_REG_PART_ID

#define SI_ID_REG_PART_ID   0X00

Definition at line 16 of file MZ_i2c_example.h.

◆ SI_ID_REG_HW_ID

#define SI_ID_REG_HW_ID   0X01

Definition at line 17 of file MZ_i2c_example.h.

◆ SI_ID_REG_REV_ID

#define SI_ID_REG_REV_ID   0X02

Definition at line 18 of file MZ_i2c_example.h.

◆ SI_SL_ADD

#define SI_SL_ADD   (SLAVE_ADD)

Definition at line 19 of file MZ_i2c_example.h.

◆ ENMASK_UV_INDEX

#define ENMASK_UV_INDEX   (1u << 6)

Definition at line 21 of file MZ_i2c_example.h.

◆ RETRY_MAX

#define RETRY_MAX   2

Definition at line 22 of file MZ_i2c_example.h.

◆ TIMEOUT_5_SECS

#define TIMEOUT_5_SECS   5000UL

Definition at line 23 of file MZ_i2c_example.h.

◆ TIMEOUT_15_SECS

#define TIMEOUT_15_SECS   15000UL

Definition at line 24 of file MZ_i2c_example.h.

◆ TIMEOUT_25_SECS

#define TIMEOUT_25_SECS   25000UL

Definition at line 25 of file MZ_i2c_example.h.

◆ TIMEOUT_35_SECS

#define TIMEOUT_35_SECS   35000UL

Definition at line 26 of file MZ_i2c_example.h.

◆ TIMEOUT_90_SECS

#define TIMEOUT_90_SECS   90000UL

Definition at line 27 of file MZ_i2c_example.h.

◆ TIMEOUT_120_SECS

#define TIMEOUT_120_SECS   120000UL

Definition at line 28 of file MZ_i2c_example.h.

◆ TIMEOUT_180_SECS

#define TIMEOUT_180_SECS   180000UL

Definition at line 29 of file MZ_i2c_example.h.

◆ TIMEOUT_360_SECS

#define TIMEOUT_360_SECS   360000UL

Definition at line 30 of file MZ_i2c_example.h.

◆ SENSOR_REG_IRQ_ENABLE [1/2]

#define SENSOR_REG_IRQ_ENABLE   0x0F

Definition at line 103 of file MZ_i2c_example.h.

◆ SENSOR_REG_IRQ_STATUS [1/2]

#define SENSOR_REG_IRQ_STATUS   0x12

Definition at line 106 of file MZ_i2c_example.h.

◆ SENSOR_REG_HOSTOUT0

#define SENSOR_REG_HOSTOUT0   0x13

Definition at line 34 of file MZ_i2c_example.h.

◆ SENSOR_REG_HOSTOUT1

#define SENSOR_REG_HOSTOUT1   0x14

Definition at line 35 of file MZ_i2c_example.h.

◆ SENSOR_REG_HOSTOUT2

#define SENSOR_REG_HOSTOUT2   0x15

Definition at line 36 of file MZ_i2c_example.h.

◆ SENSOR_REG_HOSTOUT3

#define SENSOR_REG_HOSTOUT3   0x16

Definition at line 37 of file MZ_i2c_example.h.

◆ SENSOR_REG_HOSTOUT4

#define SENSOR_REG_HOSTOUT4   0x17

Definition at line 38 of file MZ_i2c_example.h.

◆ SENSOR_REG_HOSTOUT5

#define SENSOR_REG_HOSTOUT5   0x18

Definition at line 39 of file MZ_i2c_example.h.

◆ SENSOR_REG_HOSTOUT6

#define SENSOR_REG_HOSTOUT6   0x19

Definition at line 40 of file MZ_i2c_example.h.

◆ SENSOR_REG_HOSTOUT7

#define SENSOR_REG_HOSTOUT7   0x1A

Definition at line 41 of file MZ_i2c_example.h.

◆ SENSOR_REG_HOSTOUT8

#define SENSOR_REG_HOSTOUT8   0x1B

Definition at line 42 of file MZ_i2c_example.h.

◆ SENSOR_REG_HOSTOUT9

#define SENSOR_REG_HOSTOUT9   0x1C

Definition at line 43 of file MZ_i2c_example.h.

◆ SENSOR_REG_HOSTOUT10

#define SENSOR_REG_HOSTOUT10   0x1D

Definition at line 44 of file MZ_i2c_example.h.

◆ SENSOR_REG_HOSTOUT11

#define SENSOR_REG_HOSTOUT11   0x1E

Definition at line 45 of file MZ_i2c_example.h.

◆ SENSOR_REG_HOSTOUT12

#define SENSOR_REG_HOSTOUT12   0x1F

Definition at line 46 of file MZ_i2c_example.h.

◆ SENSOR_REG_HOSTOUT13

#define SENSOR_REG_HOSTOUT13   0x20

Definition at line 47 of file MZ_i2c_example.h.

◆ SENSOR_REG_HOSTOUT14

#define SENSOR_REG_HOSTOUT14   0x21

Definition at line 48 of file MZ_i2c_example.h.

◆ SENSOR_REG_HOSTOUT15

#define SENSOR_REG_HOSTOUT15   0x22

Definition at line 49 of file MZ_i2c_example.h.

◆ SENSOR_REG_HOSTOUT16

#define SENSOR_REG_HOSTOUT16   0x23

Definition at line 50 of file MZ_i2c_example.h.

◆ SENSOR_REG_HOSTOUT17

#define SENSOR_REG_HOSTOUT17   0x24

Definition at line 51 of file MZ_i2c_example.h.

◆ SENSOR_REG_HOSTOUT18

#define SENSOR_REG_HOSTOUT18   0x25

Definition at line 52 of file MZ_i2c_example.h.

◆ SENSOR_REG_HOSTOUT19

#define SENSOR_REG_HOSTOUT19   0x26

Definition at line 53 of file MZ_i2c_example.h.

◆ SENSOR_REG_HOSTOUT20

#define SENSOR_REG_HOSTOUT20   0x27

Definition at line 54 of file MZ_i2c_example.h.

◆ SENSOR_REG_HOSTOUT21

#define SENSOR_REG_HOSTOUT21   0x28

Definition at line 55 of file MZ_i2c_example.h.

◆ SENSOR_REG_HOSTOUT22

#define SENSOR_REG_HOSTOUT22   0x29

Definition at line 56 of file MZ_i2c_example.h.

◆ SENSOR_REG_HOSTOUT23

#define SENSOR_REG_HOSTOUT23   0x2A

Definition at line 57 of file MZ_i2c_example.h.

◆ SENSOR_REG_HOSTOUT24

#define SENSOR_REG_HOSTOUT24   0x2B

Definition at line 58 of file MZ_i2c_example.h.

◆ SENSOR_REG_HOSTOUT25

#define SENSOR_REG_HOSTOUT25   0x2C

Definition at line 59 of file MZ_i2c_example.h.

◆ UV_INPUT_FRACTION

#define UV_INPUT_FRACTION   15

Definition at line 61 of file MZ_i2c_example.h.

◆ UV_OUTPUT_FRACTION

#define UV_OUTPUT_FRACTION   12

Definition at line 62 of file MZ_i2c_example.h.

◆ UV_NUMCOEFF

#define UV_NUMCOEFF   2

Definition at line 63 of file MZ_i2c_example.h.

◆ ADC_THRESHOLD

#define ADC_THRESHOLD   16000

Definition at line 64 of file MZ_i2c_example.h.

◆ INPUT_FRACTION_HIGH

#define INPUT_FRACTION_HIGH   7

Definition at line 65 of file MZ_i2c_example.h.

◆ INPUT_FRACTION_LOW

#define INPUT_FRACTION_LOW   15

Definition at line 66 of file MZ_i2c_example.h.

◆ LUX_OUTPUT_FRACTION

#define LUX_OUTPUT_FRACTION   12

Definition at line 67 of file MZ_i2c_example.h.

◆ NUMCOEFF_LOW

#define NUMCOEFF_LOW   9

Definition at line 68 of file MZ_i2c_example.h.

◆ NUMCOEFF_HIGH

#define NUMCOEFF_HIGH   4

Definition at line 69 of file MZ_i2c_example.h.

◆ X_ORDER_MASK

#define X_ORDER_MASK   0x0070

Definition at line 71 of file MZ_i2c_example.h.

◆ Y_ORDER_MASK

#define Y_ORDER_MASK   0x0007

Definition at line 72 of file MZ_i2c_example.h.

◆ SIGN_MASK

#define SIGN_MASK   0x0080

Definition at line 73 of file MZ_i2c_example.h.

◆ get_x_order

#define get_x_order (   m)    ( (m & X_ORDER_MASK) >> 4)

Definition at line 74 of file MZ_i2c_example.h.

◆ get_y_order

#define get_y_order (   m)    ( (m & Y_ORDER_MASK) )

Definition at line 75 of file MZ_i2c_example.h.

◆ get_sign

#define get_sign (   m)    ( (m & SIGN_MASK) >> 7)

Definition at line 76 of file MZ_i2c_example.h.

◆ SENSOR_PARAM_I2C_ADDR

#define SENSOR_PARAM_I2C_ADDR   0x00

Definition at line 79 of file MZ_i2c_example.h.

◆ SENSOR_PARAM_CH_LIST

#define SENSOR_PARAM_CH_LIST   0x01

Definition at line 80 of file MZ_i2c_example.h.

◆ SENSOR_PARAM_ADCCONFIG0

#define SENSOR_PARAM_ADCCONFIG0   0x02

Definition at line 81 of file MZ_i2c_example.h.

◆ SENSOR_PARAM_ADCSENS0

#define SENSOR_PARAM_ADCSENS0   0x03

Definition at line 82 of file MZ_i2c_example.h.

◆ SENSOR_PARAM_ADCPOST0

#define SENSOR_PARAM_ADCPOST0   0x04

Definition at line 83 of file MZ_i2c_example.h.

◆ SENSOR_PARAM_MEASCONFIG0

#define SENSOR_PARAM_MEASCONFIG0   0x05

Definition at line 84 of file MZ_i2c_example.h.

◆ SENSOR_PARAM_ADCCONFIG1

#define SENSOR_PARAM_ADCCONFIG1   0x06

Definition at line 85 of file MZ_i2c_example.h.

◆ SENSOR_PARAM_ADCSENS1

#define SENSOR_PARAM_ADCSENS1   0x07

Definition at line 86 of file MZ_i2c_example.h.

◆ SENSOR_PARAM_ADCPOST1

#define SENSOR_PARAM_ADCPOST1   0x08

Definition at line 87 of file MZ_i2c_example.h.

◆ SENSOR_PARAM_MEASCONFIG1

#define SENSOR_PARAM_MEASCONFIG1   0x09

Definition at line 88 of file MZ_i2c_example.h.

◆ SENSOR_PARAM_ADCCONFIG2

#define SENSOR_PARAM_ADCCONFIG2   0x0A

Definition at line 89 of file MZ_i2c_example.h.

◆ SENSOR_PARAM_ADCSENS2

#define SENSOR_PARAM_ADCSENS2   0x0B

Definition at line 90 of file MZ_i2c_example.h.

◆ SENSOR_PARAM_ADCPOST2

#define SENSOR_PARAM_ADCPOST2   0x0C

Definition at line 91 of file MZ_i2c_example.h.

◆ SENSOR_PARAM_MEASCONFIG2

#define SENSOR_PARAM_MEASCONFIG2   0x0D

Definition at line 92 of file MZ_i2c_example.h.

◆ SENSOR_PARAM_ADCCONFIG3

#define SENSOR_PARAM_ADCCONFIG3   0x0E

Definition at line 93 of file MZ_i2c_example.h.

◆ SENSOR_PARAM_ADCSENS3

#define SENSOR_PARAM_ADCSENS3   0x0F

Definition at line 94 of file MZ_i2c_example.h.

◆ SENSOR_PARAM_ADCPOST3

#define SENSOR_PARAM_ADCPOST3   0x10

Definition at line 95 of file MZ_i2c_example.h.

◆ SENSOR_PARAM_MEASCONFIG3

#define SENSOR_PARAM_MEASCONFIG3   0x11

Definition at line 96 of file MZ_i2c_example.h.

◆ SENSOR_PARAM_ADCCONFIG4

#define SENSOR_PARAM_ADCCONFIG4   0x12

Definition at line 97 of file MZ_i2c_example.h.

◆ SENSOR_PARAM_ADCSENS4

#define SENSOR_PARAM_ADCSENS4   0x13

Definition at line 98 of file MZ_i2c_example.h.

◆ SENSOR_PARAM_ADCPOST4

#define SENSOR_PARAM_ADCPOST4   0x14

Definition at line 99 of file MZ_i2c_example.h.

◆ SENSOR_PARAM_MEASCONFIG4

#define SENSOR_PARAM_MEASCONFIG4   0x15

Definition at line 100 of file MZ_i2c_example.h.

◆ SENSOR_REG_HOSTIN0

#define SENSOR_REG_HOSTIN0   0x0A

Definition at line 101 of file MZ_i2c_example.h.

◆ SENSOR_REG_COMMAND

#define SENSOR_REG_COMMAND   0x0B

Definition at line 102 of file MZ_i2c_example.h.

◆ SENSOR_REG_IRQ_ENABLE [2/2]

#define SENSOR_REG_IRQ_ENABLE   0x0F

Definition at line 103 of file MZ_i2c_example.h.

◆ SENSOR_REG_RESPONSE1

#define SENSOR_REG_RESPONSE1   0x10

Definition at line 104 of file MZ_i2c_example.h.

◆ SENSOR_REG_RESPONSE0

#define SENSOR_REG_RESPONSE0   0x11

Definition at line 105 of file MZ_i2c_example.h.

◆ SENSOR_REG_IRQ_STATUS [2/2]

#define SENSOR_REG_IRQ_STATUS   0x12

Definition at line 106 of file MZ_i2c_example.h.

◆ SENSOR_REG_BURST

#define SENSOR_REG_BURST   0x2B

Definition at line 107 of file MZ_i2c_example.h.

◆ RESET_CMD_CTR

#define RESET_CMD_CTR   0x00

Definition at line 109 of file MZ_i2c_example.h.

◆ FORCE_CMD

#define FORCE_CMD   0x11

Definition at line 110 of file MZ_i2c_example.h.

◆ SENSOR_RSP0_COUNTER_MASK

#define SENSOR_RSP0_COUNTER_MASK   0x1F

Definition at line 111 of file MZ_i2c_example.h.

◆ SENSOR_OK

#define SENSOR_OK   0000

Definition at line 112 of file MZ_i2c_example.h.

Enumeration Type Documentation

◆ SISER_RCVD

enum SISER_RCVD
Enumerator
SISER_NONE_RCVD 
SISER_VALID_RESP_RCVD 
SISER_INVALID_RESP_RCVD 
SISER_TIMEOUT_RCVD 

Definition at line 114 of file MZ_i2c_example.h.

◆ SICMD_RESP

enum SICMD_RESP
Enumerator
SICMD_NOT_DONE 
SICMD_ERROR 
SICMD_TIMEOUT 
SICMD_NG 
SICMD_DONE 

Definition at line 121 of file MZ_i2c_example.h.

◆ SICMD_REQ

enum SICMD_REQ
Enumerator
SI_CMD_NONE 
SI_CMD_READ_ALS 
SI_CMD_READ_UV 

Definition at line 129 of file MZ_i2c_example.h.

Function Documentation

◆ SENSOR_Init()

void SENSOR_Init ( )

Function Sensor Initialisation.

Parameters
NONE
Return values
NONE

Definition at line 358 of file MZ_i2c_example.c.

◆ SENSOR_Config()

mz_error_t SENSOR_Config ( )

Function to config the sensor.

Parameters
None
Return values
MZ_OK/MZ_FAIL

Definition at line 248 of file MZ_i2c_example.c.

◆ SENSOR_getUv()

int32_t SENSOR_getUv ( int32_t  uv,
SENSOR_Coeff_TypeDef uk 
)

Function to Conversion of Raw Data.

Parameters
uv-Raw data.
uk- Sensor Coefficient.
Return values
uvi-Sensor Converted Data.

Definition at line 452 of file MZ_i2c_example.c.

◆ SENSOR_calcEvalPoly()

int32_t SENSOR_calcEvalPoly ( int32_t  x,
int32_t  y,
uint8_t  input_fraction,
uint8_t  output_fraction,
uint8_t  num_coeff,
SENSOR_Coeff_TypeDef kp 
)

Function to Conversion of Raw Data.

Parameters
xint32_t -Raw data.
yint32_t - Sensor fraction.
input_fractionuint8_t
output_fractionuint8_t
num_coeffuint8_t
kp*SENSOR_Coeff_TypeDef.
Return values
value-Sensor data converted with calcEvalPoly.

Definition at line 493 of file MZ_i2c_example.c.

◆ SENSOR_calcPolyInner()

int32_t SENSOR_calcPolyInner ( int32_t  input,
int8_t  fraction,
uint16_t  mag,
int8_t  shift 
)

Function to Conversion of Raw Data.

Parameters
input-Raw data.
fraction- Sensor fraction.
mag- Sensor magnitude.
shift- Sensor shifted.
Return values
value-Sensor data converted with polyInner.

Definition at line 467 of file MZ_i2c_example.c.

◆ Sensor_ReadID()

mz_error_t Sensor_ReadID ( uint8_t *  buf)

Function to read the content from ID register of SENSOR.

Parameters
buf- buffer which receives data from the ID register
Return values
MZ_OKor MZ_FAIL

Definition at line 374 of file MZ_i2c_example.c.

◆ Sensor_cmd_data_conf()

mz_error_t Sensor_cmd_data_conf ( uint8_t  addr,
uint8_t  data 
)

Function to write data for Sensor Configuration.

Parameters
addr- address of the register
data- buffer which receives data from the register
Return values
MZ_OKor MZ_FAIL

Definition at line 341 of file MZ_i2c_example.c.

◆ I2C_ReadID_Reg()

mz_error_t I2C_ReadID_Reg ( uint8_t *  buf)

◆ I2C_Read_Reg()

mz_error_t I2C_Read_Reg ( uint8_t  addr,
uint32_t *  buf 
)

Function to read from the specific register.

Parameters
addr- address of the register
buf- buffer which receives data from the register
Return values
MZ_OKor MZ_FAIL

Definition at line 148 of file MZ_i2c_example.c.

◆ I2C_Write_Reg()

mz_error_t I2C_Write_Reg ( uint8_t  addr,
uint8_t  data 
)

Function to write into the specific register.

Parameters
addr- address of the register
data- data to be write
Return values
MZ_OKor MZ_FAIL

Definition at line 125 of file MZ_i2c_example.c.

◆ Get_SenPayload_UV_DataStr()

uint8_t * Get_SenPayload_UV_DataStr ( void  )

◆ send_SI_cmd_and_wait_resp()

SISER_RCVD send_SI_cmd_and_wait_resp ( SICMD_REQ  req,
uint32_t  timeout 
)

◆ param_table_write()

mz_error_t param_table_write ( uint8_t  addr,
uint8_t  data 
)

Function to read from the specific register.

Parameters
addr- address of the register
data- buffer which receives data from the register
Return values
MZ_OKor MZ_FAIL

Definition at line 188 of file MZ_i2c_example.c.

◆ i2c_app_init()

mz_error_t i2c_app_init ( void  )

Definition at line 88 of file MZ_i2c_example.c.

◆ SI_Read_UV()

SISER_RCVD SI_Read_UV ( void  )

Function to read the data from SENSOR.

Parameters
NONE
Return values
SISER_VALID_RESP_RCVDor SISER_INVALID_RESP_RCVD

Definition at line 400 of file MZ_i2c_example.c.

◆ reset_resp_counter()

void reset_resp_counter ( void  )

Reset register.

Parameters
None
Return values
None

Definition at line 174 of file MZ_i2c_example.c.

◆ int8buf_to_asciibuf()

void int8buf_to_asciibuf ( uint8_t *  destbuf,
uint8_t *  srcbuf,
uint16_t  len 
)

Function to Conversion of Int to ascii data.

Parameters
destbuf-destination string.
srcbuf-source string.
len-string.
Return values
None.

Definition at line 633 of file MZ_i2c_example.c.

◆ Get_String_len()

uint16_t Get_String_len ( uint8_t *  buf)

Function to get string length.

Parameters
buf-string.
Return values
len-string length.

Definition at line 617 of file MZ_i2c_example.c.

◆ string_append()

uint8_t string_append ( uint8_t *  srcstr,
uint8_t *  apstr 
)

Function to append the string.

Parameters
apstr-append string.
srcstr-source string.
Return values
value-string index.

Definition at line 596 of file MZ_i2c_example.c.

◆ string_copy()

uint16_t string_copy ( uint8_t *  dststr,
uint8_t *  srcstr 
)

Function to Copy the data from source to destination.

Parameters
dststr-destination string.
srcstr-source string.
Return values
value-string index.

Definition at line 580 of file MZ_i2c_example.c.

◆ calib_uv_index()

void calib_uv_index ( float  uv_raw_data)

Function to calibrate the raw data.

Parameters
uv_raw_datafloat.
Return values
value-None.

Definition at line 560 of file MZ_i2c_example.c.

Variable Documentation

◆ lk

Initial value:
= {
{ { 0, 209 },
{ 1665, 93 },
{ 2064, 65 },
{ -2671, 234 } },
{ { 0, 0 },
{ 1921, 29053 },
{ -1022, 36363 },
{ 2320, 20789 },
{ -367, 57909 },
{ -1774, 38240 },
{ -608, 46775 },
{ -1503, 51831 },
{ -1886, 58928 } }
}

Definition at line 152 of file MZ_i2c_example.h.

◆ uk

SENSOR_Coeff_TypeDef uk[2]
static
Initial value:
= {
{ 1281, 30902 },
{ -638, 46301 }
}

Definition at line 168 of file MZ_i2c_example.h.

◆ SENSOR_payload

PAYLOAD_ST SENSOR_payload

Definition at line 177 of file MZ_i2c_example.h.

◆ N

uint8_t N

Definition at line 189 of file MZ_i2c_example.h.