-
Notifications
You must be signed in to change notification settings - Fork 1.3k
docs: Update to reflect the HAL API changes #4596
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -55,10 +55,6 @@ The old defined constants are still supported for backwards compatibility. | |
| .Example: | ||
| [source,python] | ||
| ---- | ||
| # Old (deprecated) style: | ||
| comp.newpin("in-a", hal.HAL_FLOAT, hal.HAL_IN) | ||
|
|
||
| # New style: | ||
| comp.newpin("in-a", hal.Type.REAL, hal.Dir.IN) | ||
| ---- | ||
|
|
||
|
|
@@ -71,22 +67,22 @@ The `hal.Type` enum is used to specify the type of pin, parameter and signal: | |
| * `hal.Type.UINT` - An unsigned quantity with range 0...+2^64^-1 | ||
| * `hal.Type.REAL` - A floating point quantity of range ±1.80×10^308^ | ||
| * `hal.Type.PORT` - An opaque quantity representing a communication channel (pins only) | ||
| * `hal.Type.S32` - A signed quantity with range -2^31^...+2^31^-1 (see notes below) | ||
| * `hal.Type.U32` - An unsigned quantity with range 0...+2^32^-1 (see notes below) | ||
|
|
||
| There are aliases in the `hal.Type` enum for all types with the `HAL_` prefix (e.g. `hal.Type.HAL_BOOL`, etc.). | ||
|
|
||
| [NOTE] | ||
| ==== | ||
| The constants previously used (`hal.HAL_BIT`, `hal.HAL_FLOAT`, etc.) are still available. | ||
| The constants previously used (`hal.HAL_BIT`, `hal.HAL_FLOAT`, etc.) are deprecated and emit a warning. | ||
| You should upgrade your code to use the enumerated types with the new names instead. | ||
| ==== | ||
|
|
||
| [IMPORTANT] | ||
| ==== | ||
| The 32-bit types will soon be replaced by 64-bit types. | ||
| The names will remain for some time, but they will map to the larger type automatically. | ||
| The `S32` and `U32` names will then no longer be unique and the range will be larger. | ||
| [source,python] | ||
| ---- | ||
| # Old (deprecated) style: | ||
| comp.newpin("in-a", hal.HAL_FLOAT, hal.HAL_IN) | ||
|
|
||
| # New style: | ||
| comp.newpin("in-a", hal.Type.REAL, hal.Dir.IN) | ||
| ---- | ||
| ==== | ||
|
|
||
| ==== HAL direction | ||
|
|
@@ -104,13 +100,16 @@ Also the direction enums are available with the `HAL_` prefix (like `hal.Dir.HAL | |
|
|
||
| ==== Old style HAL constants (deprecated) | ||
|
|
||
| Old style constants (deprecated): | ||
| `hal.HAL_BIT`, `hal.HAL_S32`, `hal.HAL_U32`, `hal.HAL_S64`, `hal.HAL_U64`, `hal.HAL_FLOAT`, `hal.HAL_PORT`. | ||
| Old style constants (deprecated, please use `hal.Type.XXXX`): | ||
| `hal.HAL_BOOL`, `hal.HAL_SINT`, `hal.HAL_UINT`, `hal.HAL_REAL`, `hal.HAL_PORT`. | ||
|
|
||
| Deprecated constants (replaced with new names, please use `hal.Type.XXXX`): | ||
| `hal.HAL_BIT`, `hal.HAL_S64`, `hal.HAL_U64`, `hal.HAL_FLOAT`. | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The deprecated list covers HAL_BIT/HAL_FLOAT/HAL_S64/HAL_U64, but the hal.py getattr shim also accepts HAL_S32 and HAL_U32 (with a 'no longer supported' FutureWarning). Add them here for completeness?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I considered it, but rejected it. The base code no longer has them and the shim replaces them with UINT/SINT. The warning is different for these than for the others. In python we can just pretend because it does not really care about the integer size. Besides, there is a (very) large list of things you need to do when migrating and this doc is just a tiny fraction. Better put that in the "upgrade" doc(s) is my thinking. |
||
|
|
||
| Old style deprecated pin direction constants (deprecated): | ||
| Old style deprecated pin direction constants (deprecated, please use `hal.Dir.YYY`): | ||
| `hal.HAL_IN`, `hal.HAL_OUT`, `hal.HAL_IO`. | ||
|
|
||
| Old style deprecated parameter access constants (deprecated): | ||
| Old style deprecated parameter access constants (deprecated, please use `hal.Dir.YYY`): | ||
| `hal.HAL_RO`, `hal.HAL_RW`. | ||
|
|
||
| [[halconstantsmsg]] | ||
|
|
@@ -271,8 +270,8 @@ Textual representations are case insensitive. | |
| .Example: | ||
| [source,python] | ||
| ---- | ||
| hal.set_p("mycomp.0.bit", True) | ||
| hal.set_p("mycomp.0.float", 99.99) | ||
| hal.set_p("mycomp.0.bool", True) | ||
| hal.set_p("mycomp.0.real", 99.99) | ||
| ---- | ||
|
|
||
| hal.set_s(_name_:string, _value_:mixed):: | ||
|
|
@@ -429,12 +428,10 @@ Each data sample may contain up to twenty (20) values. | |
| The type of the values in a sample must be configured and specified in a type string. | ||
| anchor:type-string[]The type string consists of the following characters (case insensitive): | ||
|
|
||
| * `b` - Boolean | ||
| * `s` - Signed 32-bit | ||
| * `u` - Unsigned 32-bit | ||
| * `l` - Signed 64-bit | ||
| * `k` - Unsigned 64-bit | ||
| * `f` - Floating point (real) | ||
| * `b` - Boolean (bool) | ||
| * `s`, `l` - Signed 64-bit (sint) | ||
| * `u`, `k` - Unsigned 64-bit (uint) | ||
| * `f`, `r` - Floating point (real) | ||
|
|
||
| Two components are available, 'streamer' and 'sampler'. | ||
| The 'streamer' component writes a set of pins from non-real-time data pushed into a stream. | ||
|
|
@@ -576,7 +573,7 @@ result = hal.query.pin("my.pin.name") | |
| result = { | ||
| "haltype" : "pin", | ||
| "name" : "my.pin.name", | ||
| "type" : hal.Type.<BOOL,REAL,SINT,UINT,PORT,S32,U32>, | ||
| "type" : hal.Type.<BOOL,REAL,SINT,UINT,PORT>, | ||
| "dir" : hal.Dir.<IN,OUT,IO>, | ||
| "value" : <bool, int or float>, | ||
| "alias" : "alias.name"|None, | ||
|
|
@@ -597,7 +594,7 @@ result = hal.query.param("my.param.name") | |
| result = { | ||
| "haltype" : "parameter", | ||
| "name" : "my.param.name", | ||
| "type" : hal.Type.<BOOL,REAL,SINT,UINT,S32,U32>, | ||
| "type" : hal.Type.<BOOL,REAL,SINT,UINT>, | ||
| "dir" : hal.Dir.<RO,WR>, | ||
| "value" : <bool, int or float>, | ||
| "alias" : "alias.name"|None, | ||
|
|
@@ -617,7 +614,7 @@ result = hal.query.signal("my.signal.name") | |
| result = { | ||
| "haltype" : "signal", | ||
| "name" : "my.signal.name", | ||
| "type" : hal.Type.<BOOL,REAL,SINT,UINT,PORT,S32,U32>, | ||
| "type" : hal.Type.<BOOL,REAL,SINT,UINT,PORT>, | ||
| "value" : <bool, int or float>, | ||
| "writers" : <int>, | ||
| "readers" : <int>, | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.