Skip to content

Commit

Permalink
doc: add missing docs
Browse files Browse the repository at this point in the history
  • Loading branch information
Sofiman committed Oct 16, 2023
1 parent cac5128 commit 0344aca
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 4 deletions.
4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "pdf417"
version = "0.2.0"
version = "0.2.1"
edition = "2021"
authors = ["Sofiane"]
description = "No-std PDF417 encoder"
Expand All @@ -10,7 +10,7 @@ repository = "https://github.com/Sofiman/pdf417/"
license-file = "LICENSE"
keywords = ["pdf417", "no-std", "embedded"]
categories = ["encoding", "embedded", "no-std"]
exclude = ["./images"]
exclude = ["/images"]

[dependencies]
awint_core = { version = "0.11.0", default-features = false }
21 changes: 19 additions & 2 deletions src/high_level.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,21 +5,37 @@ use crate::{ecc, find_variant};
use awint_core::{InlAwi, Bits};
type U160 = InlAwi<160, { Bits::unstable_raw_digits(160) }>;

/// Codeword used to latch to text mode
pub const M_LATCH_TEXT: u16 = 900;
/// Codeword used to latch to byte mode (if length is multiple of 6 use
/// M_LATCH_BYTE_M6).
pub const M_LATCH_BYTE: u16 = 901;
/// Codeword used to latch to numeric mode
pub const M_LATCH_NUMERIC: u16 = 902;

// 903 to 912: reserved for future use

/// Codeword used to switch to byte mode for next codedword (usable only if
/// the current mode is text).
pub const M_SHIFT_BYTE: u16 = 913;

// 914 to 920: reserved for future use
// 921: used for reader initialization or programming (barcode used to
// enable/disable specific features of the reader).
// 922 to 923: Macro PDF4l7

/// Codeword used to latch to byte mode (if length is multiple of 6 use
/// M_LATCH_BYTE_M6).
pub const M_LATCH_BYTE_M6: u16 = 924;
/// Codeword used to specifiy a ECI (user) custom ID
pub const ECI_CUSTOM_ID: u16 = 925;
/// Codeword used to specifiy a ECI code
pub const ECI_GENERAL_ID: u16 = 926;
/// Codeword used to specifiy a ECI code page
pub const ECI_CODE_PAGE: u16 = 927;
// 928: Block start for PDF macro

/// Codeword used as padding at the end of the data section
pub const CW_PADDING: u16 = M_LATCH_TEXT;

const MIXED_CHAR_SET: [u8; 15] = [
Expand Down Expand Up @@ -459,8 +475,9 @@ impl<'a> PDF417Encoder<'a> {

/// Call this function to seal your data segments into a slice of codewords
/// ready to be rendered to a PDF417. Both padding and ECC codewords are
/// generated by this function. This internally uses [fit_ecc] to fit the
/// maximum number of ECC codewords possible.
/// generated by this function. This internally uses
/// [PDF417Encoder::fit_ecc] to fit the maximum number of ECC codewords
/// possible.
pub fn fit_seal(self) -> Option<(u8, &'a mut [u16])> {
let v = self.fit_ecc()?;
Some((v, self.seal(v)))
Expand Down
1 change: 1 addition & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@
//! Do not forget to set the `micro` parameter to true in [PDF417Encoder::new].
#![no_std]
#![warn(missing_docs)]
#![feature(const_mut_refs)]

mod tables;
Expand Down

0 comments on commit 0344aca

Please # to comment.