A streamlined version (for embedded use) of Jeff Brown's ZBar library. Visit <http://zbar.sourceforge.net> for more details.

Dependents:   BarcodeReader_F103

Committer:
hudakz
Date:
Fri Jan 10 22:06:18 2020 +0000
Revision:
1:4f5c042a2d34
Parent:
0:e33621169e44
Streamlined barcode reader library.

Who changed what in which revision?

UserRevisionLine numberNew contents of line
hudakz 0:e33621169e44 1 /*------------------------------------------------------------------------
hudakz 0:e33621169e44 2 * Copyright 2007-2009 (c) Jeff Brown <spadix@users.sourceforge.net>
hudakz 0:e33621169e44 3 *
hudakz 0:e33621169e44 4 * This file is part of the ZBar Bar Code Reader.
hudakz 0:e33621169e44 5 *
hudakz 0:e33621169e44 6 * The ZBar Bar Code Reader is free software; you can redistribute it
hudakz 0:e33621169e44 7 * and/or modify it under the terms of the GNU Lesser Public License as
hudakz 0:e33621169e44 8 * published by the Free Software Foundation; either version 2.1 of
hudakz 0:e33621169e44 9 * the License, or (at your option) any later version.
hudakz 0:e33621169e44 10 *
hudakz 0:e33621169e44 11 * The ZBar Bar Code Reader is distributed in the hope that it will be
hudakz 0:e33621169e44 12 * useful, but WITHOUT ANY WARRANTY; without even the implied warranty
hudakz 0:e33621169e44 13 * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
hudakz 0:e33621169e44 14 * GNU Lesser Public License for more details.
hudakz 0:e33621169e44 15 *
hudakz 0:e33621169e44 16 * You should have received a copy of the GNU Lesser Public License
hudakz 0:e33621169e44 17 * along with the ZBar Bar Code Reader; if not, write to the Free
hudakz 0:e33621169e44 18 * Software Foundation, Inc., 51 Franklin St, Fifth Floor,
hudakz 0:e33621169e44 19 * Boston, MA 02110-1301 USA
hudakz 0:e33621169e44 20 *
hudakz 0:e33621169e44 21 * http://sourceforge.net/projects/zbar
hudakz 0:e33621169e44 22 *------------------------------------------------------------------------*/
hudakz 0:e33621169e44 23 #ifndef _CODE128_H_
hudakz 0:e33621169e44 24 #define _CODE128_H_
hudakz 0:e33621169e44 25
hudakz 0:e33621169e44 26 /* Code 128 specific decode state */
hudakz 0:e33621169e44 27 //typedef struct code128_decoder_s {
hudakz 0:e33621169e44 28 // unsigned direction : 1; /* scan direction: 0=fwd/space, 1=rev/bar */
hudakz 0:e33621169e44 29 // unsigned element : 3; /* element offset 0-5 */
hudakz 0:e33621169e44 30 // int character : 12; /* character position in symbol */
hudakz 0:e33621169e44 31 // unsigned s6; /* character width */
hudakz 0:e33621169e44 32
hudakz 0:e33621169e44 33 // unsigned config;
hudakz 0:e33621169e44 34 // int configs[NUM_CFGS]; /* int valued configurations */
hudakz 0:e33621169e44 35 //} code128_decoder_t;
hudakz 0:e33621169e44 36
hudakz 0:e33621169e44 37 #include <stdint.h>
hudakz 0:e33621169e44 38
hudakz 0:e33621169e44 39 typedef struct code128_decoder_s {
hudakz 0:e33621169e44 40 uint8_t direction; /* scan direction: 0=fwd/space, 1=rev/bar */
hudakz 0:e33621169e44 41 uint8_t element; /* element offset 0-5 */
hudakz 0:e33621169e44 42 int16_t character; /* character position in symbol */
hudakz 0:e33621169e44 43 uint16_t s6; /* character width */
hudakz 0:e33621169e44 44
hudakz 0:e33621169e44 45 unsigned config;
hudakz 0:e33621169e44 46 int configs[NUM_CFGS]; /* int valued configurations */
hudakz 0:e33621169e44 47 } code128_decoder_t;
hudakz 0:e33621169e44 48
hudakz 0:e33621169e44 49 /* reset Code 128 specific state */
hudakz 0:e33621169e44 50 static inline void code128_reset (code128_decoder_t *dcode128)
hudakz 0:e33621169e44 51 {
hudakz 0:e33621169e44 52 dcode128->direction = 0;
hudakz 0:e33621169e44 53 dcode128->element = 0;
hudakz 0:e33621169e44 54 dcode128->character = -1;
hudakz 0:e33621169e44 55 dcode128->s6 = 0;
hudakz 0:e33621169e44 56 }
hudakz 0:e33621169e44 57
hudakz 0:e33621169e44 58 /* decode Code 128 symbols */
hudakz 0:e33621169e44 59 zbar_symbol_type_t _zbar_decode_code128(zbar_decoder_t *dcode);
hudakz 0:e33621169e44 60
hudakz 0:e33621169e44 61 #endif