Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ver 3.1.3 SPI spi_tx_data -- 'SPITransfer' does not name a type; #107

Open
AtherSaleem opened this issue Feb 13, 2023 · 4 comments
Open

Comments

@AtherSaleem
Copy link

AtherSaleem commented Feb 13, 2023

Describe the bug
Compile/Verify Error: 'SPITransfer' does not name a type; did you mean 'spiTransfer'?

To Reproduce
Steps to reproduce the behavior:

  1. Expamle spi_tx_data
  2. Compile/Verify

Expected behavior
Expample should compile without errors

Desktop (please complete the following information):

  • Tried on both Arduino IDE (1.8.19 & 2.0.3) for windows
  • Arduino IDE (2.0.3) Linux
  • Seems Library Error

Edit:
I tried to look at .h and .cpp and found Comment out codes. I un comment all of it, but still was unable to use library. Some procedures were still not found by the Compiler.

  1. Can I have a copy of working SPI Library
  2. Why the code is Commented?

-- I have used library for UART/Serial ports both Hard and Soft works perfectly, just getting this error while trying on SPI.

@PowerBroker2
Copy link
Owner

That part of the library is commented out because Arduino core developers are stupid and have different SPI APIs across different boards - making SPI data transfer libraries like this super difficult. Can post the entire error?

@AtherSaleem
Copy link
Author

Thanks for Response:

Command: sendSize = myTransfer.txObj(testStruct, sendSize);
Error: sendSize = no matching function for call to 'SPITransfer::txObj(STRUCT&, uint16_t&)'

Command: sendSize = myTransfer.txObj(arr, sendSize);
Error: invalid conversion from 'char*' to 'int' [-fpermissive]

I am using ESP32 Dev Kit C

@PowerBroker2
Copy link
Owner

This error doesn't make sense considering the first argument for SPITransfer::txObj() is templated:

uint16_t SPITransfer::txObj(const T &val, const uint16_t &index=0, const uint16_t &len=sizeof(T))
Description:
------------
* Stuffs "len" number of bytes of an arbitrary object (byte, int,
float, double, struct, etc...) into the transmit buffer (txBuff)
starting at the index as specified by the argument "index"
Inputs:
-------
* const T &val - Pointer to the object to be copied to the
transmit buffer (txBuff)
* const uint16_t &index - Starting index of the object within the
transmit buffer (txBuff)
* const uint16_t &len - Number of bytes of the object "val" to transmit
Return:
-------
* uint16_t maxIndex - uint16_t maxIndex - Index of the transmit buffer (txBuff) that directly follows the bytes processed
by the calling of this member function
*//*
template <typename T>
uint16_t txObj(const T& val, const uint16_t& index = 0, const uint16_t& len = sizeof(T))
{
return packet.txObj(val, index, len);
}

I honestly don't know what's going wrong - perhaps someone on the Arduino forum would be of more help

@AtherSaleem
Copy link
Author

I just revisted .h and .cpp

There is some stuff like this:
Description:
------------
* Stuffs "len" number of bytes of an arbitrary object (byte, int,
float, double, struct, etc...) into the transmit buffer (txBuff)
starting at the index as specified by the argument "index"
Inputs:
-------

This seems to be Comment but not marked as comment.

This one:
*** const T &val - Pointer to the object to be copied to the**
Not sure what it is , declaration or Comment , may be this needs to be separated.

Had I been this expert to do myself, I would be developing libraries not using them , LoL

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants