📄 scconfigform.cpp
字号:
//---------------------------------------------------------------------------
#include <vcl.h>
#pragma hdrstop
#include "SCConfigForm.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma resource "*.dfm"
TfrmSCConfig *frmSCConfig;
//---------------------------------------------------------------------------
__fastcall TfrmSCConfig::TfrmSCConfig(TComponent* Owner)
: TForm(Owner)
{
}
//---------------------------------------------------------------------------
void __fastcall TfrmSCConfig::FormCreate(TObject *Sender)
{
// {Make control array for further use}
//{Port B0}
pchkPB0[0] = chkEnablePB00;
pchkPB0[1] = chkEnablePB01;
pchkPB0[2] = chkEnablePB02;
pchkPB0[3] = chkEnablePB03;
pchkPB0[4] = chkEnablePB04;
pchkPB0[5] = chkEnablePB05;
pchkPB0[6] = chkEnablePB06;
pchkPB0[7] = chkEnablePB07;
// {Port B4}
pchkPB4[0] = chkEnablePB40;
pchkPB4[1] = chkEnablePB41;
pchkPB4[2] = chkEnablePB42;
pchkPB4[3] = chkEnablePB43;
pchkPB4[4] = chkEnablePB44;
pchkPB4[5] = chkEnablePB45;
pchkPB4[6] = chkEnablePB46;
pchkPB4[7] = chkEnablePB47;
}
//---------------------------------------------------------------------------
void __fastcall TfrmSCConfig::cmdOkClick(TObject *Sender)
{
usPB0Value = 0;
for(int i = 0; i<8; i++)
{
//Value register config
if (pchkPB0[i]->Checked)
usPB0Value |= 1<<i;
}
//{ PA4 configure of user interface}
usPB4Value = 0;
for(int i = 0; i<8; i++)
{
//Value register config
if (pchkPB4[i]->Checked)
usPB4Value |= 1<<i;
}
ModalResult = mrOk;
}
//---------------------------------------------------------------------------
void __fastcall TfrmSCConfig::cmdCancelClick(TObject *Sender)
{
ModalResult = mrCancel;
}
//---------------------------------------------------------------------------
void __fastcall TfrmSCConfig::FormActivate(TObject *Sender)
{
for(int i = 0; i<8; i++)
{
// {Mask register config}
if (usPB0Value & 1<<i)
pchkPB0[i]->Checked = true;
else
pchkPB0[i]->Checked = false;
}
for(int i = 0; i<8; i++)
{
// {Mask register config}
if (usPB4Value & 1<<i)
pchkPB4[i]->Checked = true;
else
pchkPB4[i]->Checked = false;
}
}
//---------------------------------------------------------------------------
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -