void Init_MCU() { CM1CON = 0; // Turn off comparators CM2CON = 0; AD1PCFG = 0xff; // Make all inputs digital PMMODE = 0; PMAEN = 0; PMCON = 0; // WRSP: Write Strobe Polarity bit PMMODEbits.MODE = 2; // Master 2 PMMODEbits.WAITB = 0; PMMODEbits.WAITM = 1; PMMODEbits.WAITE = 0; PMMODEbits.MODE16 = 1; // 16 bit mode PMCONbits.CSF = 0; PMCONbits.PTRDEN = 1; PMCONbits.PTWREN = 1; PMCONbits.PMPEN = 1; TP_TFT_Rotate_180(0); TFT_Set_Active(Set_Index,Write_Command,Write_Data); //UART2_INIT(256000); // INITIALIZE UART MODULE AT 256000 BAUD //UART_Set_Active(&UART2_Read, &UART2_Write, &UART2_Data_Ready, &UART2_Tx_Idle); //DELAY_MS(100); // WAIT FOR UART MODULE TO STABILIZE }
void DrawScreen(TScreen *aScreen) { int order; char save_bled, save_bled_direction; object_pressed = 0; order = 0; CurrentScreen = aScreen; if ((display_width != CurrentScreen->Width) || (display_height != CurrentScreen->Height)) { save_bled = TFT_BLED; save_bled_direction = TFT_BLED_Direction; TFT_BLED_Direction = 0; TFT_BLED = 0; TFT_Set_Active(Set_Index, Write_Command, Write_Data); TFT_Init(CurrentScreen->Width, CurrentScreen->Height); TFT_Set_Ext_Buffer(TFT_Get_Data); TP_TFT_Init(CurrentScreen->Width, CurrentScreen->Height, 13, 12); // Initialize touch panel TP_TFT_Set_ADC_Threshold(ADC_THRESHOLD); // Set touch panel ADC threshold TFT_Fill_Screen(CurrentScreen->Color); display_width = CurrentScreen->Width; display_height = CurrentScreen->Height; TFT_BLED = save_bled; TFT_BLED_Direction = save_bled_direction; } else TFT_Fill_Screen(CurrentScreen->Color); while (order < CurrentScreen->ObjectsCount) { } }
static void InitializeTouchPanel() { Init_ADC(); TFT_Set_Active(Set_Index, Write_Command, Write_Data); TFT_Init(320, 240); TP_TFT_Init(320, 240, 13, 12); // Initialize touch panel TP_TFT_Set_ADC_Threshold(ADC_THRESHOLD); // Set touch panel ADC threshold }
void Init_MCU() { TRISE = 0; TFT_DataPort_Direction = 0; CLKDIVbits.PLLPRE = 0; // PLLPRE<4:0> = 0 -> N1 = 2 8MHz / 2 = 4MHz // (must be within 0.8 MHz to 8 MHz range) PLLFBD = 30; // PLLDIV<8:0> = 30 -> M = 32 4MHz * 32 = 128MHz // (must be within 100 MHz to 200 MHz range) CLKDIVbits.PLLPOST = 0; // PLLPOST<1:0> = 0 -> N2 = 2 128MHz / 2 = 64MHz // (must be within 12.5 MHz to 80 MHz range) Delay_ms(150); TP_TFT_Rotate_180(0); TFT_Set_Active(Set_Index,Write_Command,Write_Data); }
static void InitializeTouchPanel() { Init_ADC(); TFT_Set_Active(Set_Index, Write_Command, Write_Data); TFT_Init(320, 240); TFT_Set_Ext_Buffer(TFT_Get_Data); TP_TFT_Init(320, 240, 13, 12); // Initialize touch panel TP_TFT_Set_ADC_Threshold(ADC_THRESHOLD); // Set touch panel ADC threshold PenDown = 0; PressedObject = 0; PressedObjectType = -1; }
void Init_MCU() { PMMODE = 0; PMAEN = 0; PMCON = 0; // WRSP: Write Strobe Polarity bit PMMODEbits.MODE = 2; // Master 2 PMMODEbits.WAITB = 0; PMMODEbits.WAITM = 1; PMMODEbits.WAITE = 0; PMMODEbits.MODE16 = 1; // 16 bit mode PMCONbits.CSF = 0; PMCONbits.PTRDEN = 1; PMCONbits.PTWREN = 1; PMCONbits.PMPEN = 1; TP_TFT_Rotate_180(0); TFT_Set_Active(Set_Index,Write_Command,Write_Data); }
void DrawScreen(TScreen *aScreen) { int order; unsigned short button_idx; TButton *local_button; unsigned short image_idx; TImage *local_image; unsigned short radio_button_idx; TRadioButton *local_radio_button; char save_bled, save_bled_direction; object_pressed = 0; order = 0; button_idx = 0; image_idx = 0; radio_button_idx = 0; CurrentScreen = aScreen; if ((display_width != CurrentScreen->Width) || (display_height != CurrentScreen->Height)) { save_bled = TFT_BLED; save_bled_direction = TFT_BLED_Direction; TFT_BLED_Direction = 0; TFT_BLED = 0; TFT_Set_Active(Set_Index, Write_Command, Write_Data); TFT_Init(CurrentScreen->Width, CurrentScreen->Height); TFT_Set_Ext_Buffer(TFT_Get_Data); TP_TFT_Init(CurrentScreen->Width, CurrentScreen->Height, 13, 12); // Initialize touch panel TP_TFT_Set_ADC_Threshold(ADC_THRESHOLD); // Set touch panel ADC threshold TFT_Fill_Screen(CurrentScreen->Color); display_width = CurrentScreen->Width; display_height = CurrentScreen->Height; TFT_BLED = save_bled; TFT_BLED_Direction = save_bled_direction; } else TFT_Fill_Screen(CurrentScreen->Color); while (order < CurrentScreen->ObjectsCount) { if (button_idx < CurrentScreen->ButtonsCount) { local_button = GetButton(button_idx); if (order == local_button->Order) { button_idx++; order++; DrawButton(local_button); } } if (image_idx < CurrentScreen->ImagesCount) { local_image = GetImage(image_idx); if (order == local_image->Order) { image_idx++; order++; DrawImage(local_image); } } if (radio_button_idx < CurrentScreen->RadioButtonsCount) { local_radio_button = GetRadioButton(radio_button_idx); if (order == local_radio_button->Order) { radio_button_idx++; order++; DrawRadioButton(local_radio_button); } } } }
void DrawScreen(TScreen *aScreen) { unsigned int order; unsigned short round_button_idx; TButton_Round *local_round_button; unsigned short label_idx; TLabel *local_label; unsigned short image_idx; TImage *local_image; char save_bled, save_bled_direction; object_pressed = 0; order = 0; round_button_idx = 0; label_idx = 0; image_idx = 0; CurrentScreen = aScreen; if ((display_width != CurrentScreen->Width) || (display_height != CurrentScreen->Height)) { save_bled = TFT_BLED; save_bled_direction = TFT_BLED_Direction; TFT_BLED_Direction = 0; TFT_BLED = 0; TFT_Set_Active(Set_Index, Write_Command, Write_Data); TFT_Init(CurrentScreen->Width, CurrentScreen->Height); TP_TFT_Init(CurrentScreen->Width, CurrentScreen->Height, 13, 12); // Initialize touch panel TP_TFT_Set_ADC_Threshold(ADC_THRESHOLD); // Set touch panel ADC threshold TFT_Fill_Screen(CurrentScreen->Color); display_width = CurrentScreen->Width; display_height = CurrentScreen->Height; TFT_BLED = save_bled; TFT_BLED_Direction = save_bled_direction; } else TFT_Fill_Screen(CurrentScreen->Color); while (order < CurrentScreen->ObjectsCount) { if (round_button_idx < CurrentScreen->Buttons_RoundCount) { local_round_button = GetRoundButton(round_button_idx); if (order == local_round_button->Order) { round_button_idx++; order++; DrawRoundButton(local_round_button); } } if (label_idx < CurrentScreen->LabelsCount) { local_label = GetLabel(label_idx); if (order == local_label->Order) { label_idx++; order++; DrawLabel(local_label); } } if (image_idx < CurrentScreen->ImagesCount) { local_image = GetImage(image_idx); if (order == local_image->Order) { image_idx++; order++; DrawImage(local_image); } } } }