本文整理汇总了C++中WAIT_FOR_SLAVE_SELECT函数的典型用法代码示例。如果您正苦于以下问题:C++ WAIT_FOR_SLAVE_SELECT函数的具体用法?C++ WAIT_FOR_SLAVE_SELECT怎么用?C++ WAIT_FOR_SLAVE_SELECT使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了WAIT_FOR_SLAVE_SELECT函数的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: WAIT_FOR_SLAVE_SELECT
bool ServerDrv::sendData(uint8_t sock, const uint8_t *data, uint16_t len)
{
WAIT_FOR_SLAVE_SELECT();
// Send Command
SpiDrv::sendCmd(SEND_DATA_TCP_CMD, PARAM_NUMS_2);
SpiDrv::sendBuffer(&sock, sizeof(sock));
SpiDrv::sendBuffer((uint8_t *)data, len, LAST_PARAM);
//Wait the reply elaboration
SpiDrv::waitForSlaveReady();
// Wait for reply
uint8_t _data = 0;
uint8_t _dataLen = 0;
if (!SpiDrv::waitResponseData8(SEND_DATA_TCP_CMD, &_data, &_dataLen))
{
WARN("error waitResponse");
}
SpiDrv::spiSlaveDeselect();
if (_dataLen!=0)
{
return (_data == 1);
}
return false;
}
示例2: WAIT_FOR_SLAVE_SELECT
uint8_t ServerDrv::availData(uint8_t sock)
{
WAIT_FOR_SLAVE_SELECT();
// Send Command
SpiDrv::sendCmd(AVAIL_DATA_TCP_CMD, PARAM_NUMS_1);
SpiDrv::sendParam(&sock, sizeof(sock), LAST_PARAM);
//Wait the reply elaboration
SpiDrv::waitForSlaveReady();
// Wait for reply
uint8_t _data = 0;
uint8_t _dataLen = 0;
if (!SpiDrv::waitResponseCmd(AVAIL_DATA_TCP_CMD, PARAM_NUMS_1, &_data, &_dataLen))
{
WARN("error waitResponse");
}
SpiDrv::spiSlaveDeselect();
if (_dataLen!=0)
{
return (_data == 1);
}
return false;
}
示例3: WAIT_FOR_SLAVE_SELECT
uint8_t ServerDrv::checkDataSent(uint8_t sock)
{
const uint16_t TIMEOUT_DATA_SENT = 25;
uint16_t timeout = 0;
uint8_t _data = 0;
uint8_t _dataLen = 0;
do {
WAIT_FOR_SLAVE_SELECT();
// Send Command
SpiDrv::sendCmd(DATA_SENT_TCP_CMD, PARAM_NUMS_1);
SpiDrv::sendParam(&sock, sizeof(sock), LAST_PARAM);
// Wait the reply elaboration
SpiDrv::waitForSlaveReady();
// Wait for reply
if ( !SpiDrv::waitResponseCmd(DATA_SENT_TCP_CMD, PARAM_NUMS_1, &_data, &_dataLen) ) {
WARN("error waitResponse isDataSent");
}
SpiDrv::spiSlaveDeselect();
if ( _data ) {
timeout = 0;
} else {
++timeout;
delay(100);
}
} while ( (_data == 0) && (timeout < TIMEOUT_DATA_SENT) );
return (timeout == TIMEOUT_DATA_SENT) ? 0 : 1;
}
示例4: WAIT_FOR_SLAVE_SELECT
int32_t WiFiDrv::getRSSINetoworks(uint8_t networkItem)
{
if ( networkItem >= WL_NETWORKS_LIST_MAXNUM ) {
return NULL;
}
int32_t networkRssi = 0;
WAIT_FOR_SLAVE_SELECT();
// Send Command
SpiDrv::sendCmd(GET_IDX_RSSI_CMD, PARAM_NUMS_1);
SpiDrv::sendParam(&networkItem, 1, LAST_PARAM);
// Wait the reply elaboration
SpiDrv::waitForSlaveReady();
// Wait for reply
uint8_t dataLen = 0;
SpiDrv::waitResponseCmd(GET_IDX_RSSI_CMD, PARAM_NUMS_1, (uint8_t *) &networkRssi, &dataLen);
SpiDrv::spiSlaveDeselect();
return networkRssi;
}
示例5: WAIT_FOR_SLAVE_SELECT
uint8_t* WiFiDrv::getBSSIDNetworks(uint8_t networkItem)
{
WAIT_FOR_SLAVE_SELECT();
// Send Command
SpiDrv::sendCmd(GET_IDX_BSSID_CMD, PARAM_NUMS_1);
SpiDrv::sendParam(&networkItem, 1, LAST_PARAM);
//Wait the reply elaboration
SpiDrv::waitForSlaveReady();
// Wait for reply
uint8_t _dataLen = 0;
SpiDrv::waitResponseCmd(GET_IDX_BSSID_CMD, PARAM_NUMS_1, _bssid, &_dataLen);
SpiDrv::spiSlaveDeselect();
return _bssid;
}