Feb 08, 2014
04:44 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Feb 08, 2014
04:44 AM
He guys,
how can I send "variable data" with all this const declaration?
status_t USBVC001_SendByte(const uint8_t DataByte)
status_t USBVC001_SendData(const char* const DataBuffer, const uint16_t Length)
status_t USBVC001_SendString(const char* const DataString)
Maybe I'm wrong - but standard compiler does allow only constant and can send this into read only area.
Is there any sample - more than send a const "hello world" ?
Thanks for get me out of this gap.
how can I send "variable data" with all this const declaration?
status_t USBVC001_SendByte(const uint8_t DataByte)
status_t USBVC001_SendData(const char* const DataBuffer, const uint16_t Length)
status_t USBVC001_SendString(const char* const DataString)
Maybe I'm wrong - but standard compiler does allow only constant and can send this into read only area.
Is there any sample - more than send a const "hello world" ?
Thanks for get me out of this gap.
- Tags:
- IFX
2 Replies
Not applicable
Feb 10, 2014
04:15 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Feb 10, 2014
04:15 AM
Hi Tobias Gerber,
You can download the USBVC001 example project in the DAVE Project Library.
In the example project, it sends out the value it received.
So, it is the same as sending variable data.
You can download the USBVC001 example project in the DAVE Project Library.
In the example project, it sends out the value it received.
So, it is the same as sending variable data.
/* Buffer to receive data */
int8_t RxBuffer[100] = { 0 };
/* Receive the byte */
USBVC001_ReceiveByte(&RxBuffer[0]);
/* Send the receive data back to the host */
USBVC001_SendByte(RxBuffer[0]);
Feb 14, 2014
01:30 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Feb 14, 2014
01:30 AM
Hi Jackson,
this was not the question.
I had a misunderstanding about using const in C. (Internet has some strange interpretations which leads me in a wrong direction)
Code:
...
int a;
const int b = 0815:
a = 1234; // ok
b = a; // wrong, don't change an constant
myfunction ( &a, b); // its ok
myfunction (const int * x, int y)
{
* x = 5; // in function body: every change of x will generate an error - outside it's ok
y = *x; // ok
}
=> const in a function does not include, that outside has to be a const definition.
thanks for helping.
BR Tobias
this was not the question.
I had a misunderstanding about using const in C. (Internet has some strange interpretations which leads me in a wrong direction)
Code:
...
int a;
const int b = 0815:
a = 1234; // ok
b = a; // wrong, don't change an constant
myfunction ( &a, b); // its ok
myfunction (const int * x, int y)
{
* x = 5; // in function body: every change of x will generate an error - outside it's ok
y = *x; // ok
}
=> const in a function does not include, that outside has to be a const definition.
thanks for helping.
BR Tobias