void system_init() { // OLED Init OLED_Init(); OLED_FillScreen(OLED_COLOR_BLACK); // GPIO Init R_LED = 1; G_LED = 1; B_LED = 1; GPIO_Digital_Output(&PTC_PDOR, _GPIO_PINMASK_8); GPIO_Digital_Output(&PTD_PDOR, _GPIO_PINMASK_0); GPIO_Digital_Output(&PTC_PDOR, _GPIO_PINMASK_9); GPIO_Analog_Input(&PTB_PDIR, _GPIO_PINMASK_6); // AN GPIO_Analog_Input(&PTB_PDIR, _GPIO_PINMASK_7); // INT GPIO_Digital_Output(&PTA_PDOR, _GPIO_PINMASK_4); // PWM GPIO_Digital_Output(&PTB_PDOR, _GPIO_PINMASK_9); // Vibration PIN PTB_PDOR = 0; // PWM Init current_duty = 0; pwm_period = PWM_FTM0_Init(200, _PWM_EDGE_ALIGNED_PWM, _PWM_CHANNEL_1, &_GPIO_Module_PWM0_PTA4); PWM_FTM0_Set_Duty(0, _PWM_NON_INVERTED, _PWM_CHANNEL_1); // Set duty ratio PWM_FTM0_Start(_PWM_CHANNEL_1); Delay_ms(100); // Display text OLED_DrawBox(0, 0, 96, 15, OLED_COLOR_BLUE); OLED_DrawBox(0, 80, 96, 15, OLED_COLOR_BLUE); OLED_SetFont(guiFont_Exo_2_Condensed10x16_Regular, OLED_COLOR_WHITE, 0); OLED_WriteText("BRUSHLESS", 20, 0); OLED_WriteText("Period:", 5, 30); OLED_WriteText("Duty:", 5, 50); OLED_WriteText("DEC", 15, 80); OLED_WriteText("INC", 63, 80); WordToStr(pwm_period, txt_value); OLED_WriteText(txt_value, 50, 30); WordToStr(current_duty, txt_value); OLED_WriteText(txt_value, 50, 50); hexiwear_uart_messaging_init(); // Init UART messaging MOTOR_DIR = CCW; // Setting motor direction // to counter-clock-wise }
void screen_init(){ OLED_Init(); OLED_FillScreen( OLED_COLOR_BLACK ); OLED_SetFont( guiFont_Tahoma_8_Regular, OLED_COLOR_WHITE, 0 ); OLED_DrawImage(Proximity2_bmp,0,0); }