本文整理汇总了C++中DEBUGPRINT_F函数的典型用法代码示例。如果您正苦于以下问题:C++ DEBUGPRINT_F函数的具体用法?C++ DEBUGPRINT_F怎么用?C++ DEBUGPRINT_F使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了DEBUGPRINT_F函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: SpiWriteDataSynchronous
void SpiWriteDataSynchronous(unsigned char *data, unsigned short size)
{
unsigned char dummy;
DEBUGPRINT_F("\tCC3000: SpiWriteDataSynchronous Start\n\r");
uint8_t loc;
for (loc = 0; loc < size; loc ++)
{
dummy = SPI.transfer(data[loc]);
#if (DEBUG_MODE == 1)
if (!(loc==size-1))
{
DEBUGPRINT_F(" ");
DEBUGPRINT_HEX(data[loc]);
}
else
{
DEBUGPRINT_F(" ");
DEBUGPRINT_HEX(data[loc]);
}
#endif
}
DEBUGPRINT_F("\n\r\tCC3000: SpiWriteDataSynchronous End\n\r");
}
示例2: ReadWlanInterruptPin
long ReadWlanInterruptPin(void)
{
DEBUGPRINT_F("\tCC3000: ReadWlanInterruptPin - ");
DEBUGPRINT_DEC(digitalRead(g_irqPin));
DEBUGPRINT_F("\n\r");
return(digitalRead(g_irqPin));
}
示例3: wlan_start
void
wlan_start(unsigned short usPatchesAvailableAtHost)
{
unsigned long ulSpiIRQState;
tSLInformation.NumberOfSentPackets = 0;
tSLInformation.NumberOfReleasedPackets = 0;
tSLInformation.usRxEventOpcode = 0;
tSLInformation.usNumberOfFreeBuffers = 0;
tSLInformation.usSlBufferLength = 0;
tSLInformation.usBufferSize = 0;
tSLInformation.usRxDataPending = 0;
tSLInformation.slTransmitDataError = 0;
tSLInformation.usEventOrDataReceived = 0;
tSLInformation.pucReceivedData = 0;
// Allocate the memory for the RX/TX data transactions
tSLInformation.pucTxCommandBuffer = (unsigned char *)wlan_tx_buffer;
// init spi
SpiOpen(SpiReceiveHandler);
// Check the IRQ line
ulSpiIRQState = tSLInformation.ReadWlanInterruptPin();
// ASIC 1273 chip enable: toggle WLAN EN line
tSLInformation.WriteWlanPin( WLAN_ENABLE );
if (ulSpiIRQState)
{
// wait till the IRQ line goes low
while(tSLInformation.ReadWlanInterruptPin() != 0)
{
}
}
else
{
// wait till the IRQ line goes high and than low
while(tSLInformation.ReadWlanInterruptPin() == 0)
{
}
while(tSLInformation.ReadWlanInterruptPin() != 0)
{
}
}
DEBUGPRINT_F("SimpleLink start\n\r");
SimpleLink_Init_Start(usPatchesAvailableAtHost);
// Read Buffer's size and finish
DEBUGPRINT_F("Read buffer\n\r");
hci_command_send(HCI_CMND_READ_BUFFER_SIZE, tSLInformation.pucTxCommandBuffer, 0);
SimpleLinkWaitEvent(HCI_CMND_READ_BUFFER_SIZE, 0);
}
示例4: SpiReadDataSynchronous
void SpiReadDataSynchronous(unsigned char *data, unsigned short size)
{
unsigned short i = 0;
DEBUGPRINT_F("\tCC3000: SpiReadDataSynchronous\n\r");
SPI.setDataMode(SPI_MODE1);
for (i = 0; i < size; i ++)
{
data[i] = SPI.transfer(0x03);
DEBUGPRINT_F(" ");
DEBUGPRINT_HEX(data[i]);
}
DEBUGPRINT_F("\n\r");
}
示例5: init_spi
int init_spi(void)
{
DEBUGPRINT_F("\tCC3000: init_spi\n\r");
/* Set POWER_EN pin to output and disable the CC3000 by default */
pinMode(g_vbatPin, OUTPUT);
digitalWrite(g_vbatPin, 0);
delay(500);
/* Set CS pin to output (don't de-assert yet) */
pinMode(g_csPin, OUTPUT);
//pinMode(g_csPin - 1, OUTPUT);
/* Set interrupt/gpio pin to input */
//#if defined(INPUT_PULLUP)
// pinMode(g_irqPin, INPUT_PULLUP);/
//#else
pinMode(g_irqPin, INPUT);
// digitalWrite(g_irqPin, HIGH); // w/weak pullup
//#endif
SpiConfigStoreOld(); // prime ccspi_old* values for DEASSERT
/* Initialise SPI (Mode 1) */
theCcspi->setDataMode(SPI_MODE1);
theCcspi->setBitOrder(true);
//theCcspi->setClockDivider(g_SPIspeed);
DEBUGPRINT_F("\tCC3000: init_spi1\n\r");
theCcspi->begin();
DEBUGPRINT_F("\tCC3000: init_spi2\n\r");
SpiConfigStoreMy(); // prime ccspi_my* values for ASSERT
// Newly-initialized SPI is in the same state that ASSERT_CS will set it
// to. Invoke DEASSERT (which also restores SPI registers) so the next
// ASSERT call won't clobber the ccspi_old* values -- we need those!
CC3000_DEASSERT_CS;
/* ToDo: Configure IRQ interrupt! */
DEBUGPRINT_F("\tCC3000: Finished init_spi\n\r");
return(ESUCCESS);
}
示例6: init_spi
int init_spi(void)
{
DEBUGPRINT_F("\tCC3000: init_spi\n\r");
/* Set POWER_EN pin to output and disable the CC3000 by default */
pinMode(g_vbatPin, OUTPUT);
digitalWrite(g_vbatPin, 0);
delay(500);
/* Set CS pin to output (don't de-assert yet) */
pinMode(g_csPin, OUTPUT);
/* Set interrupt/gpio pin to input */
#if defined(INPUT_PULLUP)
pinMode(g_irqPin, INPUT_PULLUP);
#else
pinMode(g_irqPin, INPUT);
digitalWrite(g_irqPin, HIGH); // w/weak pullup
#endif
SpiConfigStoreOld(); // prime ccspi_old* values for DEASSERT
/* Initialise SPI (Mode 1) */
SPI.begin();
SPI.setDataMode(SPI_MODE1);
SPI.setBitOrder(MSBFIRST);
SPI.setClockDivider(g_SPIspeed);
SpiConfigStoreMy(); // prime ccspi_my* values for ASSERT
// Newly-initialized SPI is in the same state that ASSERT_CS will set it
// to. Invoke DEASSERT (which also restores SPI registers) so the next
// ASSERT call won't clobber the ccspi_old* values -- we need those!
#ifdef SPI_HAS_TRANSACTION
SPI.usingInterrupt(g_IRQnum);
digitalWrite(g_csPin, HIGH); // same as CC3000_DEASSERT_CS, but not
SpiConfigPop(); // SPI.endTransaction, because none began
#else
CC3000_DEASSERT_CS;
#endif
/* ToDo: Configure IRQ interrupt! */
DEBUGPRINT_F("\tCC3000: Finished init_spi\n\r");
return(ESUCCESS);
}
示例7: SpiPauseSpi
void SpiPauseSpi(void)
{
DEBUGPRINT_F("\tCC3000: SpiPauseSpi\n\r");
ccspi_int_enabled = 0;
detachInterrupt(g_IRQnum);
}
示例8: SpiResumeSpi
void SpiResumeSpi(void)
{
DEBUGPRINT_F("\tCC3000: SpiResumeSpi\n\r");
ccspi_int_enabled = 1;
attachInterrupt(g_IRQnum, SPI_IRQ, FALLING);
}
示例9: WlanInterruptEnable
void WlanInterruptEnable()
{
DEBUGPRINT_F("\tCC3000: WlanInterruptEnable.\n\r");
// delay(100);
ccspi_int_enabled = 1;
attachInterrupt(g_IRQnum, SPI_IRQ, FALLING);
}
示例10: simple_link_recv
//*****************************************************************************
//
//! simple_link_recv
//!
//! @param sd socket handle
//! @param buf read buffer
//! @param len buffer length
//! @param flags indicates blocking or non-blocking operation
//! @param from pointer to an address structure indicating source address
//! @param fromlen source address structure size
//!
//! @return Return the number of bytes received, or -1 if an error
//! occurred
//!
//! @brief Read data from socket
//! Return the length of the message on successful completion.
//! If a message is too long to fit in the supplied buffer,
//! excess bytes may be discarded depending on the type of
//! socket the message is received from
//
//*****************************************************************************
int
simple_link_recv(long sd, void *buf, long len, long flags, sockaddr *from,
socklen_t *fromlen, long opcode)
{
unsigned char *ptr, *args;
tBsdReadReturnParams tSocketReadEvent;
ptr = tSLInformation.pucTxCommandBuffer;
args = (ptr + HEADERS_SIZE_CMD);
// Fill in HCI packet structure
args = UINT32_TO_STREAM(args, sd);
args = UINT32_TO_STREAM(args, len);
args = UINT32_TO_STREAM(args, flags);
// Generate the read command, and wait for the
hci_command_send(opcode, ptr, SOCKET_RECV_FROM_PARAMS_LEN);
// Since we are in blocking state - wait for event complete
SimpleLinkWaitEvent(opcode, &tSocketReadEvent);
DEBUGPRINT_F("\n\r\tRecv'd data... Socket #");
DEBUGPRINT_DEC(tSocketReadEvent.iSocketDescriptor);
DEBUGPRINT_F(" Bytes: 0x");
DEBUGPRINT_HEX(tSocketReadEvent.iNumberOfBytes);
DEBUGPRINT_F(" Flags: 0x");
DEBUGPRINT_HEX(tSocketReadEvent.uiFlags);
DEBUGPRINT_F("\n\r");
// In case the number of bytes is more then zero - read data
if (tSocketReadEvent.iNumberOfBytes > 0)
{
// Wait for the data in a synchronous way. Here we assume that the bug is
// big enough to store also parameters of receive from too....
SimpleLinkWaitData((unsigned char *)buf, (unsigned char *)from, (unsigned char *)fromlen);
}
errno = tSocketReadEvent.iNumberOfBytes;
#if (DEBUG_MODE == 1)
for (uint8_t i=0; i<errno; i++) {
uart_putchar(((unsigned char *)buf)[i]);
}
#endif
return(tSocketReadEvent.iNumberOfBytes);
}
示例11: SpiFirstWrite
long SpiFirstWrite(unsigned char *ucBuf, unsigned short usLength)
{
DEBUGPRINT_F("\tCC3000: SpiWriteFirst\n\r");
/* Workaround for the first transaction */
CC3000_ASSERT_CS;
DEBUGPRINT_F(digitalRead(g_irqPin));
/* delay (stay low) for ~50us */
//delayMicroseconds(50);
DEBUGPRINT_F(digitalRead(g_irqPin));
/* SPI writes first 4 bytes of data */
SpiWriteDataSynchronous(ucBuf, 4);
DEBUGPRINT_F(digitalRead(g_irqPin));
//delayMicroseconds(50);
DEBUGPRINT_F(digitalRead(g_irqPin));
SpiWriteDataSynchronous(ucBuf + 4, usLength - 4);
DEBUGPRINT_F(digitalRead(g_irqPin));
/* From this point on - operate in a regular manner */
sSpiInformation.ulSpiState = eSPI_STATE_IDLE;
CC3000_DEASSERT_CS;
delay(1);
DEBUGPRINT_F(digitalRead(g_irqPin));
SpiResumeSpi();
return(0);
}
示例12: WriteWlanPin
void WriteWlanPin( unsigned char val )
{
if (DEBUG_MODE)
{
DEBUGPRINT_F("\tCC3000: WriteWlanPin - ");
DEBUGPRINT_DEC(val);
DEBUGPRINT_F("\n\r");
delay(1);
}
if (val)
{
digitalWrite(g_vbatPin, HIGH);
}
else
{
digitalWrite(g_vbatPin, LOW);
}
}
示例13: WlanInterruptDisable
void WlanInterruptDisable()
{
DEBUGPRINT_F("\tCC3000: WlanInterruptDisable\n\r");
ccspi_int_enabled = 0;
detachInterrupt(g_IRQnum);
//finish any pending reads from any previous interrupts
spiFinishRead();
}
示例14: SpiReadDataCont
long SpiReadDataCont(void)
{
long data_to_recv;
unsigned char *evnt_buff, type;
DEBUGPRINT_F("\tCC3000: SpiReadDataCont\n\r");
/* Determine what type of packet we have */
evnt_buff = sSpiInformation.pRxPacket;
data_to_recv = 0;
STREAM_TO_UINT8((uint8_t *)(evnt_buff + SPI_HEADER_SIZE), HCI_PACKET_TYPE_OFFSET, type);
switch(type)
{
case HCI_TYPE_DATA:
{
/* We need to read the rest of data.. */
STREAM_TO_UINT16((char *)(evnt_buff + SPI_HEADER_SIZE), HCI_DATA_LENGTH_OFFSET, data_to_recv);
if (!((HEADERS_SIZE_EVNT + data_to_recv) & 1))
{
data_to_recv++;
}
if (data_to_recv)
{
SpiReadDataSynchronous(evnt_buff + HEADERS_SIZE_EVNT, data_to_recv);
}
break;
}
case HCI_TYPE_EVNT:
{
/* Calculate the rest length of the data */
STREAM_TO_UINT8((char *)(evnt_buff + SPI_HEADER_SIZE), HCI_EVENT_LENGTH_OFFSET, data_to_recv);
data_to_recv -= 1;
/* Add padding byte if needed */
if ((HEADERS_SIZE_EVNT + data_to_recv) & 1)
{
data_to_recv++;
}
if (data_to_recv)
{
SpiReadDataSynchronous(evnt_buff + HEADERS_SIZE_EVNT, data_to_recv);
}
sSpiInformation.ulSpiState = eSPI_STATE_READ_EOT;
break;
}
}
return (0);
}
示例15: SpiClose
void SpiClose(void)
{
DEBUGPRINT_F("\tCC3000: SpiClose");
if (sSpiInformation.pRxPacket)
{
sSpiInformation.pRxPacket = 0;
}
/* Disable Interrupt in GPIOA module... */
tSLInformation.WlanInterruptDisable();
}