int main(void) { vfnLCD_Init(); vfnPS2_Config(); vfnUART_Config(); for(;;) { vfnKeyboardLCD(); } return 0; }
int main (void) { char ch; uint16 u16cnt=0; #ifdef CMSIS // If we are conforming to CMSIS, we need to call start here start(); #endif /*LCD Init*/ vfnLCD_Init(); /*Turn On All LCD segments*/ vfnLCD_Set_Display(); /*Turn Off All LCD segments*/ vfnLCD_Clear_Display(); /*Turn On FREESCALE segment*/ _FREESCALE_ON(); printf("\n\rRunning the TWRPI_sLCD project.\n\r"); /* Assign the counter value to the buffer*/ sprintf(s8DispBuffer,"%04d",u16cnt); vfnLCD_Write_Msg_GoTo(s8DispBuffer,4,0); //Display formatted buffer while(1) { ch = in_char(); out_char(ch); u16cnt++; if(u16cnt>1999) u16cnt=0; /* Assign the counter value to the buffer*/ sprintf(s8DispBuffer,"%04d",u16cnt); vfnLCD_Write_Msg_GoTo(s8DispBuffer,4,0); //Display formatted buffer } }
int main (void) { char ch,aux1 ,aux2; int UsbDetected = FALSE; #ifdef CMSIS // If we are conforming to CMSIS, we need to call start here start(); #endif vfnMcuConfig(); printf("\n\rRunning the FRDMKL46_Demo project.\n\r"); vfnLCD_Init(); gpio_init(); Pit_init(); TSI_Init(); usb_init(); next_task(vfn_led_test); accel_init(); mag_init(); eCompassInit(); adc_init(); tpm_init(); //Green LED 50%SIM_SCGC5_PORTC_MASK // character test vfnLCD_Write_Msg("8888"); _LCD_DP1_ON(); _LCD_DP2_ON(); _LCD_DP3_ON(); _LCD_COL_ON(); while(1) { #ifdef FRDM_REVA if (uart_getchar_present(UART1_BASE_PTR)) #else if (uart0_getchar_present(UART0_BASE_PTR)) #endif { ch = in_char(); printf("\n\r Received char = %c \n\r",ch); if (ch==' ') { printf("\n\r light_sensor = %i",adc_light_sensor); // printf("\n\r Yaw =%4d Pitch =%4d Roll =%4d \r", APhi6DOF, AThe6DOF, APsi6DOF); printf("\n\r Yaw =%4d Pitch =%4d Roll =%4d \r", APsi6DOF, APhi6DOF, AThe6DOF); printf("\n\r tsi %%= %03i ", AbsolutePercentegePosition); } } if (input_rise(SW1_ON, &aux1)) { printf("\n\r SW1 \n\r"); } if (input_rise(SW2_ON, &aux2)) { printf("\n\r SW2 \n\r "); } ptr_next_task(); // do the actual function TSI_SliderRead(); usb_service(); if (gu8USB_State == uENUMERATED && !UsbDetected) { // next_task(vfn_rgb_test); UsbDetected = TRUE; } adc_light_sensor = adc_read(3); } }
int main (void) { char ch; char low_power_mode = MODE_SELECT; SMC_PMPROT = SMC_PMPROT_ALLS_MASK | SMC_PMPROT_AVLLS_MASK | SMC_PMPROT_AVLP_MASK ; #ifdef CMSIS // If we are conforming to CMSIS, we need to call start here start(); #endif print_llwu_status(); gpio_init(); rtc_init(); // driven by 32kHz external oscillator // vfnLCD_Init(); vfnLCD_Write_Msg("1234"); PORTC_PCR3 = PORT_PCR_MUX(1) | PORT_PCR_PE_MASK | PORT_PCR_PS_MASK; enable_irq(INT_LLW-16); llwu_configure(0x0080,0x02,LLWU_ME_WUME5_MASK); //M5= RTC Alarm, M7 RTC seconds //check if it comes from VLLx mode if (PMC_REGSC % PMC_REGSC_ACKISO_MASK) { if (last_gpio_status&0x01) LED1_ON; else LED1_OFF; //configure GPIO pin with latest state PMC_REGSC |= PMC_REGSC_ACKISO_MASK; //write to release hold on I/O last_gpio_status ^= 0x01; //update state for next work } printf("\n\rRunning the lcd_rtc_lowpower project.\n\r"); // wait 3 seconds before start entering in low power mode while (rtc_seconds_isrv_count<3){}; while(1) { LED2_TOGGLE; ch= (char)RTC_TSR; sprintf(gu8USB_Buffer,"%4i",ch ); vfnLCD_Write_Msg(gu8USB_Buffer); printf("\n\r llwu_isrv_counter = %i, rtc_isrv_counter=%i ",llwu_isrv_counter, rtc_isrv_counter ); printf(" "); //delay switch (low_power_mode) { case MODE_WAIT: enter_wait(); printf("\n\r exit from WAIT"); break; case MODE_STOP: /* 0x00 = STOP - Normal Stop Mode 0x40 = PSTOP1 - Partial Stop with both system and bus clocks disabled 0x80 = PSTOP2 - Partial Stop with system clock disabled and bus clock enabled */ enter_stop(0x00); printf("\n\r exit from STOP"); break; case MODE_LLS: MCG_C6 &= ~MCG_C6_CME0_MASK; //Disable Clock Monitor before entering in low power mode LLS, VLSSx enter_lls(); op_mode = what_mcg_mode(); if(op_mode==PBE) { mcg_clk_hz = pbe_pee(CLK0_FREQ_HZ); MCG_C6 |= MCG_C6_CME0_MASK; } printf("\n\r exit from LLS"); break; case MODE_VLLS3: MCG_C6 &= ~MCG_C6_CME0_MASK; enter_vlls3(); //Note: exit from VLLSx mode is through RESET PMC_REGSC_ACKISO is set break; // VLLS2 mode not supported on KL46 case MODE_VLLS1: MCG_C6 &= ~MCG_C6_CME0_MASK; enter_vlls1(); //In VLLS1 and VLLS0 no SRAM is retained. //Note: exit from VLLSx mode is through RESET PMC_REGSC_ACKISO is set break; default: } } }