OSStatus user_modules_init(void) { OSStatus err = kUnknownErr; // init DC Motor(GPIO) dc_motor_init(); dc_motor_set(0); // off // init RGB LED(P9813) hsb2rgb_led_init(); hsb2rgb_led_open(0, 0, 0); // off // init OLED OLED_Init(); //OLED_Clear(); LCD_Clear(0x00); OLED_ShowString(20,0,"M X C H I P"); OLED_ShowString(20,3,(uint8_t*)DEFAULT_DEVICE_NAME); OLED_ShowString(0,6,"T: 0C H: 0%"); // init Light sensor(ADC) light_sensor_init(); // init infrared sensor(ADC) infrared_reflective_init(); // init user key1 && key2 user_key1_init(); user_key2_init(); err = kNoErr; return err; }
//------------------------------------- API ------------------------------------ OSStatus user_modules_init(void) { OSStatus err = kUnknownErr; char oled_show_line[16] = {'\0'}; // max char each line // init DC Motor(GPIO) dc_motor_init(); dc_motor_set(0); // off // init RGB LED(P9813) rgb_led_init(); rgb_led_open(0, 0, 0); // off // init OLED OLED_Init(); OLED_Clear(); snprintf(oled_show_line, 16, "%s", (uint8_t*)DEV_KIT_MANUFACTURER); OLED_ShowString(0,0,(uint8_t*)oled_show_line); memset(oled_show_line, '\0', 16); snprintf(oled_show_line, 16, "%s", (uint8_t*)DEV_KIT_NAME); OLED_ShowString(0,3,(uint8_t*)oled_show_line); OLED_ShowString(0,6,"Starting... "); // init Light sensor(ADC) light_sensor_init(); // init infrared sensor(ADC) infrared_reflective_init(); // init user key1 && key2 user_key1_init(); user_key2_init(); err = temp_hum_sensor_init(); return err; }