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 revision
Previous revision
Next revisionBoth sides next revision
code:sub2r-lib [2019/04/29 01:43] – [Windows] Igor Yefmovcode:sub2r-lib [2022/08/30 18:42] – [byte_span] Igor Yefmov
Line 1: Line 1:
 ====== Windows ====== ====== Windows ======
  
-You can download the library from [[http://download.sub2r.com/SUB2r-lib-2019-04-29.zip|this location]]. What you get in this package is:+You can download the library from [[http://sub2r-download.com/SUB2r-lib-2022-08-22.zip|this location]]. What you get in this package is:
   - A header file ''FX3.h'' - the only include you need besides the standard headers   - A header file ''FX3.h'' - the only include you need besides the standard headers
   - Both ''Release'' and ''Debug'' libraries with full symbol files (''.pdb'') and support for edit and continue (''.idb'' - currently only for ''Debug'' mode). These include the libraries from Cypress that this package depends on.   - Both ''Release'' and ''Debug'' libraries with full symbol files (''.pdb'') and support for edit and continue (''.idb'' - currently only for ''Debug'' mode). These include the libraries from Cypress that this package depends on.
-  - A sample code that demonstrates some basics on how to use the library: ''sample1.cpp''+  - Sample code that demonstrates some basics on how to use the library: ''sample1.cpp'' 
 +  - Sample code that showcases the use of ''sysinfo'': ''sample2.cpp'' 
 +  - Sample code for controlling FPS: ''sample3.cpp''
  
-The library is built using MSVC 2017 version ''15.9.11'' with Windows SDK ''10.0.17763.0'' for use with ''UNICODE'' and ''multi-threaded'' CRT in ''64-bit'' mode only. The library requires a C++17 toolchain to be built.+The library is built using MSVC 2022 version ''17.3.1'' with Windows SDK ''10.0.19041.0'' for use with ''UNICODE'' and ''multi-threaded'' CRT in ''64-bit'' and ''32-bit'' mode. The library requires a C++20 toolchain to be built.
  
-===== byte_span ===== +===== Basic "vendor request" call =====
-Beginning with version ''2018-09-05'' the code relies on [[https://github.com/Microsoft/GSL|Guidelines Support Library]] (GSL). Part of that change is to use ''gsl::span<std::byte>'' to represent raw byte buffers. +
- +
-Quite often a need arises to represent "simple" data types (like ''uint32_t'') as a byte buffer when using hardware API. To reduce the potential for stupid bugs and make code more readable it is recommended to use the provided <code c++>template<class T> gsl::span<std::byte> byte_span(T& _x) noexcept;</code> function when such a buffer's address is needed. +
- +
-All the library's methods were updated to conform to this calling convention.+
  
 Sample usage: Sample usage:
Line 19: Line 16:
 using S2R::FX3; using S2R::FX3;
 FX3 fx3; // by default opens device #0 FX3 fx3; // by default opens device #0
-if(fx3){ +if(fx3.isValid()){ 
-    uint32_t vi{};+    array<std::byte, 4> vi{};
     const auto rc{m_fx3.vrCmd(Fx3Cmd::fx3_version // vendor request command     const auto rc{m_fx3.vrCmd(Fx3Cmd::fx3_version // vendor request command
                               , VrCmdOpType::read // read from device                               , VrCmdOpType::read // read from device
                               , 0                 // "value"                               , 0                 // "value"
                               , 0                 // "index"                               , 0                 // "index"
-                              , byte_span(vi))};  // buffer to read into+                              , vi)};             // buffer to read into
     return vi;                                    // 32 bits of the "version info" (4 bytes)     return vi;                                    // 32 bits of the "version info" (4 bytes)
 } }
Line 469: Line 466:
 FIXME FIXME
  
 +====== Previous versions ======
  
 +  * [[SUB2r-lib-2020-10-08]]
 +  * [[SUB2r-lib-2019-04-29]]

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