Example #1
0
	uint8 *page = pvPortMalloc(160 * 4);
    
    // Descompress each stripe and write it to the display
	Display_SetCursorPosition(0, 0);
	for(int i = 0; i < 8; i++) {
		lzfx_decompress(
			splashscreen_data + splashscreen_indexes[i],
			splashscreen_indexes[i + 1] - splashscreen_indexes[i],
			page, &(unsigned int){160 * 4});
		Display_WritePixels(page, 160 * 4);
		CyDelay(1);
	}
    
    // Write the version to the lower left
    char buf[9];
    sprintf(buf, "v%hd.%hd", get_major_version(), get_minor_version());
    Display_DrawText(6, 0, buf, 0);

	// Reset the heap to free the memory we used
	vPortInitialiseBlocks();
}
#endif

static output_mode current_output_mode = OUTPUT_MODE_FEEDBACK;

void set_output_mode(output_mode mode) {
	current_output_mode = mode;
	switch(mode) {
	case OUTPUT_MODE_OFF:
        // Pull the gate low
		Opamp_Stop();
Example #2
0
CGenViewerCtrl::CGenViewerCtrl()
{
	InitializeIIDs(&IID_DGenViewer, &IID_DGenViewerEvents);
	// TODO: Initialize your control's instance data here.

	SetInitialSize(200, 200);

#ifdef HOOPS
	m_pHDB=new HDB();
	m_pHDB->Init();
	m_pHDB->SetIsolatedDrivers(false);
#endif
	TCHAR cur_dir[MVO_BUFFER_SIZE];
	GetCurrentDirectory(MVO_BUFFER_SIZE, cur_dir);
	memset(m_AppDirectory,0,MVO_BUFFER_SIZE);	
	//UtC(cur_dir, m_AppDirectory);

#if defined(INTEROP) || defined(ACIS)
#ifdef ACIS
	//Base configuration must happen before unlocking ACIS.
	//   If not using initialize_base, then unlock must 
	//   happen after the initialize modeller 
	base_configuration base_config;
	logical ok = initialize_base( &base_config);
	unlock_spatial_products_4158();
#endif // ACIS


#ifdef INTEROP
	char *path;
	path = getenv("PATH");
	if (path == NULL) {
		wchar_t * error_msg = L"Unable to add CATIA V5 DLLs to the path.  CATIA V5 translation will not work.";
		AfxMessageBox(LPCTSTR(error_msg), MB_ICONSTOP);
	}
	else {
		_putenv(H_FORMAT_TEXT("PATH=%s\\lib3dx\\intel_a\\code\\bin;%s", m_AppDirectory, path));
	}
#endif // INTEROP
#endif // defined(INTEROP) || defined(ACIS)


#ifdef ACIS
	outcome o; 
	o = api_start_modeller(0);
	check_outcome(o);

	//Issue #10605: Default Entity Manager Factory no longer registered by default		
	if (get_major_version() >= 20) 
	{
		entity_mgr_factory* my_manager = new default_entity_mgr_factory();
		{
			outcome o = asmi_set_entity_mgr_factory(my_manager);
			check_outcome(o);
		}
	}

	o = api_initialize_hoops_acis_bridge();
	check_outcome(o);
	ha_rendering_options &roptions=HA_Get_Rendering_Options();
	{
		roptions.SetMergeFacesMode(TRUE);
		roptions.SetGeomPattern ("?Include Library/ACIS model geometry");
		roptions.SetPattern("entity");
	}	
#endif // ACIS

	AfxInitRichEdit();

	AddDocTemplate(new CActiveXDocTemplate(
		RUNTIME_CLASS(CGenViewerDoc),   //改为你的文档类
		RUNTIME_CLASS(CMainFrame),  //改为你的框架类
		RUNTIME_CLASS(CGenViewerView))); //改为你的视图类

}
Example #3
0
BOOL CGenViewerApp::InitInstance()
{
    AfxEnableControlContainer();

    // Standard initialization
    // If you are not using these features and wish to reduce the size
    //  of your final executable, you should remove from the following
    //  the specific initialization routines you do not need.

#ifdef _AFXDLL
//	Enable3dControls();			// Call this when using MFC in a shared DLL
#else
    Enable3dControlsStatic();	// Call this when linking to MFC statically
#endif

    // Change the registry key under which our settings are stored.
    // TODO: You should modify this string to be something appropriate
    // such as the name of your company or organization.
    SetRegistryKey(_T("Local AppWizard-Generated Applications"));

    LoadStdProfileSettings();  // Load standard INI file options (including MRU)

    // Register the application's document templates.  Document templates
    //  serve as the connection between documents, frame windows and views.
#ifdef HOOPS
    m_pHDB=new HDB();
    m_pHDB->Init();
    m_pHDB->SetIsolatedDrivers(false);

    TCHAR cur_dir[MVO_BUFFER_SIZE];
    GetCurrentDirectory(MVO_BUFFER_SIZE, cur_dir);
    memset(m_AppDirectory,0,MVO_BUFFER_SIZE);
    //UtC(cur_dir, m_AppDirectory);
#endif

#ifdef VL
//	vl::showWin32Console();

    /* init Visualization Library */
    vl::VisualizationLibrary::init();
    registerLoadWriter(new LoadWriter3DXML);
#endif

#if defined(INTEROP) || defined(ACIS)
#ifdef ACIS
    //Base configuration must happen before unlocking ACIS.
    //   If not using initialize_base, then unlock must
    //   happen after the initialize modeller
    base_configuration base_config;
    logical ok = initialize_base( &base_config);
    unlock_spatial_products_4158();
#endif // ACIS

#ifdef INTEROP
    char *path;
    path = getenv("PATH");
    if (path == NULL) {
        wchar_t * error_msg = L"Unable to add CATIA V5 DLLs to the path.  CATIA V5 translation will not work.";
        AfxMessageBox(LPCTSTR(error_msg), MB_ICONSTOP);
    }
    else {
        _putenv(H_FORMAT_TEXT("PATH=%s\\lib3dx\\intel_a\\code\\bin;%s", m_AppDirectory, path));
    }
#endif // INTEROP
#endif // defined(INTEROP) || defined(ACIS)


#ifdef ACIS
    outcome o;
    o = api_start_modeller(0);
    check_outcome(o);

    //Issue #10605: Default Entity Manager Factory no longer registered by default
    if (get_major_version() >= 20)
    {
        entity_mgr_factory* my_manager = new default_entity_mgr_factory();
        {
            outcome o = asmi_set_entity_mgr_factory(my_manager);
            check_outcome(o);
        }
    }

    o = api_initialize_hoops_acis_bridge();
    check_outcome(o);
    ha_rendering_options &roptions=HA_Get_Rendering_Options();
    {
        roptions.SetMergeFacesMode(TRUE);
        roptions.SetGeomPattern ("?Include Library/ACIS model geometry");
        roptions.SetPattern("entity");
    }
#endif // ACIS

    CSingleDocTemplate* pDocTemplate;
    pDocTemplate = new CSingleDocTemplate(
        IDR_MAINFRAME,
        RUNTIME_CLASS(CGenViewerDoc),
        RUNTIME_CLASS(CMainFrame),       // main SDI frame window
        RUNTIME_CLASS(CGenViewerView));
    AddDocTemplate(pDocTemplate);

    // Parse command line for standard shell commands, DDE, file open
    CCommandLineInfo cmdInfo;
    ParseCommandLine(cmdInfo);


    // Don't display a new MDI child window during startup
// 	if (cmdInfo.m_nShellCommand == CCommandLineInfo::FileNew)
// 		cmdInfo.m_nShellCommand = CCommandLineInfo::FileNothing;


    // Dispatch commands specified on the command line
    if (!ProcessShellCommand(cmdInfo))
        return FALSE;

    AfxInitRichEdit();

    // The one and only window has been initialized, so show and update it.
    m_pMainWnd->ShowWindow(SW_SHOW);
    m_pMainWnd->UpdateWindow();

    return TRUE;
}