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

version: 0.1.0 -> 0.1.1 #8

Merged
merged 1 commit into from
Feb 2, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,14 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [0.1.1] - 2022-02-01
### Added
- Added support for TMS commands.

## [0.1.0] - 2021-09-26

Initial release.

[Unreleased]: https://github.com/ftdi-rs/ftdi-mpsse/compare/v0.1.0...HEAD
[0.1.1]: https://github.com/ftdi-rs/ftdi-mpsse/compare/v0.1.0...v0.1.1
[0.1.0]: https://github.com/ftdi-rs/ftdi-mpsse/releases/tag/v0.1.0
5 changes: 2 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[package]
name = "ftdi-mpsse"
version = "0.1.0" # remember to update html_root_url
authors = ["Alex Martens <[email protected]>", "Sergey Matyukevich <[email protected]>"]
version = "0.1.1"
authors = ["Alex Martens <[email protected]>", "Sergey Matyukevich <[email protected]>"]
edition = "2018"
description = "Rust helpers for the MPSSE on FTDI chips."
keywords = ["ftdi", "mpsse"]
Expand All @@ -16,4 +16,3 @@ static_assertions = "^1.1.0"

[dev-dependencies]
libftd2xx = "~0.32.0"
version-sync = "0.9"
65 changes: 32 additions & 33 deletions src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
//! Multi-protocol synchronous serial engine utilities for FTDI devices.
#![doc(html_root_url = "https://docs.rs/ftdi-mpsse/0.1.0")]
#![deny(unsafe_code)]

use std::convert::From;
Expand Down Expand Up @@ -794,10 +793,10 @@ impl MpsseCmdBuilder {
pub fn clock_data_out(mut self, mode: ClockDataOut, data: &[u8]) -> Self {
let mut len = data.len();
assert!(len <= 65536, "data length cannot exceed u16::MAX + 1");
if len == 0 {
return self;
}
len -= 1;
len = match len.checked_sub(1) {
Some(l) => l,
None => return self,
};
self.0
.extend_from_slice(&[mode.into(), (len & 0xFF) as u8, ((len >> 8) & 0xFF) as u8]);
self.0.extend_from_slice(data);
Expand All @@ -816,10 +815,10 @@ impl MpsseCmdBuilder {
/// This will panic for values greater than `u16::MAX + 1`.
pub fn clock_data_in(mut self, mode: ClockDataIn, mut len: usize) -> Self {
assert!(len <= 65536, "data length cannot exceed u16::MAX + 1");
if len == 0 {
return self;
}
len -= 1;
len = match len.checked_sub(1) {
Some(l) => l,
None => return self,
};
self.0
.extend_from_slice(&[mode.into(), (len & 0xFF) as u8, ((len >> 8) & 0xFF) as u8]);
self
Expand All @@ -831,10 +830,10 @@ impl MpsseCmdBuilder {
pub fn clock_data(mut self, mode: ClockData, data: &[u8]) -> Self {
let mut len = data.len();
assert!(len <= 65536, "data length cannot exceed u16::MAX + 1");
if len == 0 {
return self;
}
len -= 1;
len = match len.checked_sub(1) {
Some(l) => l,
None => return self,
};
self.0
.extend_from_slice(&[mode.into(), (len & 0xFF) as u8, ((len >> 8) & 0xFF) as u8]);
self.0.extend_from_slice(data);
Expand All @@ -851,10 +850,10 @@ impl MpsseCmdBuilder {
/// This will panic for values greater than 8.
pub fn clock_bits_out(mut self, mode: ClockBitsOut, data: u8, mut len: u8) -> Self {
assert!(len <= 8, "data length cannot exceed 8");
if len == 0 {
return self;
}
len -= 1;
len = match len.checked_sub(1) {
Some(l) => l,
None => return self,
};
self.0.extend_from_slice(&[mode.into(), len, data]);
self
}
Expand All @@ -868,10 +867,10 @@ impl MpsseCmdBuilder {
/// This will panic for values greater than 8.
pub fn clock_bits_in(mut self, mode: ClockBitsIn, mut len: u8) -> Self {
assert!(len <= 8, "data length cannot exceed 8");
if len == 0 {
return self;
}
len -= 1;
len = match len.checked_sub(1) {
Some(l) => l,
None => return self,
};
self.0.extend_from_slice(&[mode.into(), len]);
self
}
Expand All @@ -885,10 +884,10 @@ impl MpsseCmdBuilder {
/// This will panic for values greater than 8.
pub fn clock_bits(mut self, mode: ClockBits, data: u8, mut len: u8) -> Self {
assert!(len <= 8, "data length cannot exceed 8");
if len == 0 {
return self;
}
len -= 1;
len = match len.checked_sub(1) {
Some(l) => l,
None => return self,
};
self.0.extend_from_slice(&[mode.into(), len, data]);
self
}
Expand All @@ -910,10 +909,10 @@ impl MpsseCmdBuilder {
mut len: u8,
) -> Self {
assert!(len <= 7, "data length cannot exceed 7");
if len == 0 {
return self;
}
len -= 1;
len = match len.checked_sub(1) {
Some(l) => l,
None => return self,
};
if tdi {
data |= 0x80;
}
Expand All @@ -932,10 +931,10 @@ impl MpsseCmdBuilder {
/// This will panic for values greater than 7.
pub fn clock_tms(mut self, mode: ClockTMS, mut data: u8, tdi: bool, mut len: u8) -> Self {
assert!(len <= 7, "data length cannot exceed 7");
if len == 0 {
return self;
}
len -= 1;
len = match len.checked_sub(1) {
Some(l) => l,
None => return self,
};
if tdi {
data |= 0x80;
}
Expand Down
9 changes: 0 additions & 9 deletions tests/version-sync.rs

This file was deleted.