void SwitchOffCurrentSource(int channel) { if (channel == 0) { imx233_wr(HW_LRADC_CTRL2_CLR, LRADC_CTRL2_TEMP_SENSOR_IENABLE0); //set TEMP_SENSOR_IENABLE0=0 } else if (channel == 1) { imx233_wr(HW_LRADC_CTRL2_CLR, LRADC_CTRL2_TEMP_SENSOR_IENABLE1); //set TEMP_SENSOR_IENABLE1=0 } }
int main(int argc, char **argv) { // If the name of the offset ends in CLR, the bits that are hi will be set to 0. // If the name of the offset ends in SET, the bits that are hi will be set to 1. // If the name of the offset ends in TOG, the bits that are hi will be toggled. // Change the function of the processor pins imx233_wr(HW_PINCTRL_MUXSEL0_SET, 0x00000300); // Enable the GPIO output imx233_wr(HW_PINCTRL_DOE0_SET, 0x00000010); // Enable the GPIO output imx233_wr(HW_PINCTRL_DOUT0_CLR, 0x00000010); usleep(1000); imx233_wr(HW_PINCTRL_DOUT0_SET, 0x00000010); }
void SetUpCurrentSource(int channel, unsigned current_ua) { if (current_ua > 300) return; int isrc_val = current_ua / 20; if (channel == 0) { imx233_wr(HW_LRADC_CTRL2_CLR, LRADC_CTRL2_TEMP_ISRC_MASK << LRADC_CTRL2_TEMP_ISRC0_OFFSET); //clear TEMP_ISRC0 imx233_wr(HW_LRADC_CTRL2_SET, isrc_val << LRADC_CTRL2_TEMP_ISRC0_OFFSET | LRADC_CTRL2_TEMP_SENSOR_IENABLE0); } else if (channel == 1) { imx233_wr(HW_LRADC_CTRL2_CLR, LRADC_CTRL2_TEMP_ISRC_MASK << LRADC_CTRL2_TEMP_ISRC1_OFFSET); //clear TEMP_ISRC1 imx233_wr(HW_LRADC_CTRL2_SET, isrc_val << LRADC_CTRL2_TEMP_ISRC1_OFFSET | LRADC_CTRL2_TEMP_SENSOR_IENABLE1); } }