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

Use of itoa() on TI platforms #2

Closed
speters opened this issue Nov 18, 2022 · 2 comments
Closed

Use of itoa() on TI platforms #2

speters opened this issue Nov 18, 2022 · 2 comments

Comments

@speters
Copy link

speters commented Nov 18, 2022

While playing around with plugins on my TM4C1294XL, I came over a compile error in

itoa(current_position[idx], strchr(buf, '\0'), 10);

due to it not being a standard function and not contained in TI's stdlib.h

Quick fix ltoa()?

@terjeio
Copy link
Contributor

terjeio commented Nov 18, 2022

Quick fix ltoa()?

That breaks other drivers...

I added a macro symbol for itoa() in CCS:

image

Way to fix it?

@speters
Copy link
Author

speters commented Nov 19, 2022

Thx for this idea, that seems better than touching the Plugin sources.

Maybe this could find its way into TI driver.h (I hesitate to make a pull request for changes like this):

diff --git i/base/driver.h w/base/driver.h
index 3c433c6..fff068d 100644
--- i/base/driver.h
+++ w/base/driver.h
@@ -129,6 +129,10 @@
 #define DIGITAL_OUT(port, pin, on) GPIOPinWrite(port, 1<<pin, (on) ? 1<<pin : 0);
 #endif
 
+#ifdef OPENPNP_ENABLE
+#define itoa(a, b, c) ltoa(a, b, c)
+#endif
+
 // Define GPIO output mode options
 // Use GPIO_SHIFTx when output bits are consecutive and in the same port
 // Use GPIO_MAP when output bits are not consecutive but in the same port

PS:
If anyone who is also untrained in CCSTudio also wondered where this screenshot from above came from: It shows settings which are only available when "Show advanced settings" in the project properties dialogue is activated. A tree "C/C++ General" is then available.

@speters speters closed this as completed Nov 19, 2022
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