-
Notifications
You must be signed in to change notification settings - Fork 15
-
Notifications
You must be signed in to change notification settings - Fork 15
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
@hex #4
Comments
Okay, I see what you're after now. Sorry for closing your other issue. How do you imagine the syntax to work? If I can implement it into the current version, then I'll try my best to get it into #2 at the same time. |
Okay, this was a quick hack and my knowledge of hex is pretty limited. Could you try out the latest commit db1421f The syntax is I have limited knowledge of hex, but it seems to be working. Also, I've not updated the README file to portray these changes yet, I would like further testing :) |
sorry for the late answer, I will check that next week and give you some feedback |
No worries, I hope you had a good holiday buddy. Once you've checked it over, I'll merge the two hex languages so you can optionally supply |
@majjam have you had a chance to look at this yet? From my quick tests it looks like it's working okay, in which case I'll merge the syntaxes. If I hear nothing in the next couple of days I'll go ahead and merge. |
somehow the code from yousn good for me, so i changed it to my intension: Example 1 :syntax : 0x1 <<2 6 0x1 starting number in hex (eg 0x50 is 80 in dec) 0x000001 Example 2 :syntax : 0x1 2 5 0x01 starting number in hex (eg 0x50 is 80 in dec) 0x00001 Example 2 :0x80 >>1 1 0x80 starting number in hex (eg 0x80 is 80 in dec) 0x80 ---------------------------------------------code-------------------------------------------------------------------------
|
Added in 2.0.0. (a22af2b) Check the examples in the readme on how to do this. |
sorry for opening a new issue, but..
for me the already integrated hex support is missin the "0x" prefix.
The next thing is, that the "step" misses the << and >> operator.
At the moment I can only increment and decrement by stepsize like:
8
9
a
b
If you're using BIT operations on embedded devices it is very handy to use increment like
"Val << count" to select each bit itself. what results in:
01
02
04
08
10
Next thing is the prefix "0x" often it is necessary that you have the prefix "0x" at hex numbers. Then the compiler knows that hex values are meant meant.
0x01
0x02
0x04
0x08
0x10
I don't want to annoy you just want to give you my point.
If you have very small and fast communication, sometimes you en/decode states to single bits See example at the end.
if(MyVariableNo1beforeComLayer) myComBite1 |= 0x01
if(MyVariableNo2beforeComLayer) myComBite1 |= 0x02
if(MyVariableNo3beforeComLayer) myComBite1 |= 0x04
if(MyVariableNo4beforeComLayer) myComBite1 |= 0x08
if(MyVariableNo5beforeComLayer) myComBite1 |= 0x10
if(myComBite1 & 0x01) myVariableNo1BehindComLayer = 1;
if(myComBite1 & 0x02) myVariableNo2BehindComLayer = 1;
if(myComBite1 & 0x04) myVariableNo3BehindComLayer = 1;
if(myComBite1 & 0x08) myVariableNo4BehindComLayer = 1;
if(myComBite1 & 0x10) myVariableNo5BehindComLayer = 1;
best regards
Max
The text was updated successfully, but these errors were encountered: