16 #include "clock_config.h" 18 #include "fsl_debug_console.h" 19 #include "fsl_irqsteer.h" 22 #include "Driver_I2C.h" 25 #include "issdk_hal.h" 34 #define ISL29023_DATA_SIZE (2) 43 #define ISL29023_INT_HT_DATA (11000) 44 #define ISL29023_INT_LT_DATA (5000) 91 ipc = BOARD_InitRpc();
98 PRINTF(
"\r\n ------------------------------------------------------------------\r\n");
99 PRINTF(
"\r\n ISSDK ISL29023 sensor driver example demonstration with POLL mode\r\n");
100 PRINTF(
"\r\n ------------------------------------------------------------------\r\n");
103 if (sc_pm_set_resource_power_mode(ipc, SC_R_I2C_0, SC_PM_PW_MODE_ON) != SC_ERR_NONE)
105 PRINTF(
"Error: Failed to power on LPI2C\r\n");
109 freq = CLOCK_SetIpFreq(kCLOCK_DMA_Lpi2c0, SC_24MHZ);
112 PRINTF(
"Error: Failed to set LPI2C frequency\r\n");
116 #if (MIMX8QM_CM4_CORE0) 117 if (sc_pm_set_resource_power_mode(ipc, SC_R_IRQSTR_M4_0, SC_PM_PW_MODE_ON) != SC_ERR_NONE)
119 PRINTF(
"Error: Failed to power on IRQSTEER M4_0\r\n");
121 #elif (MIMX8QM_CM4_CORE1) 122 if (sc_pm_set_resource_power_mode(ipc, SC_R_IRQSTR_M4_1, SC_PM_PW_MODE_ON) != SC_ERR_NONE)
124 PRINTF(
"Error: Failed to power on IRQSTEER M4_1\r\n");
129 IRQSTEER_Init(IRQSTEER);
130 IRQSTEER_EnableInterrupt(IRQSTEER, DMA_I2C0_INT_IRQn);
134 if (ARM_DRIVER_OK != status)
136 PRINTF(
"\r\n I2C Initialization Failed\r\n");
141 status = I2Cdrv->PowerControl(ARM_POWER_FULL);
142 if (ARM_DRIVER_OK != status)
144 PRINTF(
"\r\n I2C Power Mode setting Failed\r\n");
149 status = I2Cdrv->Control(ARM_I2C_BUS_SPEED, ARM_I2C_BUS_SPEED_FAST);
150 if (ARM_DRIVER_OK != status)
152 PRINTF(
"\r\n I2C Control Mode setting Failed\r\n");
161 PRINTF(
"\r\n Sensor Initialization Failed\r\n");
164 PRINTF(
"\r\n Successfully Initiliazed ISL29023 Sensor\r\n");
171 PRINTF(
"\r\n ISL29023 Sensor Configuration Failed, Err = %d\r\n", status);
174 PRINTF(
"\r\n Successfully Applied ISL29023 Sensor Configuration\r\n");
176 PRINTF(
"\r\n Reading ISL29023 ADC data\r\n");
189 if (ARM_DRIVER_OK != status)
191 PRINTF(
"\r\n Read Failed. \r\n");
196 rawData.
light = ((uint16_t)data[1] << 8) | data[0];
199 PRINTF(
"Light value: %d\r\n", rawData.
light);
#define ISL29023_CMD_I_OP_MASK
The isl29023_drv.h file describes the ISL29023 driver interface and structures.
#define ISL29023_CMD_I_FLAG_MASK
This structure defines the isl29023 raw data buffer.
This structure defines the Write command List.
#define ISL29023_CMD_II_RANGE_1
#define ASK_USER_TO_RESUME(x)
#define ISL29023_CMD_I_OP_ALS_CONT
int32_t ISL29023_I2C_ReadData(isl29023_i2c_sensorhandle_t *pSensorHandle, const registerreadlist_t *pReadList, uint8_t *pBuffer)
The interface function to read the sensor data.
#define ISL29023_DATA_SIZE
The size of the ISL29023 sensor data.
int32_t ISL29023_I2C_Configure(isl29023_i2c_sensorhandle_t *pSensorHandle, const registerwritelist_t *pRegWriteList)
The interface function to configure he sensor.
#define __END_WRITE_DATA__
typedef int32_t(DATA_FORMAT_Append_t))(void *pData
The interface function to append the data on the formated stream.
#define I2C_S_SIGNAL_EVENT
This defines the sensor specific information.
#define ISL29023_I2C_TEST_VALUE
#define BOARD_BootClockRUN
#define ISL29023_CMD_I_PRST_MASK
uint8_t data[FXLS8962_DATA_SIZE]
int32_t ISL29023_I2C_Initialize(isl29023_i2c_sensorhandle_t *pSensorHandle, ARM_DRIVER_I2C *pBus, uint8_t index, uint16_t sAddress, uint8_t test)
The interface function to initialize the sensor.
#define __END_READ_DATA__
#define ISL29023_INT_LT_DATA
#define ISL29023_INT_HT_DATA
#define ISL29023_CMD_II_RANGE_MASK
fxos8700_accelmagdata_t rawData
int main(void)
Main function.
const registerreadlist_t ISL29023_Output_Values[]
This structure defines the Read command List.
const registerreadlist_t ISL29023_Status[]
const registerwritelist_t ISL29023_Config_Poll[]
#define I2C_S_DEVICE_INDEX
#define ISL29023_CMD_II_RES_MASK
#define ISL29023_CMD_I_PRST_1
void BOARD_InitDebugConsole(void)
void BOARD_InitPins(void)
Configures pin routing and optionally pin electrical features.
#define ISL29023_CMD_II_RES_16
#define ISL29023_I2C_ADDRESS