OpenCores
URL https://opencores.org/ocsvn/z80control/z80control/trunk

Subversion Repositories z80control

[/] [z80control/] [trunk/] [CII_Starter_USB_API_v1/] [SW/] [PS2_Thread.cpp] - Blame information for rev 12

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 12 tylerapohl
//---------------------------------------------------------------------------
2
 
3
#include <vcl.h>
4
#pragma hdrstop
5
 
6
#include "PS2_Thread.h"
7
#include "Main.h"
8
#pragma package(smart_init)
9
//---------------------------------------------------------------------------
10
 
11
//   Important: Methods and properties of objects in VCL can only be
12
//   used in a method called using Synchronize, for example:
13
//
14
//      Synchronize(UpdateCaption);
15
//
16
//   where UpdateCaption could look like:
17
//
18
//      void __fastcall TPS2_REC::UpdateCaption()
19
//      {
20
//        Form1->Caption = "Updated in a thread";
21
//      }
22
//---------------------------------------------------------------------------
23
 
24
__fastcall TPS2_REC::TPS2_REC(bool CreateSuspended)
25
   : TThread(CreateSuspended)
26
{
27
}
28
//---------------------------------------------------------------------------
29
void __fastcall TPS2_REC::Execute()
30
{
31
   //---- Place thread code here ----
32
   while(!Terminated)
33
   {
34
      Synchronize(Show_ASCII);
35
   }
36
}
37
//---------------------------------------------------------------------------
38
void __fastcall TPS2_REC::Show_ASCII()
39
{
40
   // Read PS2 Ascii To Text Windows
41
   Form1->USB1.Write_Data(&Get_ASCII,0,1,true);
42
   Sleep(30);
43
   Form1->USB1.Read_Data(&Get_ASCII,1);
44
   // Check Get Data is Valid
45
   if(Get_ASCII!=0x00)
46
   PS2_times++;
47
   // Check Get Data is Byte 1
48
   if(PS2_times==1)
49
   Form1->Memo1->Text=Form1->Memo1->Text+(char)Get_ASCII;
50
   else if(PS2_times==2)
51
   PS2_times=0;
52
   Application->ProcessMessages();
53
}
54
//---------------------------------------------------------------------------
55
 

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.