本文整理汇总了C++中spiStop函数的典型用法代码示例。如果您正苦于以下问题:C++ spiStop函数的具体用法?C++ spiStop怎么用?C++ spiStop使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了spiStop函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: SD_TRACE
//------------------------------------------------------------------------------
bool SdSpiCard::writeBlock(uint32_t blockNumber, const uint8_t* src) {
SD_TRACE("WB", blockNumber);
// use address if not SDHC card
if (type() != SD_CARD_TYPE_SDHC) {
blockNumber <<= 9;
}
if (cardCommand(CMD24, blockNumber)) {
error(SD_CARD_ERROR_CMD24);
goto fail;
}
if (!writeData(DATA_START_BLOCK, src)) {
goto fail;
}
#if CHECK_FLASH_PROGRAMMING
// wait for flash programming to complete
if (!waitNotBusy(SD_WRITE_TIMEOUT)) {
error(SD_CARD_ERROR_WRITE_TIMEOUT);
goto fail;
}
// response is r2 so get and check two bytes for nonzero
if (cardCommand(CMD13, 0) || spiReceive()) {
error(SD_CARD_ERROR_CMD13);
goto fail;
}
#endif // CHECK_PROGRAMMING
spiStop();
return true;
fail:
spiStop();
return false;
}
开发者ID:ErikWegner,项目名称:arduino_sketches,代码行数:36,代码来源:SdSpiCard.cpp
示例2: error
//------------------------------------------------------------------------------
bool SdSpiCard::readStop() {
if (cardCommand(CMD12, 0)) {
error(SD_CARD_ERROR_CMD12);
goto fail;
}
spiStop();
return true;
fail:
spiStop();
return false;
}
开发者ID:ErikWegner,项目名称:arduino_sketches,代码行数:13,代码来源:SdSpiCard.cpp
示例3: spiSend
//------------------------------------------------------------------------------
bool SdSpiCard::writeStop() {
if (!waitNotBusy(SD_WRITE_TIMEOUT)) {
goto fail;
}
spiSend(STOP_TRAN_TOKEN);
spiStop();
return true;
fail:
error(SD_CARD_ERROR_STOP_TRAN);
spiStop();
return false;
}
开发者ID:ErikWegner,项目名称:arduino_sketches,代码行数:14,代码来源:SdSpiCard.cpp
示例4: mmcStartSequentialWrite
/**
* @brief Starts a sequential write.
*
* @param[in] mmcp pointer to the @p MMCDriver object
* @param[in] startblk first block to write
*
* @return The operation status.
* @retval HAL_SUCCESS the operation succeeded.
* @retval HAL_FAILED the operation failed.
*
* @api
*/
bool mmcStartSequentialWrite(MMCDriver *mmcp, uint32_t startblk) {
osalDbgCheck(mmcp != NULL);
osalDbgAssert(mmcp->state == BLK_READY, "invalid state");
/* Write operation in progress.*/
mmcp->state = BLK_WRITING;
spiStart(mmcp->config->spip, mmcp->config->hscfg);
spiSelect(mmcp->config->spip);
if (mmcp->block_addresses) {
send_hdr(mmcp, MMCSD_CMD_WRITE_MULTIPLE_BLOCK, startblk);
}
else {
send_hdr(mmcp, MMCSD_CMD_WRITE_MULTIPLE_BLOCK,
startblk * MMCSD_BLOCK_SIZE);
}
if (recvr1(mmcp) != 0x00U) {
spiStop(mmcp->config->spip);
mmcp->state = BLK_READY;
return HAL_FAILED;
}
return HAL_SUCCESS;
}
开发者ID:mabl,项目名称:ChibiOS,代码行数:37,代码来源:hal_mmc_spi.c
示例5: mmcSequentialWrite
/**
* @brief Writes a block within a sequential write operation.
*
* @param[in] mmcp pointer to the @p MMCDriver object
* @param[out] buffer pointer to the write buffer
*
* @return The operation status.
* @retval HAL_SUCCESS the operation succeeded.
* @retval HAL_FAILED the operation failed.
*
* @api
*/
bool mmcSequentialWrite(MMCDriver *mmcp, const uint8_t *buffer) {
static const uint8_t start[] = {0xFF, 0xFC};
uint8_t b[1];
osalDbgCheck((mmcp != NULL) && (buffer != NULL));
if (mmcp->state != BLK_WRITING) {
return HAL_FAILED;
}
spiSend(mmcp->config->spip, sizeof(start), start); /* Data prologue. */
spiSend(mmcp->config->spip, MMCSD_BLOCK_SIZE, buffer);/* Data. */
spiIgnore(mmcp->config->spip, 2); /* CRC ignored. */
spiReceive(mmcp->config->spip, 1, b);
if ((b[0] & 0x1FU) == 0x05U) {
wait(mmcp);
return HAL_SUCCESS;
}
/* Error.*/
spiUnselect(mmcp->config->spip);
spiStop(mmcp->config->spip);
mmcp->state = BLK_READY;
return HAL_FAILED;
}
开发者ID:mabl,项目名称:ChibiOS,代码行数:37,代码来源:hal_mmc_spi.c
示例6: mmcErase
/**
* @brief Erases blocks.
*
* @param[in] mmcp pointer to the @p MMCDriver object
* @param[in] startblk starting block number
* @param[in] endblk ending block number
*
* @return The operation status.
* @retval HAL_SUCCESS the operation succeeded.
* @retval HAL_FAILED the operation failed.
*
* @api
*/
bool mmcErase(MMCDriver *mmcp, uint32_t startblk, uint32_t endblk) {
osalDbgCheck((mmcp != NULL));
/* Erase operation in progress.*/
mmcp->state = BLK_WRITING;
/* Handling command differences between HC and normal cards.*/
if (!mmcp->block_addresses) {
startblk *= MMCSD_BLOCK_SIZE;
endblk *= MMCSD_BLOCK_SIZE;
}
if (send_command_R1(mmcp, MMCSD_CMD_ERASE_RW_BLK_START, startblk) != 0x00U) {
goto failed;
}
if (send_command_R1(mmcp, MMCSD_CMD_ERASE_RW_BLK_END, endblk) != 0x00U) {
goto failed;
}
if (send_command_R1(mmcp, MMCSD_CMD_ERASE, 0) != 0x00U) {
goto failed;
}
mmcp->state = BLK_READY;
return HAL_SUCCESS;
/* Command failed, state reset to BLK_ACTIVE.*/
failed:
spiStop(mmcp->config->spip);
mmcp->state = BLK_READY;
return HAL_FAILED;
}
开发者ID:mabl,项目名称:ChibiOS,代码行数:47,代码来源:hal_mmc_spi.c
示例7: kuroBoxVectorNavStop
//-----------------------------------------------------------------------------
int
kuroBoxVectorNavStop(VectorNavDriver * nvp)
{
spiStop(nvp->spip);
gptStop(nvp->gpdp);
return KB_OK;
}
开发者ID:naniBox,项目名称:kuroBox,代码行数:8,代码来源:kb_vectornav.c
示例8: mmcStartSequentialRead
/**
* @brief Starts a sequential read.
*
* @param[in] mmcp pointer to the @p MMCDriver object
* @param[in] startblk first block to read
*
* @return The operation status.
* @retval CH_SUCCESS the operation succeeded.
* @retval CH_FAILED the operation failed.
*
* @api
*/
bool_t mmcStartSequentialRead(MMCDriver *mmcp, uint32_t startblk) {
chDbgCheck(mmcp != NULL, "mmcStartSequentialRead");
chDbgAssert(mmcp->state == BLK_READY,
"mmcStartSequentialRead(), #1", "invalid state");
/* Read operation in progress.*/
mmcp->state = BLK_READING;
/* (Re)starting the SPI in case it has been reprogrammed externally, it can
happen if the SPI bus is shared among multiple peripherals.*/
spiStart(mmcp->config->spip, mmcp->config->hscfg);
spiSelect(mmcp->config->spip);
if (mmcp->block_addresses)
send_hdr(mmcp, MMCSD_CMD_READ_MULTIPLE_BLOCK, startblk);
else
send_hdr(mmcp, MMCSD_CMD_READ_MULTIPLE_BLOCK, startblk * MMCSD_BLOCK_SIZE);
if (recvr1(mmcp) != 0x00) {
spiStop(mmcp->config->spip);
return CH_FAILED;
}
return CH_SUCCESS;
}
开发者ID:Dionysios,项目名称:STM_Library_2,代码行数:37,代码来源:mmc_spi.c
示例9: kuroBoxStop
//-----------------------------------------------------------------------------
int
kuroBoxStop(void)
{
kbg_setLED3(1);
extStop(&EXTD1);
kuroBoxExternalDisplayStop();
kuroBoxConfigStop();
kuroBoxMenuStop();
kuroBoxWriterStop();
kuroBoxVectorNavStop(&VND1);
kuroBoxTimeStop();
kuroBoxGPSStop();
kuroBoxButtonsStop();
kuroBoxScreenStop();
kuroBoxADCStop();
#ifdef HAVE_BLINK_THREAD
chThdTerminate(blinkerThread);
chThdWait(blinkerThread);
#endif // HAVE_BLINK_THREAD
sdcStop(&SDCD1);
spiStop(&SPID1);
kuroBoxSerialStop();
chSysDisable();
kbg_setLED1(0);
kbg_setLED2(0);
kbg_setLED3(0);
return KB_OK;
}
开发者ID:naniBox,项目名称:kuroBox,代码行数:35,代码来源:main.c
示例10: mmcDisconnect
/**
* @brief Brings the driver in a state safe for card removal.
*
* @param[in] mmcp pointer to the @p MMCDriver object
* @return The operation status.
* @retval FALSE the operation was successful and the driver is now
* in the @p MMC_INSERTED state.
* @retval TRUE the operation failed.
*/
bool_t mmcDisconnect(MMCDriver *mmcp) {
bool_t status;
chDbgCheck(mmcp != NULL, "mmcDisconnect");
chDbgAssert((mmcp->mmc_state != MMC_UNINIT) &&
(mmcp->mmc_state != MMC_STOP),
"mmcDisconnect(), #1",
"invalid state");
switch (mmcp->mmc_state) {
case MMC_READY:
/* Wait for the pending write operations to complete.*/
sync(mmcp);
chSysLock();
if (mmcp->mmc_state == MMC_READY)
mmcp->mmc_state = MMC_INSERTED;
chSysUnlock();
case MMC_INSERTED:
status = FALSE;
default:
status = TRUE;
}
spiStop(mmcp->mmc_spip);
return status;
}
开发者ID:Nitrokey,项目名称:nitrokey-start-firmware,代码行数:34,代码来源:mmc_spi.c
示例11: mmcErase
/**
* @brief Erases blocks.
*
* @param[in] mmcp pointer to the @p MMCDriver object
* @param[in] startblk starting block number
* @param[in] endblk ending block number
*
* @return The operation status.
* @retval CH_SUCCESS the operation succeeded.
* @retval CH_FAILED the operation failed.
*
* @api
*/
bool_t mmcErase(MMCDriver *mmcp, uint32_t startblk, uint32_t endblk) {
chDbgCheck((mmcp != NULL), "mmcErase");
/* Handling command differences between HC and normal cards.*/
if (!mmcp->block_addresses) {
startblk *= MMCSD_BLOCK_SIZE;
endblk *= MMCSD_BLOCK_SIZE;
}
if (send_command_R1(mmcp, MMCSD_CMD_ERASE_RW_BLK_START, startblk))
goto failed;
if (send_command_R1(mmcp, MMCSD_CMD_ERASE_RW_BLK_END, endblk))
goto failed;
if (send_command_R1(mmcp, MMCSD_CMD_ERASE, 0))
goto failed;
return CH_SUCCESS;
/* Command failed, state reset to BLK_ACTIVE.*/
failed:
spiStop(mmcp->config->spip);
return CH_FAILED;
}
开发者ID:Dionysios,项目名称:STM_Library_2,代码行数:39,代码来源:mmc_spi.c
示例12: l3gd20Stop
/**
* @brief Deactivates the L3GD20 Complex Driver peripheral.
*
* @param[in] devp pointer to the @p L3GD20Driver object
*
* @api
*/
void l3gd20Stop(L3GD20Driver *devp) {
uint8_t cr1;
osalDbgCheck(devp != NULL);
osalDbgAssert((devp->state == L3GD20_STOP) || (devp->state == L3GD20_READY),
"l3gd20Stop(), invalid state");
if (devp->state == L3GD20_READY) {
/* Disabling all axes and enabling power down mode.*/
cr1 = 0;
#if L3GD20_USE_SPI
#if L3GD20_SHARED_SPI
spiAcquireBus(devp->config->spip);
spiStart(devp->config->spip,
devp->config->spicfg);
#endif /* L3GD20_SHARED_SPI */
l3gd20SPIWriteRegister(devp->config->spip, L3GD20_AD_CTRL_REG1,
1, &cr1);
spiStop(devp->config->spip);
#if L3GD20_SHARED_SPI
spiReleaseBus(devp->config->spip);
#endif /* L3GD20_SHARED_SPI */
#endif /* L3GD20_USE_SPI */
}
devp->state = L3GD20_STOP;
}
开发者ID:rusefi,项目名称:ChibiOS,代码行数:36,代码来源:l3gd20.c
示例13: BoardDriverShutdown
void BoardDriverShutdown(void)
{
sduStop(&SDU1);
ws2811Stop(&ws2811);
MFRC522Stop(&RFID1);
spiStop(&SPID1);
}
开发者ID:janfietz,项目名称:toddlerMusicBoxControl,代码行数:8,代码来源:board_drivers.c
示例14: sc_spi_stop
void sc_spi_stop(uint8_t spin)
{
chDbgAssert(spin < SC_SPI_MAX_CLIENTS, "SPI n outside range", "#2");
chDbgAssert(spi_conf[spin].spip != NULL, "SPI n not initialized", "#1");
spiStop(spi_conf[spin].spip);
spi_conf[spin].spip = NULL;
}
开发者ID:rambo,项目名称:control-board,代码行数:8,代码来源:sc_spi.c
示例15: SPISendData
static int SPISendData(SPIDriver *SPIPtr, uint8_t *TxBuf, size_t Size)
{
spiStart(SPIPtr, &HSSpiConfig); /* Setup transfer parameters. */
spiSelect(SPIPtr); /* Slave Select assertion. */
spiSend(SPIPtr, Size, TxBuf); /* Send command */
spiUnselect(SPIPtr); /* Slave Select de-assertion. */
spiStop(SPIPtr);
return 0;
}
开发者ID:hrrr,项目名称:ChibiFlight,代码行数:9,代码来源:flash.c
示例16: mmcStop
/**
* @brief Disables the MMC peripheral.
*
* @param[in] mmcp pointer to the @p MMCDriver object
*
* @api
*/
void mmcStop(MMCDriver *mmcp) {
chDbgCheck(mmcp != NULL, "mmcStop");
chDbgAssert((mmcp->state == BLK_STOP) || (mmcp->state == BLK_ACTIVE),
"mmcStop(), #1", "invalid state");
spiStop(mmcp->config->spip);
mmcp->state = BLK_STOP;
}
开发者ID:Dionysios,项目名称:STM_Library_2,代码行数:16,代码来源:mmc_spi.c
示例17: mmcStop
/**
* @brief Disables the MMC peripheral.
*
* @param[in] mmcp pointer to the @p MMCDriver object
*
* @api
*/
void mmcStop(MMCDriver *mmcp) {
osalDbgCheck(mmcp != NULL);
osalDbgAssert((mmcp->state == BLK_STOP) || (mmcp->state == BLK_ACTIVE),
"invalid state");
spiStop(mmcp->config->spip);
mmcp->state = BLK_STOP;
}
开发者ID:fpiot,项目名称:chibios-ats,代码行数:16,代码来源:mmc_spi.c
示例18: sendToPot
static void sendToPot(Mcp42010Driver *driver, int channel, int value) {
lockSpi(SPI_NONE);
spiStart(driver->spi, &driver->spiConfig);
spiSelect(driver->spi);
int word = (17 + channel) * 256 + value;
spiSend(driver->spi, 1, &word);
spiUnselect(driver->spi);
spiStop(driver->spi);
unlockSpi();
}
开发者ID:Vijay1190,项目名称:rusefi,代码行数:10,代码来源:poten.cpp
示例19: M25P16ReadPage
static void M25P16ReadPage(uint32_t Address, uint8_t * Buffer)
{
uint8_t Command[] = { M25P16_READ_BYTES, (Address >> 16) & 0xFF, (Address >> 8) & 0xFF, Address & 0xFF};
spiStart(&FLASH_SPI, &HSSpiConfig); /* Setup transfer parameters. */
spiSelect(&FLASH_SPI); /* Slave Select assertion. */
spiSend(&FLASH_SPI, 4, Command); /* Send command */
spiReceive(&FLASH_SPI, PAGE_SIZE, Buffer);
spiUnselect(&FLASH_SPI); /* Slave Select de-assertion. */
spiStop(&FLASH_SPI);
}
开发者ID:hrrr,项目名称:ChibiFlight,代码行数:11,代码来源:flash.c
示例20: max6675_get_temp
int max6675_get_temp(const struct max6675 *max)
{
uint16_t read;
spiAcquireBus(max->driver);
spiStart(max->driver, &max->config);
spiSelect(max->driver);
spiReceive(max->driver, 1, &read);
spiUnselect(max->driver);
spiStop(max->driver);
spiReleaseBus(max->driver);
return (read >> 3) * 250;
}
开发者ID:atalax,项目名称:reflow-controller,代码行数:14,代码来源:max6675.c
注:本文中的spiStop函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论