Date:2010-08-10 17:26:24 (9 years 15 days ago)
Author:Werner Almesberger
Commit:6ec22bc755b5100e43a7cf8e60dbbb14cfa06979
Message:Added a data sheet viewer. It improves upon the design used in gta02-core by allowing a hierarchy of caches, by using only one directory for each cache, and by putting only one command in the PATH.

- scripts/dsv: new and improved data sheet viewer (successor of gta02-core's
dsv)
- Makefile: added "dsv" target to update the bookshelf
- ds/INFO, components/INFO, modules/INFO: ds/INFO moved to BOOKSHELF
- components/INFO, modules/INFO: renamed "D" tag to "N", for consistency with
BOOKSHELF
- BOOKSHELF: changed "stdpass" URL to the actual PDF
Files: BOOKSHELF (1 diff)
Makefile (1 diff)
components/INFO (1 diff)
ds/INFO (1 diff)
modules/INFO (1 diff)
scripts/dsv (1 diff)

Change Details

BOOKSHELF
1#
2# Tags:
3#
4# N name to use for dsv (must be first)
5# A alias name(s)
6# D data sheet url
7#
8
9N: at86rf230
10A: transceiver
11A: txrx
12D: http://www.atmel.com/dyn/resources/prod_documents/doc5131.pdf
13
14N: c8051f326
15A: mcu
16D: http://www.silabs.com/Support Documents/TechnicalDocs/C8051F326.pdf
17
18# AN043 -- Small Size 2.4 GHz PCB Antenna (Rev. D)
19N: AN043
20A: antenna
21D: http://focus.ti.com/lit/an/swra117d/swra117d.pdf
22
23# AVR2004: LC-Balun for AT86RF230
24N: avr2004
25A: balun
26D: http://www.atmel.com/dyn/resources/prod_documents/doc8113.pdf
27
28# AVR2005: Design Considerations for the AT86RF230
29N: avr2005
30A: at86rf230-design
31A: design
32D: http://www.atmel.com/dyn/resources/prod_documents/doc8092.pdf
33
34# Mini-USB B receptacle (this footprint is fairly universal)
35N: mini_usb_b
36D: http://jae-connector.com/en/pdf/SJ037525.pdf
37# D: http://documents.tycoelectronics.com/commerce/DocumentDelivery/DDEController?Action=srchrtrv&DocNm=1734035&DocType=CD&DocLang=EN
38
39# Footprints of standard rectangular passive components
40N: stdpass
41D: http://www.vishay.com/docs/20035/dcrcwe3.pdf
Makefile
1.PHONY: all gen generate sch brd xpdf
1.PHONY: all gen generate sch brd xpdf dsv
22
33all:
4        @echo "make what ? target: gen sch xpdf brd"
4        @echo "make what ? target: gen sch brd xpdf dsv"
55        @exit 1
66
77gen generate:
88        eeschema --plot `pwd`/wpan-atrf.sch
99        # need scripts
1010
11xpdf:
12        xpdf wpan-atrf.pdf
13
1411sch:
1512        eeschema `pwd`/wpan-atrf.sch
1613
1714brd:
1815        pcbnew `pwd`/wpan-atrf.brd
16
17xpdf:
18        xpdf wpan-atrf.pdf
19
20dsv:
21        scripts/dsv setup BOOKSHELF
components/INFO
33#
44# S Symbol name (must be first)
55# M Package marking
6# D Data sheet identifier (N tag of ds/INFO; can be omitted if equal to S)
6# N Data sheet identifier (N tag of BOOKSHELF; can be omitted if equal to S)
77#
88
99# C8051F326 MCU
ds/INFO
1N: at86rf230
2A: transceiver
3A: txrx
4D: http://www.atmel.com/dyn/resources/prod_documents/doc5131.pdf
5
6N: c8051f326
7A: mcu
8D: http://www.silabs.com/Support Documents/TechnicalDocs/C8051F326.pdf
9
10# AN043 -- Small Size 2.4 GHz PCB Antenna (Rev. D)
11N: AN043
12A: antenna
13D: http://focus.ti.com/lit/an/swra117d/swra117d.pdf
14
15# AVR2004: LC-Balun for AT86RF230
16N: avr2004
17A: balun
18D: http://www.atmel.com/dyn/resources/prod_documents/doc8113.pdf
19
20# AVR2005: Design Considerations for the AT86RF230
21N: avr2005
22A: at86rf230-design
23A: design
24D: http://www.atmel.com/dyn/resources/prod_documents/doc8092.pdf
25
26# Mini-USB B receptacle (this footprint is fairly universal)
27N: mini_usb_b
28D: http://jae-connector.com/en/pdf/SJ037525.pdf
29# D: http://documents.tycoelectronics.com/commerce/DocumentDelivery/DDEController?Action=srchrtrv&DocNm=1734035&DocType=CD&DocLang=EN
30
31# Footprints of standard rectangular passive components
32N: stdpass
33D: http://www.vishay.com/doc?20035
34
modules/INFO
22# Tags:
33#
44# F Footprint name (must be first)
5# D Data sheet identifier (N tag of ds/INFO; can be omitted if equal to F)
5# N Data sheet identifier (N tag of BOOKSHELF; can be omitted if equal to F)
66#
77
88# TI meandered inverted F antenna
99F: meander
10D: AN043
10N: AN043
1111
1212# Mini-USB B receptable (SMT; almost generic)
1313F: mini_usb_b
scripts/dsv
1#!/bin/sh
2#
3# dsv - Improved data sheet viewer
4#
5
6#
7# Theory of operation:
8#
9# We download data sheets from the Internet into local caches and provide a
10# quick access mechanism for viewing the data sheets. A cache is a directory
11# called .dsv/. Caches can be hierarchical. "dsv setup" generates a cache in
12# the local directory. "dsv <component>" and "dsv ls" search the hierarchy,
13# starting with the current directory.
14#
15# Caches contain two types of files: dsv-<ref> is the name or alias with
16# which a data sheet is referenced. <ref>-<filename> is the actual data
17# sheet, with <filename> being the name of the file we downloaded.
18#
19
20DSV_DIR=.dsv
21
22
23usage()
24{
25    echo "usage: $0 <component>" 2>&1
26    echo " $0 help" 2>&1
27    echo " $0 [ls]" 2>&1
28    echo " $0 setup <info-file> .." 2>&1
29    exit 1
30}
31
32
33up()
34{
35    old="`pwd`"
36    cd ..
37    new="`pwd`"
38    [ "$old" != "$new" ]
39}
40
41
42flush()
43{
44    [ -z "$name" ] && return
45    if [ -z "$url" ]; then
46    echo "$name: no URL" 2>&1
47    exit 1
48    fi
49    ds="$name-`basename "$url"`"
50    mkdir -p $DSV_DIR
51    if [ ! -r "$DSV_DIR/$ds" ]; then
52    wget -nv -O "$DSV_DIR/$ds" "$url"
53    # @@@ should handle error
54    fi
55    for n in $name $alias; do
56    echo "$ds" >$DSV_DIR/dsv-$n
57    done
58    name=
59    alias=
60    url=
61}
62
63
64set_value()
65{
66    case "$tag" in
67    N:|n:) flush
68        name="$value";;
69    A:|a:) alias="$alias $value";;
70    D:|d:) url="$value";;
71    "")
72        ;; # first iteration
73    *) echo "unrecognized tag \"$tag\"" 2>&1
74        exit 1;;
75    esac
76    value=
77}
78
79
80eof()
81{
82    flush
83    tag=
84}
85
86
87setup()
88{
89    for n in "$@"; do
90    if [ ! -r "$n" ]; then
91        echo "$n: not found" 2>&1
92        continue
93    fi
94        while read line; do
95        [ "$line" = "${line###}" ] || continue
96        tmp=`echo "$line" | awk '/^[^\t ]/ { print $1 }'`
97        tail="`echo "$line" | sed 's/^[^\t ]*[\t ]*//'`"
98        if [ -z "$tmp" ]; then
99        [ -z "$tail" ] || value="$value $tail"
100        else
101        set_value
102        tag=$tmp
103        value="$tail"
104        fi
105    done <"$n"
106    set_value
107    eof
108    done
109}
110
111
112list()
113{
114     while true; do
115    if [ -d $DSV_DIR ]; then
116        ls -1 $DSV_DIR | sed 's/^dsv-//p;d'
117    fi
118    up || break
119     done | sort | uniq | column
120}
121
122
123search()
124{
125    while true; do
126    if [ -d $DSV_DIR ]; then
127        if [ -r "$DSV_DIR/dsv-$1" ]; then
128        file="`cat $DSV_DIR/dsv-$1`"
129        if [ ! -r "$DSV_DIR/$file" ]; then
130            echo "$1 -> $file: does not exist" 2>&1
131            exit 1
132        fi
133        xpdf "$DSV_DIR/$file"
134        exit
135        fi
136    fi
137    if ! up; then
138        echo "no data sheet found for \"$1\"" 2>&1
139        exit 1
140    fi
141    done
142}
143
144
145case "$1" in
146    help|-*) usage;;
147    ""|ls) list;;
148    setup) shift
149        setup "$@";;
150    *) search "$@";;
151esac

Archive Download the corresponding diff file



interactive