* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ * along with this program; if not, see <http://www.gnu.org/licenses/>.
*/
#include <config.h>
return SR_ERR;
}
- sr_analog_init(&analog, &encoding, &meaning, &spec, 3);
+ sr_analog_init(&analog, &encoding, &meaning, &spec, 1);
/* Common values for both channels. */
packet.type = SR_DF_ANALOG;
g_slist_free(l);
}
- devc->num_samples++;
+ sr_sw_limits_update_samples_read(&devc->limits, 1);
return SR_OK;
}
{
struct sr_dev_inst *sdi;
struct dev_context *devc;
- int64_t t;
static gboolean first_time = TRUE;
struct sr_serial_dev_inst *serial;
}
}
- if (devc->limit_samples && devc->num_samples >= devc->limit_samples) {
- sr_info("Requested number of samples reached.");
+ if (sr_sw_limits_check(&devc->limits))
sdi->driver->dev_acquisition_stop(sdi);
- return TRUE;
- }
-
- if (devc->limit_msec) {
- t = (g_get_monotonic_time() - devc->starttime) / 1000;
- if (t > (int64_t)devc->limit_msec) {
- sr_info("Requested time limit reached.");
- sdi->driver->dev_acquisition_stop(sdi);
- return TRUE;
- }
- }
return TRUE;
}