Exemplo n.º 1
0
nbr_event_panel::nbr_event_panel(wxWindow* parent, wxWindowID id,const wxString& name,const wxPoint& pos, const wxSize& size, long style)
    :wxPanel(parent,id,pos,size,style|wxBORDER_SIMPLE )
{	
	int idx;
	logmod::event_type *evt_type;

    m_main_sizer=new wxBoxSizer(wxHORIZONTAL);

	m_num_rows=logmod::event_type::GetCount();
	m_event_grid=new wxGrid(this,-1);
	m_event_grid->CreateGrid(m_num_rows,2);
	m_main_sizer->Add(m_event_grid,1,wxEXPAND);
	m_main_sizer->FitInside(m_event_grid);

	m_event_grid->SetColLabelValue(0,"Events");
	m_event_grid->SetColLabelValue(1,"Count");

	evt_type=logmod::event_type::GetFirst();
	
	while (evt_type!=NULL)
	{
		idx=evt_type->GetId();
		m_event_grid->SetCellValue(idx,0,evt_type->GetName());
		
		evt_type=evt_type->GetNext();
	}
	ResetCounts();
	m_event_grid->AutoSizeColumns();
	m_event_grid->SetRowLabelSize(0);
    /*m_ts=new wxStaticText(this,-1,"1234567890123456 ns");
    m_main_sizer->Add(m_ts,0,wxEXPAND|wxALL,5);
    m_type=new wxStaticText(this,-1,"UNK ");
    m_main_sizer->Add(m_type,0,wxEXPAND|wxALL,5);
    m_dir=new wxStaticText(this,-1,"UNK");
    m_main_sizer->Add(m_dir,0,wxEXPAND|wxALL,5); */

    SetSizer(m_main_sizer);
    m_main_sizer->SetSizeHints(this);
	//SetBackgroundColour(*wxWHITE);
}
Exemplo n.º 2
0
AnalogEncoder::AnalogEncoder(FEHIO::FEHIOPin pin_) : AnalogInputPin(pin_)
{
    if(pinList == NULL) {
        // Initialize linked list of encoders within the pPinInfo Object
        this->pNext = NULL;
        this->pPrev = NULL;

        // Add encoder linked list to pinInfo
        pPinInfo = new PinInfo;
        pPinInfo->encoderList = this;
        pPinInfo->numEncoders = 1;
        pPinInfo->pin = pin_;
        pPinInfo->pNext = NULL;
        pPinInfo->pPrev = NULL;
        pPinInfo->state = LOW_STATE;

        // Since the pinList is empty, set the pinInfo to the head
        pinList = pPinInfo;
    }
    else // There is already a list in place (see if this pin is already in it)
    {
        PinInfo * pCurPin = pinList;
        // Loop through list trying to find our pin
        while(pCurPin->pin!= pin_ && pCurPin->pNext!=NULL) {
            pCurPin = pCurPin->pNext;
        }

        // If the pin is in the list
        if(pCurPin->pin == pin_) {
            pPinInfo = pCurPin;
            AnalogEncoder * pCurEnc = pPinInfo->encoderList;
            // Loop to end of encoder list
            while(pCurEnc->pNext != NULL) {
                pCurEnc = pCurEnc->pNext;
            }
            // Link the encoder info the end of the list
            pCurEnc->pNext = this;
            this->pPrev = pCurEnc;
            this->pNext = NULL;
            pPinInfo->numEncoders++;
        }
        else { // Need to add a new pin to the list
            this->pNext = NULL;
            this->pPrev = NULL;

            // Add encoder linked list to pinInfo
            pPinInfo = new PinInfo;
            pPinInfo->encoderList = this;
            pPinInfo->numEncoders = 1;
            pPinInfo->pin = pin_;
            pPinInfo->pNext = NULL;
            pPinInfo->state = LOW_STATE;

            // Link the end of the list to the new pin
            pPinInfo->pPrev = pCurPin;
            pCurPin->pNext = pPinInfo;
        }
    }

    ResetCounts();
    lowThreshold = 70*256;
    highThreshold = 210*256;
}