monoZ docs
|
Go to the source code of this file.
Data Structures | |
struct | SI_CMD |
struct | SENSOR_Coeff_TypeDef |
struct | SENSOR_LuxCoeff_TypeDef |
struct | PAYLOAD_ST |
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 |
#define SI_REG_RD 0x01 |
Definition at line 12 of file MZ_i2c_example.h.
#define SI_REG_WR 0x00 |
Definition at line 13 of file MZ_i2c_example.h.
#define SI_REG_RA | ( | x | ) | (x) |
Definition at line 15 of file MZ_i2c_example.h.
#define SI_ID_REG_PART_ID 0X00 |
Definition at line 16 of file MZ_i2c_example.h.
#define SI_ID_REG_HW_ID 0X01 |
Definition at line 17 of file MZ_i2c_example.h.
#define SI_ID_REG_REV_ID 0X02 |
Definition at line 18 of file MZ_i2c_example.h.
#define SI_SL_ADD (SLAVE_ADD) |
Definition at line 19 of file MZ_i2c_example.h.
#define ENMASK_UV_INDEX (1u << 6) |
Definition at line 21 of file MZ_i2c_example.h.
#define RETRY_MAX 2 |
Definition at line 22 of file MZ_i2c_example.h.
#define TIMEOUT_5_SECS 5000UL |
Definition at line 23 of file MZ_i2c_example.h.
#define TIMEOUT_15_SECS 15000UL |
Definition at line 24 of file MZ_i2c_example.h.
#define TIMEOUT_25_SECS 25000UL |
Definition at line 25 of file MZ_i2c_example.h.
#define TIMEOUT_35_SECS 35000UL |
Definition at line 26 of file MZ_i2c_example.h.
#define TIMEOUT_90_SECS 90000UL |
Definition at line 27 of file MZ_i2c_example.h.
#define TIMEOUT_120_SECS 120000UL |
Definition at line 28 of file MZ_i2c_example.h.
#define TIMEOUT_180_SECS 180000UL |
Definition at line 29 of file MZ_i2c_example.h.
#define TIMEOUT_360_SECS 360000UL |
Definition at line 30 of file MZ_i2c_example.h.
#define SENSOR_REG_IRQ_ENABLE 0x0F |
Definition at line 103 of file MZ_i2c_example.h.
#define SENSOR_REG_IRQ_STATUS 0x12 |
Definition at line 106 of file MZ_i2c_example.h.
#define SENSOR_REG_HOSTOUT0 0x13 |
Definition at line 34 of file MZ_i2c_example.h.
#define SENSOR_REG_HOSTOUT1 0x14 |
Definition at line 35 of file MZ_i2c_example.h.
#define SENSOR_REG_HOSTOUT2 0x15 |
Definition at line 36 of file MZ_i2c_example.h.
#define SENSOR_REG_HOSTOUT3 0x16 |
Definition at line 37 of file MZ_i2c_example.h.
#define SENSOR_REG_HOSTOUT4 0x17 |
Definition at line 38 of file MZ_i2c_example.h.
#define SENSOR_REG_HOSTOUT5 0x18 |
Definition at line 39 of file MZ_i2c_example.h.
#define SENSOR_REG_HOSTOUT6 0x19 |
Definition at line 40 of file MZ_i2c_example.h.
#define SENSOR_REG_HOSTOUT7 0x1A |
Definition at line 41 of file MZ_i2c_example.h.
#define SENSOR_REG_HOSTOUT8 0x1B |
Definition at line 42 of file MZ_i2c_example.h.
#define SENSOR_REG_HOSTOUT9 0x1C |
Definition at line 43 of file MZ_i2c_example.h.
#define SENSOR_REG_HOSTOUT10 0x1D |
Definition at line 44 of file MZ_i2c_example.h.
#define SENSOR_REG_HOSTOUT11 0x1E |
Definition at line 45 of file MZ_i2c_example.h.
#define SENSOR_REG_HOSTOUT12 0x1F |
Definition at line 46 of file MZ_i2c_example.h.
#define SENSOR_REG_HOSTOUT13 0x20 |
Definition at line 47 of file MZ_i2c_example.h.
#define SENSOR_REG_HOSTOUT14 0x21 |
Definition at line 48 of file MZ_i2c_example.h.
#define SENSOR_REG_HOSTOUT15 0x22 |
Definition at line 49 of file MZ_i2c_example.h.
#define SENSOR_REG_HOSTOUT16 0x23 |
Definition at line 50 of file MZ_i2c_example.h.
#define SENSOR_REG_HOSTOUT17 0x24 |
Definition at line 51 of file MZ_i2c_example.h.
#define SENSOR_REG_HOSTOUT18 0x25 |
Definition at line 52 of file MZ_i2c_example.h.
#define SENSOR_REG_HOSTOUT19 0x26 |
Definition at line 53 of file MZ_i2c_example.h.
#define SENSOR_REG_HOSTOUT20 0x27 |
Definition at line 54 of file MZ_i2c_example.h.
#define SENSOR_REG_HOSTOUT21 0x28 |
Definition at line 55 of file MZ_i2c_example.h.
#define SENSOR_REG_HOSTOUT22 0x29 |
Definition at line 56 of file MZ_i2c_example.h.
#define SENSOR_REG_HOSTOUT23 0x2A |
Definition at line 57 of file MZ_i2c_example.h.
#define SENSOR_REG_HOSTOUT24 0x2B |
Definition at line 58 of file MZ_i2c_example.h.
#define SENSOR_REG_HOSTOUT25 0x2C |
Definition at line 59 of file MZ_i2c_example.h.
#define UV_INPUT_FRACTION 15 |
Definition at line 61 of file MZ_i2c_example.h.
#define UV_OUTPUT_FRACTION 12 |
Definition at line 62 of file MZ_i2c_example.h.
#define UV_NUMCOEFF 2 |
Definition at line 63 of file MZ_i2c_example.h.
#define ADC_THRESHOLD 16000 |
Definition at line 64 of file MZ_i2c_example.h.
#define INPUT_FRACTION_HIGH 7 |
Definition at line 65 of file MZ_i2c_example.h.
#define INPUT_FRACTION_LOW 15 |
Definition at line 66 of file MZ_i2c_example.h.
#define LUX_OUTPUT_FRACTION 12 |
Definition at line 67 of file MZ_i2c_example.h.
#define NUMCOEFF_LOW 9 |
Definition at line 68 of file MZ_i2c_example.h.
#define NUMCOEFF_HIGH 4 |
Definition at line 69 of file MZ_i2c_example.h.
#define X_ORDER_MASK 0x0070 |
Definition at line 71 of file MZ_i2c_example.h.
#define Y_ORDER_MASK 0x0007 |
Definition at line 72 of file MZ_i2c_example.h.
#define SIGN_MASK 0x0080 |
Definition at line 73 of file MZ_i2c_example.h.
#define get_x_order | ( | m | ) | ( (m & X_ORDER_MASK) >> 4) |
Definition at line 74 of file MZ_i2c_example.h.
#define get_y_order | ( | m | ) | ( (m & Y_ORDER_MASK) ) |
Definition at line 75 of file MZ_i2c_example.h.
#define get_sign | ( | m | ) | ( (m & SIGN_MASK) >> 7) |
Definition at line 76 of file MZ_i2c_example.h.
#define SENSOR_PARAM_I2C_ADDR 0x00 |
Definition at line 79 of file MZ_i2c_example.h.
#define SENSOR_PARAM_CH_LIST 0x01 |
Definition at line 80 of file MZ_i2c_example.h.
#define SENSOR_PARAM_ADCCONFIG0 0x02 |
Definition at line 81 of file MZ_i2c_example.h.
#define SENSOR_PARAM_ADCSENS0 0x03 |
Definition at line 82 of file MZ_i2c_example.h.
#define SENSOR_PARAM_ADCPOST0 0x04 |
Definition at line 83 of file MZ_i2c_example.h.
#define SENSOR_PARAM_MEASCONFIG0 0x05 |
Definition at line 84 of file MZ_i2c_example.h.
#define SENSOR_PARAM_ADCCONFIG1 0x06 |
Definition at line 85 of file MZ_i2c_example.h.
#define SENSOR_PARAM_ADCSENS1 0x07 |
Definition at line 86 of file MZ_i2c_example.h.
#define SENSOR_PARAM_ADCPOST1 0x08 |
Definition at line 87 of file MZ_i2c_example.h.
#define SENSOR_PARAM_MEASCONFIG1 0x09 |
Definition at line 88 of file MZ_i2c_example.h.
#define SENSOR_PARAM_ADCCONFIG2 0x0A |
Definition at line 89 of file MZ_i2c_example.h.
#define SENSOR_PARAM_ADCSENS2 0x0B |
Definition at line 90 of file MZ_i2c_example.h.
#define SENSOR_PARAM_ADCPOST2 0x0C |
Definition at line 91 of file MZ_i2c_example.h.
#define SENSOR_PARAM_MEASCONFIG2 0x0D |
Definition at line 92 of file MZ_i2c_example.h.
#define SENSOR_PARAM_ADCCONFIG3 0x0E |
Definition at line 93 of file MZ_i2c_example.h.
#define SENSOR_PARAM_ADCSENS3 0x0F |
Definition at line 94 of file MZ_i2c_example.h.
#define SENSOR_PARAM_ADCPOST3 0x10 |
Definition at line 95 of file MZ_i2c_example.h.
#define SENSOR_PARAM_MEASCONFIG3 0x11 |
Definition at line 96 of file MZ_i2c_example.h.
#define SENSOR_PARAM_ADCCONFIG4 0x12 |
Definition at line 97 of file MZ_i2c_example.h.
#define SENSOR_PARAM_ADCSENS4 0x13 |
Definition at line 98 of file MZ_i2c_example.h.
#define SENSOR_PARAM_ADCPOST4 0x14 |
Definition at line 99 of file MZ_i2c_example.h.
#define SENSOR_PARAM_MEASCONFIG4 0x15 |
Definition at line 100 of file MZ_i2c_example.h.
#define SENSOR_REG_HOSTIN0 0x0A |
Definition at line 101 of file MZ_i2c_example.h.
#define SENSOR_REG_COMMAND 0x0B |
Definition at line 102 of file MZ_i2c_example.h.
#define SENSOR_REG_IRQ_ENABLE 0x0F |
Definition at line 103 of file MZ_i2c_example.h.
#define SENSOR_REG_RESPONSE1 0x10 |
Definition at line 104 of file MZ_i2c_example.h.
#define SENSOR_REG_RESPONSE0 0x11 |
Definition at line 105 of file MZ_i2c_example.h.
#define SENSOR_REG_IRQ_STATUS 0x12 |
Definition at line 106 of file MZ_i2c_example.h.
#define SENSOR_REG_BURST 0x2B |
Definition at line 107 of file MZ_i2c_example.h.
#define RESET_CMD_CTR 0x00 |
Definition at line 109 of file MZ_i2c_example.h.
#define FORCE_CMD 0x11 |
Definition at line 110 of file MZ_i2c_example.h.
#define SENSOR_RSP0_COUNTER_MASK 0x1F |
Definition at line 111 of file MZ_i2c_example.h.
#define SENSOR_OK 0000 |
Definition at line 112 of file MZ_i2c_example.h.
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.
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.
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.
void SENSOR_Init | ( | ) |
Function Sensor Initialisation.
NONE |
NONE |
Definition at line 358 of file MZ_i2c_example.c.
mz_error_t SENSOR_Config | ( | ) |
Function to config the sensor.
None |
MZ_OK/MZ_FAIL |
Definition at line 248 of file MZ_i2c_example.c.
int32_t SENSOR_getUv | ( | int32_t | uv, |
SENSOR_Coeff_TypeDef * | uk | ||
) |
Function to Conversion of Raw Data.
uv | -Raw data. |
uk | - Sensor Coefficient. |
uvi- | Sensor Converted Data. |
Definition at line 452 of file MZ_i2c_example.c.
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.
x | int32_t -Raw data. |
y | int32_t - Sensor fraction. |
input_fraction | uint8_t |
output_fraction | uint8_t |
num_coeff | uint8_t |
kp | *SENSOR_Coeff_TypeDef. |
value- | Sensor data converted with calcEvalPoly. |
Definition at line 493 of file MZ_i2c_example.c.
int32_t SENSOR_calcPolyInner | ( | int32_t | input, |
int8_t | fraction, | ||
uint16_t | mag, | ||
int8_t | shift | ||
) |
Function to Conversion of Raw Data.
input | -Raw data. |
fraction | - Sensor fraction. |
mag | - Sensor magnitude. |
shift | - Sensor shifted. |
value- | Sensor data converted with polyInner. |
Definition at line 467 of file MZ_i2c_example.c.
mz_error_t Sensor_ReadID | ( | uint8_t * | buf | ) |
Function to read the content from ID register of SENSOR.
buf | - buffer which receives data from the ID register |
MZ_OK | or MZ_FAIL |
Definition at line 374 of file MZ_i2c_example.c.
mz_error_t Sensor_cmd_data_conf | ( | uint8_t | addr, |
uint8_t | data | ||
) |
Function to write data for Sensor Configuration.
addr | - address of the register |
data | - buffer which receives data from the register |
MZ_OK | or MZ_FAIL |
Definition at line 341 of file MZ_i2c_example.c.
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.
addr | - address of the register |
buf | - buffer which receives data from the register |
MZ_OK | or MZ_FAIL |
Definition at line 148 of file MZ_i2c_example.c.
mz_error_t I2C_Write_Reg | ( | uint8_t | addr, |
uint8_t | data | ||
) |
Function to write into the specific register.
addr | - address of the register |
data | - data to be write |
MZ_OK | or MZ_FAIL |
Definition at line 125 of file MZ_i2c_example.c.
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.
addr | - address of the register |
data | - buffer which receives data from the register |
MZ_OK | or MZ_FAIL |
Definition at line 188 of file MZ_i2c_example.c.
mz_error_t i2c_app_init | ( | void | ) |
Definition at line 88 of file MZ_i2c_example.c.
SISER_RCVD SI_Read_UV | ( | void | ) |
Function to read the data from SENSOR.
NONE |
SISER_VALID_RESP_RCVD | or SISER_INVALID_RESP_RCVD |
Definition at line 400 of file MZ_i2c_example.c.
void reset_resp_counter | ( | void | ) |
void int8buf_to_asciibuf | ( | uint8_t * | destbuf, |
uint8_t * | srcbuf, | ||
uint16_t | len | ||
) |
Function to Conversion of Int to ascii data.
destbuf | -destination string. |
srcbuf | -source string. |
len | -string. |
None. |
Definition at line 633 of file MZ_i2c_example.c.
uint16_t Get_String_len | ( | uint8_t * | buf | ) |
Function to get string length.
buf | -string. |
len- | string length. |
Definition at line 617 of file MZ_i2c_example.c.
uint8_t string_append | ( | uint8_t * | srcstr, |
uint8_t * | apstr | ||
) |
Function to append the string.
apstr | -append string. |
srcstr | -source string. |
value- | string index. |
Definition at line 596 of file MZ_i2c_example.c.
uint16_t string_copy | ( | uint8_t * | dststr, |
uint8_t * | srcstr | ||
) |
Function to Copy the data from source to destination.
dststr | -destination string. |
srcstr | -source string. |
value- | string index. |
Definition at line 580 of file MZ_i2c_example.c.
void calib_uv_index | ( | float | uv_raw_data | ) |
Function to calibrate the raw data.
uv_raw_data | float. |
value- | None. |
Definition at line 560 of file MZ_i2c_example.c.
|
static |
Definition at line 152 of file MZ_i2c_example.h.
|
static |
Definition at line 168 of file MZ_i2c_example.h.
PAYLOAD_ST SENSOR_payload |
Definition at line 177 of file MZ_i2c_example.h.
uint8_t N |
Definition at line 189 of file MZ_i2c_example.h.