コード例 #1
0
ファイル: LogFile.cpp プロジェクト: RyanKING92/ardupilot
// This function starts a new log file in the DataFlash
void DataFlash_Block::start_new_log(void)
{
    uint16_t last_page = find_last_page();

    StartRead(last_page);
    //Serial.print("last page: ");	Serial.println(last_page);
    //Serial.print("file #: ");	Serial.println(GetFileNumber());
    //Serial.print("file page: ");	Serial.println(GetFilePage());

    if(find_last_log() == 0 || GetFileNumber() == 0xFFFF) {
        SetFileNumber(1);
        StartWrite(1);
        //Serial.println("start log from 0");
        return;
    }

    // Check for log of length 1 page and suppress
    if(GetFilePage() <= 1) {
        SetFileNumber(GetFileNumber());                 // Last log too short, reuse its number
        StartWrite(last_page);                                          // and overwrite it
        //Serial.println("start log from short");
    } else {
        if(last_page == 0xFFFF) last_page=0;
        SetFileNumber(GetFileNumber()+1);
        StartWrite(last_page + 1);
        //Serial.println("start log normal");
    }
}
コード例 #2
0
XnStatus NodeStateReadyRecord::Encode()
{
	XnStatus nRetVal = XN_STATUS_OK;
	nRetVal = StartWrite(RECORD_NODE_STATE_READY);
	XN_IS_STATUS_OK(nRetVal);
	return XN_STATUS_OK;
}
コード例 #3
0
TInt DExampleChannel::DoRequest(TInt aFunction, TRequestStatus* aStatus, TAny* a1, TAny* a2)
{
    TInt r = KErrNotSupported;
    switch (aFunction)
    {
    case RPagingExample::ERequestNotify:
        r = StartNotify(aStatus);
        break;

    case RPagingExample::ERequestAsyncGetValue:
        r = StartAsyncGetValue((TInt*)a1, aStatus);
        break;

    case RPagingExample::ERequestAsyncGetValue2:
        r = StartAsyncGetValue2((TInt*)a1, (TInt*)a2, aStatus);
        break;

    case RPagingExample::ERequestRead:
        r = StartRead(a1, (TInt)a2, aStatus);
        break;

    case RPagingExample::ERequestReadDes:
        r = StartReadDes((TDes8*)a1, aStatus);
        break;

    case RPagingExample::ERequestWrite:
        r = StartWrite(a1, (TInt)a2, aStatus);
        break;

    case RPagingExample::ERequestWriteDes:
        r = StartWriteDes((TDes8*)a1, aStatus);
        break;
    }
    return r;
}
コード例 #4
0
XnStatus DataIndexRecordHeader::Encode()
{
	XnStatus nRetVal = StartWrite(RECORD_SEEK_TABLE);
	XN_IS_STATUS_OK(nRetVal);
	//No call to FinishWrite() - this record is not done yet
	return XN_STATUS_OK;
}
コード例 #5
0
XnStatus EndRecord::Encode()
{
	XnStatus nRetVal = StartWrite(RECORD_END);
	XN_IS_STATUS_OK(nRetVal);
	nRetVal = FinishWrite();
	XN_IS_STATUS_OK(nRetVal);
	return XN_STATUS_OK;
}
コード例 #6
0
XnStatus NodeDataBeginRecord::Encode()
{
	XnStatus nRetVal = XN_STATUS_OK;
	nRetVal = StartWrite(RECORD_NODE_DATA_BEGIN);
	XN_IS_STATUS_OK(nRetVal);
	nRetVal = Write(&m_seekInfo, sizeof(m_seekInfo));
	XN_IS_STATUS_OK(nRetVal);
	return XN_STATUS_OK;
}
コード例 #7
0
ファイル: DataRecords.cpp プロジェクト: 3david/OpenNI
XnStatus NodeAdded_1_0_0_4_Record::Encode()
{
	XnStatus nRetVal = XN_STATUS_OK;
	nRetVal = StartWrite(RECORD_NODE_ADDED_1_0_0_4);
	XN_IS_STATUS_OK(nRetVal);
	nRetVal = EncodeImpl();
	XN_IS_STATUS_OK(nRetVal);
	return XN_STATUS_OK;
}
コード例 #8
0
ファイル: i2c.cpp プロジェクト: Inode1/i2c
void I2CDevice::HandleTimeout(const boost::system::error_code& ex)
{
    if (ex)
    {
        std::cout << "Handle timeout fail: " << ex.message() << std::endl;
        m_ioService.stop();
        return;   
    }
    StartWrite();
}
コード例 #9
0
/*!
    \fn swDesktop::Resize( const Size& newSize )
 */
void swDesktop::Resize( const Size& newSize )
{
    swUiControl::Resize( newSize );
    _wr = StartWrite();
    _wr->Clear();
    _wr->Fill( Geometry(), swTAttr(4, 6, 0), ACS_CKBOARD);
    // ------------------------------------------------- TESTS

    RedrawScreen();
    
}
コード例 #10
0
/*!
    \fn swLabel::_renderText( const std::String& str )
 */
bool swLabel::_renderText( const std::string& str )
{
    swWriter* sw = StartWrite();
    sw->Clear();
    sw->Position(0,0);
    /// @todo Have to render the text inside the label from the rules{ justification|wrapping|clipping } for now just write the text
    (*sw) << swWriter::text << str;
    EndWrite();
    return true;
    
}
コード例 #11
0
ファイル: i2c.cpp プロジェクト: Inode1/i2c
void I2CDevice::StartCommunication()
{
    if (!m_status) 
    {
        std::cout << "Init device fail: " << std::endl;
        return;
    }
    StartWrite();
    StartReceive();
    m_ioService.run();
}
コード例 #12
0
XnStatus NodeAddedRecord::Encode()
{
	XnStatus nRetVal = XN_STATUS_OK;
	nRetVal = StartWrite(RECORD_NODE_ADDED);
	XN_IS_STATUS_OK(nRetVal);
	nRetVal = NodeAdded_1_0_0_5_Record::EncodeImpl();
	XN_IS_STATUS_OK(nRetVal);
	nRetVal = Write(&m_nSeekTablePosition, sizeof(m_nSeekTablePosition));
	XN_IS_STATUS_OK(nRetVal);
	return XN_STATUS_OK;
}
コード例 #13
0
XnStatus NewDataRecordHeader::Encode()
{
	XnStatus nRetVal = XN_STATUS_OK;
	nRetVal = StartWrite(RECORD_NEW_DATA);
	XN_IS_STATUS_OK(nRetVal);
	nRetVal = Write(&m_nTimeStamp, sizeof(m_nTimeStamp));
	XN_IS_STATUS_OK(nRetVal);
	nRetVal = Write(&m_nFrameNumber, sizeof(m_nFrameNumber));
	XN_IS_STATUS_OK(nRetVal);
	//No call to FinishWrite() - this record is not done yet
	return XN_STATUS_OK;
}
コード例 #14
0
ファイル: boot.c プロジェクト: viloriaf/luz-live
void WriteEE(void) //TESTED: Passed
{
    for(counter=0; counter < dataPacket.len; counter++)
    {
        EEADR = (byte)dataPacket.ADR.pAdr + counter;
        //EEADRH = (BYTE)(((int)dataPacket.FIELD.ADDR.POINTER + counter) >> 8);
        EEDATA = dataPacket.data[counter];
        EECON1 = 0b00000100;    //Setup writes: EEPGD=0,WREN=1
        StartWrite();
        while(EECON1_WR);       //Wait till WR bit is clear
    }//end for
}//end WriteEE
コード例 #15
0
ファイル: writeprogmem.c プロジェクト: JamesDunne/eminor2
unsigned char WriteEE(unsigned char Addr, unsigned char data) //TESTED: Passed
{
    if (EECON1bits.WR) return false;
    EEADR = Addr;
    //EEADRH = 0;
    EEDATA = data;
    EECON1 = 0b00000100;    //Setup writes: EEPGD=0,WREN=1
    StartWrite();
    
    return (true);
//  while(EECON1_WR);       //Wait till WR bit is clear
}
コード例 #16
0
XnStatus GeneralPropRecord::Encode()
{
	XnStatus nRetVal = XN_STATUS_OK;
	nRetVal = StartWrite(m_nPropRecordType);
	XN_IS_STATUS_OK(nRetVal);
	nRetVal = WriteString(m_strPropName);
	XN_IS_STATUS_OK(nRetVal);
	nRetVal = Write(&m_nPropDataSize, sizeof(m_nPropDataSize));
	XN_IS_STATUS_OK(nRetVal);
	nRetVal = Write(m_pPropData, m_nPropDataSize);
	XN_IS_STATUS_OK(nRetVal);
	return XN_STATUS_OK;
}
コード例 #17
0
ファイル: boot.c プロジェクト: viloriaf/luz-live
//WriteConfig is different from WriteProgMem b/c it can write a byte
void WriteConfig(void) //TESTED: Passed
{
    EECON1 = 0b11000100;        //Setup writes: EEPGD=1,CFGS=1,WREN=1
    for (counter = 0; counter < dataPacket.len; counter++)
    {
        *((dataPacket.ADR.pAdr)+counter) = \
        dataPacket.data[counter];
        StartWrite();
    }//end for
    
    TBLPTRU = 0x00;         // forces upper byte back to 0x00
                            // optional fix is to set large code model
}//end WriteConfig
コード例 #18
0
ファイル: LogFile.cpp プロジェクト: 54dashayu/ardupilot
// This function starts a new log file in the DataFlash
uint16_t DataFlash_Block::start_new_log(void)
{
    uint16_t last_page = find_last_page();

    StartRead(last_page);
    //Serial.print("last page: ");	Serial.println(last_page);
    //Serial.print("file #: ");	Serial.println(GetFileNumber());
    //Serial.print("file page: ");	Serial.println(GetFilePage());

    if(find_last_log() == 0 || GetFileNumber() == 0xFFFF) {
        SetFileNumber(1);
        StartWrite(1);
        //Serial.println("start log from 0");
        log_write_started = true;
        return 1;
    }

    uint16_t new_log_num;

    // Check for log of length 1 page and suppress
    if(GetFilePage() <= 1) {
        new_log_num = GetFileNumber();
        // Last log too short, reuse its number
        // and overwrite it
        SetFileNumber(new_log_num);
        StartWrite(last_page);
    } else {
        new_log_num = GetFileNumber()+1;
        if (last_page == 0xFFFF) {
            last_page=0;
        }
        SetFileNumber(new_log_num);
        StartWrite(last_page + 1);
    }
    log_write_started = true;
    return new_log_num;
}
コード例 #19
0
ファイル: writeprogmem.c プロジェクト: JamesDunne/eminor2
//uses TwoBytes ProgMemAddr;
void EraseProgMem(void) //TESTED: Passed
{
    //The most significant 16 bits of the address pointer points to the block
    //being erased. Bits5:0 are ignored. (In hardware).

    //LEN = # of 64-byte block to erase
    EECON1 = 0b10010100;     //Setup writes: EEPGD=1,FREE=1,WREN=1

    *(rom far char *)ProgMemAddr.s_form;  //Load TBLPTR
    StartWrite();

    TBLPTRU = 0;            // forces upper byte back to 0x00
                            // optional fix is to set large code model
                            // (for USER ID 0x20 0x00 0x00)
}
コード例 #20
0
ファイル: DataRecords.cpp プロジェクト: 3david/OpenNI
XnStatus NodeAddedRecord::Encode()
{
	XnStatus nRetVal = XN_STATUS_OK;
	nRetVal = StartWrite(RECORD_NODE_ADDED);
	XN_IS_STATUS_OK(nRetVal);
	nRetVal = NodeAdded_1_0_0_4_Record::EncodeImpl();
	XN_IS_STATUS_OK(nRetVal);
	nRetVal = Write(&m_nNumberOfFrames, sizeof(m_nNumberOfFrames));
	XN_IS_STATUS_OK(nRetVal);
	nRetVal = Write(&m_nMinTimestamp, sizeof(m_nMinTimestamp));
	XN_IS_STATUS_OK(nRetVal);
	nRetVal = Write(&m_nMaxTimestamp, sizeof(m_nMaxTimestamp));
	XN_IS_STATUS_OK(nRetVal);
	return XN_STATUS_OK;
}
コード例 #21
0
ファイル: boot.c プロジェクト: viloriaf/luz-live
void EraseProgMem(void) //TESTED: Passed
{
    //The most significant 16 bits of the address pointer points to the block
    //being erased. Bits5:0 are ignored. (In hardware).

    //LEN = # of 64-byte block to erase
    EECON1 = 0b10010100;     //Setup writes: EEPGD=1,FREE=1,WREN=1
    for(counter=0; counter < dataPacket.len; counter++)
    {
        *(dataPacket.ADR.pAdr+(((int)counter) << 6));  //Load TBLPTR
        StartWrite();
    }//end for
    TBLPTRU = 0;            // forces upper byte back to 0x00
                            // optional fix is to set large code model
                            // (for USER ID 0x20 0x00 0x00)
}//end EraseProgMem
コード例 #22
0
ファイル: DataFlash_Block.cpp プロジェクト: lasserre/JAGUAR
void DataFlash_Block::EraseAll()
{
    for (uint16_t j = 1; j <= (df_NumPages+1)/8; j++) {
        BlockErase(j);
        if (j%6 == 0) {
            hal.scheduler->delay(6);
        }
    }
    // write the logging format in the last page
    hal.scheduler->delay(100);
    StartWrite(df_NumPages+1);
    uint32_t version = DF_LOGGING_FORMAT;
    log_write_started = true;
    WriteBlock(&version, sizeof(version));
    log_write_started = false;
    FinishWrite();
    hal.scheduler->delay(100);
}
コード例 #23
0
ファイル: writeprogmem.c プロジェクト: JamesDunne/eminor2
//uses TwoBytes ProgMemAddr;
//also uses ProgmemBuffer[64]
//NOTE: index should be either 0 or 32.  (0 for the first 32 bytes, 32 for the second)
void WriteProgMem(unsigned char index) //TESTED: Passed
{
    unsigned char counter;

    /*
     * The write holding register for the 18F4550 family is
     * actually 32-byte. The code below only tries to write
     * 16-byte because the GUI program only sends out 16-byte
     * at a time.
     * This limitation will be fixed in the future version.
     */
    ProgMemAddr.b_form.low &= 0b11100000;  //Force 32-byte boundary
    EECON1 = 0b10000100;        //Setup writes: EEPGD=1,WREN=1

    //LEN = # of byte to write

    for (counter = index; counter < index+32; counter++) {
        *(rom far char *)(ProgMemAddr.s_form+counter) = ProgmemBuffer[counter];
        if ((counter & 0b00011111) == 0b00011111) {
            StartWrite();
        }
    }
}
コード例 #24
0
ファイル: boot.c プロジェクト: viloriaf/luz-live
void WriteProgMem(void) //TESTED: Passed
{
    /*
     * The write holding register for the 18F4550 family is
     * actually 32-byte. The code below only tries to write
     * 16-byte because the GUI program only sends out 16-byte
     * at a time.
     * This limitation will be fixed in the future version.
     */
    dataPacket.ADR.low &= 0b11110000;  //Force 16-byte boundary
    EECON1 = 0b10000100;        //Setup writes: EEPGD=1,WREN=1

    //LEN = # of byte to write

    for (counter = 0; counter < (dataPacket.len); counter++)
    {
        *((dataPacket.ADR.pAdr)+counter) = \
        dataPacket.data[counter];
        if ((counter & 0b00001111) == 0b00001111)
        {
            StartWrite();
        }//end if
    }//end for
}//end WriteProgMem
コード例 #25
0
ファイル: OSD0201QILK.cpp プロジェクト: AD7ZJ/arm7lib
/**
 * Initialize the display controller.
 */
void OSD0201QILK::Enable()
{
    ChipSelect(true);

    Reset(false);
    SystemControl::Sleep(500);

    Reset(true);
    SystemControl::Sleep(10);

    // Select the 8-bit interface mode.
    DisplayData(false);

    ChipSelect (false);
    Write (0x24);
    ChipSelect (true);

    // Set RGB Interface control.
    WriteRegister (0x02, 0x0000);

    // Set entry mode for 262K colors, auto increment address pointer.
    WriteRegister (0x03, 0x4130);

    // Standby off.
    WriteRegister (0x10, 0x0000);

    // Required delay to allow display converts to come up.
    SystemControl::Sleep(100);

    WriteRegister (0x70, 0x2900);
    WriteRegister (0x71, 0x2A00);
    WriteRegister (0x72, 0x3700);
    WriteRegister (0x73, 0x1912);
    WriteRegister (0x74, 0x1B0D);
    WriteRegister (0x75, 0x2014);
    WriteRegister (0x76, 0x1812);
    WriteRegister (0x77, 0x2118);
    WriteRegister (0x78, 0x2111);


    // Set the window size.
    Window (0, 0, this->sizeX, this->sizeY);

    // Clear the screen.
    StartWrite();

    uint32_t pixelCount = this->sizeX * this->sizeY;

    while (pixelCount-- != 0)
        WritePixel(GUI::ColorBlack);

    StopWrite();

    // Turn on the ARVDD/ARVSS supplies.
    PowerConverter(true);

    // Allow the converters time to stabilize.
    SystemControl::Sleep(32);

    // Display on.
    WriteRegister (0x05, 0x0001);
}
コード例 #26
0
XnStatus NodeRemovedRecord::Encode()
{
	return StartWrite(RECORD_NODE_REMOVED);
}
コード例 #27
0
ファイル: ATIO.CPP プロジェクト: cdaffara/symbiandump-os1
void CATIO::Start(CATBase* aCompletionClass)
	{
	CommReadReady();
	StartWrite(aCompletionClass);
	}