-
Notifications
You must be signed in to change notification settings - Fork 3
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
Slg46826 c type import #7
base: main
Are you sure you want to change the base?
Conversation
- Add slg46826_reg*.h from MoTeC I2C_SLG fork: this defines reg memory as blob of 256 bytes or details it at registers & bits level. - Add test.c: runtime check of bitorder in the fields.
- Imports provided slg46826_register_t.h and allows register/field access from Python.
…bers during runtime. - Map slg_register_t members into runtime, as a list/array if variable names. - Extract bitfield width also.
We building some test scripts (console so far) where we would like to use this. We think it should benefit the greenpak library in general |
- Lists what's needed to run Python scripts in this folder.
Can you create an issue that explain what this feature is supposed to do? A few question
|
If one wants to got a bit over, as with the parsing example provided, one may need to have C GCC compiler, as per line in that script, but it could be optional if pre-processed header used. Idea was to provide it as options to be available. For us, we just want some test scripts which would use the C type shared with C code base, and we want to use it in the Python with greenpak lib to do some external testing which would involve interacting with the Gp devices. Displaying live values is an example. I'm cleaning up some script which would use those modules in this PR, but they all Linux & SMBus layer based, unsure how much you would be able to try them.
As you saw, the parsing already enables us from python get all the fields/regs from file into list, initialize runtime SLG class instance with raw bytes, and then access those fields vales using the list of names extracted. At the moment we would like to use just that, to build simple test scripts. And take further as needed. |
I don't have yet a clarity yet where this is going, so can you put it for
now under src/greenpak/experimental/reg, and put it there with a read file
that clarifies its status.
…On Tue, Feb 27, 2024 at 10:37 PM dry-75 ***@***.***> wrote:
1. In sum: the C header is imported, and the C type is the directly
usable -i.e., its fields/variables inside - from Python as in SLG46826Reg
class. No compiler required if only that class is used.
If one wants to got a bit over, as with the parsing example provided, one
may need to have C GCC compiler, as per line in that script, but it could
be optional if pre-processed header used. Idea was to provide it as options
to be available.
For us, we just want some test scripts which would use the C type shared
with C code base, and we want to use it in the Python with greenpak lib to
do some external testing which would involve interacting with the Gp
devices. Displaying live values is an example.
I'm cleaning up some script which would use those modules in this PR, but
they all Linux & SMBus layer based, unsure how much you would be able to
try them.
1. Yes you may do it, but is outside of scope at the moment for this
work. If you or anyone would like to do something as you describe, it would
be great. We just have no need or didn't think of it, at this day.
As you saw, the parsing already enables us from python get all the
fields/regs from file into list, initialize runtime SLG class instance with
raw bytes, and then access those fields vales using the list of names
extracted.
At the moment we would like to use just that, to build simple test
scripts. And take further as needed.
—
Reply to this email directly, view it on GitHub
<#7 (comment)>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAQVMQKGLCO5GMJEXSQKOZ3YV3GBJAVCNFSM6AAAAABD5IBPCCVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTSNRYGMZDMMRQGI>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
Adds C header with bits & bytes defined as per SLG46826 layout which can be used in C code but we also want to import it and use as is into Python.
Adds class SLG46826Reg with minimal use/test case.
Adds SLG header parser helper, for extracting fields & using them, dynamically.
This code does not affect any of the current greenpak library code.