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

memset seems to not work? #17

Closed
beicnet opened this issue May 31, 2017 · 2 comments
Closed

memset seems to not work? #17

beicnet opened this issue May 31, 2017 · 2 comments

Comments

@beicnet
Copy link

beicnet commented May 31, 2017

Hi there,

I'm trying a char cleaning like in standard Arduino environment on the ATmega8, but I got error saying:

invalid conversion from 'char' to 'void*' [-fpermissive]

Code follows:

char pKey;
memset(pKey, 0, sizeof(pKey));

Any suggestions?

Regards

@MCUdude
Copy link
Owner

MCUdude commented May 31, 2017

Why would you use memset for storing data to a variable?

Have a read over at cplusplus.com. The first argument needs to be void*.

memset((void*)pKey, 0, sizeof(pKey));

Just have in mind; MiniCore does not provide any source files, it's just linked to your IDE installation. I cannot do anything to the code to prevent this, at all. If you believe there's a bug, you'll have to report it at the official Arduino repo

@MCUdude MCUdude closed this as completed May 31, 2017
@beicnet
Copy link
Author

beicnet commented May 31, 2017

For the standard Arduino UNO usage the code bellow is working:
memset(pKey, 0, sizeof(pKey));

and for the Core usage you provided, is working now too:
memset((void*)pKey, 0, sizeof(pKey));

Thank you again for your support! ;)

MCUdude added a commit that referenced this issue May 30, 2019
ce0f4cc0 Fix attachInterrupt for AT90CAN32, CAN64 and CAN128
43b470ad Fix TIMER2A PWM generation For AT90CAN32/64/128
87171c2c Accurate millis, micros and delay for more weird clocks 14.7456 MHz, 11.0592 MHz, 7.3728 MHz, 3.6864 MHz and 1.8432 MHz added to micros()
0afb5b19 Add AT90CAN32, AT90CAN64 and AT90CAN128
14e2ae53 Merge pull request #17 from Jackjan4/master
bac5a5a5 Corrected comment
d275ec91 Experimental accuracy improvement
daeebfe4 Fixed return and semicolon
3db48eb8 Add more accurate delay() and micros() for 12MHz
040e3ceb Merge pull request #16 from Jackjan4/master
4209b9ef Accurate delay() and delayMicroseconds() for 32MHz
4a6f6c56 Merge pull request #15 from Jackjan4/master
96a19ab3 Increased correction factor again
0e004163 Adapted correction factor to include delayMicros(9)
b7bb1935 tabs...
a598a1d4 removed tab
e4574f60 Rollback of if-statement and lowered entry-barrier for correction
53294c75 Clean up comments & accurate 24MHz timing
933f8387 Increased subtraction factor & switched if
156634c8 Increased subtraction factor
6ea0e65f Removed tab again :P
2b35c453 delayMicroseconds(1) now delays at least 1us
633342e0 Increase subtraction factor
e585c21d Increase multiplication factor
2f4d8a37 Compensate offset from 18.432MHz to 20MHz - Experimental
d91ea048 Remove more function overhead before succeeding to loop
4814c688 Removed accidental tabs
72b96755 Improved accuracy of delayMicroseconds() on 18.432MHz
44853d99 micros() usable on 24+MHz
0c10c80a Add accurate timing on 18.432MHz based on ATTinyCore
1cec1e36 Preparations for accurate 24MHz timing
787f6909 Merge pull request #14 from Jackjan4/master
80d146d3 Reformatting hopefully last time ;)
6a1886b1 Restored original file formatting 4)
b9941087 Merge remote-tracking branch 'origin/master'
69464ab6 Restored original file formatting 3)
c1ac9113 Restored original file formatting 2)
0a3806bc Restored original file formatting #2
25aa05f4 Restored original file formatting
02dd20a2 Removed unnecessary blanks
4d6139d1 Replaced all tabs with spaces
a89db99f Added fix for delay() on 20MHz which provides 99.5% accuracy
3219ce6e Auto-indendent the whole file
23f9c470 Added comments for understanding how time-counting in arduino works
179a74da Preparing the 20MHz precompiler branch in micros()
2d9c31b8 Replace tabs with spaces
28277ab3 Replace ATmega644 with ATmega644A 644A is binary compatible with 644, but has two UARTS
edf8d239 Fix INT2 issue on ATmega8515/162 Turns out that the registers to control INT2 on 8515/162 is different than every other AVR out there.

git-subtree-dir: avr/cores/MCUdude_corefiles
git-subtree-split: ce0f4cc05832ceeb10b461ce7be22bc1f95ae56a
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