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

how to use xgen #15

Open
wumingyu12 opened this issue Jun 25, 2018 · 3 comments
Open

how to use xgen #15

wumingyu12 opened this issue Jun 25, 2018 · 3 comments

Comments

@wumingyu12
Copy link

hello,first it is a wonderful project,i has hate to use c to write Embedded program。

i find you use xgen to create sdk .go file by register config .go file。
now i want to add something in register config .go file
how can i use xgen to update sdk .go file like xgen_ficr.go

@ziutek
Copy link
Owner

ziutek commented Jun 25, 2018

Simly run:

xgen ficr.go

It regenerates xgen_ficr.go.

For STM32 see issue #13

@ziutek
Copy link
Owner

ziutek commented Jun 25, 2018

There is one unobvious thing.

Bit field names must have a comment beginning with "//+". See the following example:

const (
    SPEED    = 3 << 5 //+
    VERYSLOW = 0 << 5
    SLOW     = 1 << 5
    NORMAL   = 2 << 5
    FAST     = 3 << 5
    DIR      = 1 << 7 //+
)

xgen uses it to distinguish between field name and its values. Of course, it is good to put a full description of any bit/bitfield.

@wumingyu12
Copy link
Author

i see and Thank you for your reply。

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