示例#1
0
int SPI::write(int value) {
    lock();
    _acquire();
    int ret = spi_master_write(&_spi, value);
    unlock();
    return ret;
}
void indri::index::DiskKeyfileVocabularyIterator::startIteration() {
  _acquire();

  _bulkIterator->startIteration();
  _readData();
  _justStartedIteration=true;
}
示例#3
0
int SPI::write(const char *tx_buffer, int tx_length, char *rx_buffer, int rx_length) {
    lock();
    _acquire();
    int ret = spi_master_block_write(&_spi, tx_buffer, tx_length, rx_buffer, rx_length, _write_fill);
    unlock();
    return ret;
}
示例#4
0
文件: latch.cpp 项目: PickXu/zero-xum
w_rc_t
latch_t::latch_acquire(latch_mode_t mode, sthread_t::timeout_in_ms timeout)
{
    w_assert1(mode != LATCH_NL);
    holder_search me(this);
    return _acquire(mode, timeout, me.value());
}
示例#5
0
void SPI::start_transfer(const void *tx_buffer, int tx_length, void *rx_buffer, int rx_length, unsigned char bit_width, const event_callback_t& callback, int event)
{
    lock_deep_sleep();
    _acquire();
    _callback = callback;
    _irq.callback(&SPI::irq_handler_asynch);
    spi_master_transfer(&_spi, tx_buffer, tx_length, rx_buffer, rx_length, bit_width, _irq.entry(), event , _usage);
}
示例#6
0
文件: chatLog.cpp 项目: kaina/sandbox
bool CChatLog::_checkdate(SYSTEMTIME* lpst)
{
	SYSTEMTIME t = _gettime(lpst);

	if ((t.wYear != m_st.wYear) || (t.wMonth != m_st.wMonth) || (t.wDay != m_st.wDay))
	{
		release();
		_acquire(&t);
	}

	return alive();
}
示例#7
0
void SPI::frequency(int hz) {
    lock();
    _hz = hz;
    // If changing format while you are the owner then just
    // update frequency, but if owner is changed then even frequency should be
    // updated which is done by acquire.
    if (_owner == this) {
        spi_frequency(&_spi, _hz);
    } else {
        _acquire();
    }
    unlock();
}
示例#8
0
void SPI::format(int bits, int mode) {
    lock();
    _bits = bits;
    _mode = mode;
    // If changing format while you are the owner then just
    // update format, but if owner is changed then even frequency should be
    // updated which is done by acquire.
    if (_owner == this) {
        spi_format(&_spi, _bits, _mode, 0);
    } else {
        _acquire();
    }
    unlock();
}
示例#9
0
SPI::SPI(PinName mosi, PinName miso, PinName sclk, PinName ssel) :
        _spi(),
#if DEVICE_SPI_ASYNCH
        _irq(this),
        _usage(DMA_USAGE_NEVER),
        _deep_sleep_locked(false),
#endif
        _bits(8),
        _mode(0),
        _hz(1000000),
        _write_fill(SPI_FILL_CHAR) {
    // No lock needed in the constructor

    spi_init(&_spi, mosi, miso, sclk, ssel);
    _acquire();
}