|
// CommI2C.cpp : implementation file
//
#include "stdafx.h"
#include "piccpc.h"
#include "CommI2C.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CCommI2C property page
IMPLEMENT_DYNCREATE(CCommI2C, CPropertyPage)
CCommI2C::CCommI2C() : CPropertyPage(CCommI2C::IDD)
{
//{{AFX_DATA_INIT(CCommI2C)
// NOTE: the ClassWizard will add member initialization here
//}}AFX_DATA_INIT
}
CCommI2C::~CCommI2C()
{
}
void CCommI2C::DoDataExchange(CDataExchange* pDX)
{
CPropertyPage::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CCommI2C)
// NOTE: the ClassWizard will add DDX and DDV calls here
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CCommI2C, CPropertyPage)
//{{AFX_MSG_MAP(CCommI2C)
// NOTE: the ClassWizard will add message map macros here
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CCommI2C message handlers
BOOL CCommI2C::OnKillActive()
{
PICInfo.bUseI2CSoftware = IsDlgButtonChecked( IDC_USE_I2C_SOFTWARE );
PICInfo.bUseI2CHardware = IsDlgButtonChecked( IDC_USE_I2C );
return CPropertyPage::OnKillActive();
}
BOOL CCommI2C::OnSetActive()
{
GetDlgItem(IDC_USE_I2C)->EnableWindow();
GetDlgItem(IDC_USE_I2C_SOFTWARE)->EnableWindow();
CheckDlgButton( IDC_USE_I2C, PICInfo.bUseI2CHardware );
CheckDlgButton( IDC_USE_I2C_SOFTWARE, PICInfo.bUseI2CSoftware );
PICInfo.wDelay10uS = (WORD)((PICInfo.dwOSCFrequency*0.0000025-10.0)/3.0+1.5);
if ( !PICInfo.bMI2C ) {
GetDlgItem(IDC_USE_I2C)->EnableWindow( FALSE );
}
if ( !PICInfo.bI2C ) {
GetDlgItem(IDC_USE_I2C_SOFTWARE)->EnableWindow( FALSE );
}
return CPropertyPage::OnSetActive();
}
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.