User Tools

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revisionBoth sides next revision
code:sub2r-lib [2022/08/30 18:45] – [Sample code] Igor Yefmovcode:sub2r-lib [2022/08/30 18:48] – [UFix_8_8] Igor Yefmov
Line 357: Line 357:
 | <code c++>m_rollingbar</code> | enable/disable a rolling bar, only valid when ''m_mode == color_bar'' | | <code c++>m_rollingbar</code> | enable/disable a rolling bar, only valid when ''m_mode == color_bar'' |
 | <code c++>m_enabled</code> | enable/disable the test pattern mode | | <code c++>m_enabled</code> | enable/disable the test pattern mode |
- 
- 
-==== UFix_8_8 ==== 
-{{ :code:class-ufix_8_8.png?nolink|Class diagram - UFix_8_8}} 
- 
-A helper class for working with a 2-byte floating number format used to specify fractional parameters for the FX3. More details are available in  [[code:numberformats#ufix_88|UFIX 8.8 documentation]]. 
- 
-^ Method ^ Signature ^ Functionality ^ 
-| ''constructor'' | <code c++>constexpr 
-  UFix_8_8( 
-      uint8_t _i 
-    , uint8_t _f = 0 
-    ) noexcept</code> | construct a number from provided integer (''_i'') and fractional (''_f'') parts, for example: <code c++>auto uf88{1, 128}; // uf88 is now 1.5</code>No validation is performed to make sure the ''_f'' is in range [''0''..''255''] | 
-| ''constructor'' | <code c++>constexpr 
-  UFix_8_8(double _d) 
-    noexcept;</code> | construct from a floating-point number, i.e.: <code c++>auto uf88{1.2};</code> | 
-| ''constructor'' | <code c++>UFix_8_8( 
-    gsl::span<const std::byte> _buf 
-    ) noexcept;</code> | use this constructor when you read a 2-byte ''UFix_8_8'' value from FX3 | 
-| ''operator double'' | <code c++>constexpr 
-  operator double() const 
-    noexcept;</code> | a type conversion into a floating-point number | 
-| ''operator uint16_t'' | <code c++>constexpr 
-  operator uint16_t() const 
-    noexcept;</code> | make 2 bytes that are ready to be written to FX3, for example:<code c++>// omitting all the error checks!!! 
-uint8_t valI{1}, valF{128}; 
-auto val{S2R::UFix_8_8(valI, valF)}; 
-S2R::I2C dev; 
-// a port to set the image adjustment auto- 
-// functions' update interval 
-constexpr uint8_t port{0xDF}; 
-dev.vrCmd(port, S2R::FX3::write, val, 0); 
-</code> | 
  
  

This website uses cookies. By using the website, you agree with storing cookies on your computer. Also, you acknowledge that you have read and understand our Privacy Policy. If you do not agree, please leave the website.

More information