Exemple #1
0
    parser.add_argument('board', help='mbed board name')
    parser.add_argument('-o',
                        help='Output JavaScript file (default: %(default)s)',
                        default='js/pins.js',
                        type=argparse.FileType('w'))
    parser.add_argument('-c',
                        help='Output C++ file (default: %(default)s)',
                        default='source/pins.cpp',
                        type=argparse.FileType('w'))

    args = parser.parse_args()
    board_name = args.board.upper()

    target = Target(board_name)

    directory_labels = ['TARGET_' + label for label in target.get_labels()] + target.macros

    targets_dir = os.path.join('.', 'mbed-os', 'hal', 'targets')
    hal_dir = os.path.join(targets_dir, 'hal')

    pins_file = find_file(hal_dir, directory_labels, 'PinNames.h')


    includes = enumerate_includes(targets_dir, directory_labels)
    defines = list(directory_labels)

    # enumerate pins from PinNames.h
    pins = enumerate_pins(pins_file, ['./tools'] + list(includes), defines)

    out_file = '\r\n'.join(['var %s = %s;' % pin for pin in pins.iteritems()])
    args.o.write(out_file)
    parser.add_argument('board', help='mbed board name')
    parser.add_argument('-o',
                        help='Output JavaScript file (default: %(default)s)',
                        default='js/pins.js',
                        type=argparse.FileType('w'))
    parser.add_argument('-c',
                        help='Output C++ file (default: %(default)s)',
                        default='source/pins.cpp',
                        type=argparse.FileType('w'))

    args = parser.parse_args()
    board_name = args.board.upper()

    target = Target(board_name)

    directory_labels = ['TARGET_' + label for label in target.get_labels()] + target.macros

    targets_dir = os.path.join('.', 'mbed-os', 'hal', 'targets')
    hal_dir = os.path.join(targets_dir, 'hal')

    pins_file = find_file(hal_dir, directory_labels, 'PinNames.h')


    includes = enumerate_includes(targets_dir, directory_labels)
    defines = list(directory_labels)

    # enumerate pins from PinNames.h
    pins = enumerate_pins(pins_file, ['./tools'] + list(includes), defines)

    out_file = '\r\n'.join(['var %s = %s;' % pin for pin in pins.iteritems()])
    args.o.write(out_file)
    parser.add_argument('-o',
                        help='Output JavaScript file (default: %(default)s)',
                        default='js/pins.js',
                        type=argparse.FileType('w'))
    parser.add_argument('-c',
                        help='Output C++ file (default: %(default)s)',
                        default='source/pins.cpp',
                        type=argparse.FileType('w'))

    args = parser.parse_args()
    board_name = args.board.upper()

    target = Target(board_name)

    directory_labels = ['TARGET_' + label
                        for label in target.get_labels()] + target.macros

    targets_dir = os.path.join('.', 'mbed-os', 'hal', 'targets')
    hal_dir = os.path.join(targets_dir, 'hal')

    pins_file = find_file(hal_dir, directory_labels, 'PinNames.h')

    includes = enumerate_includes(targets_dir, directory_labels)
    defines = list(directory_labels)

    # enumerate pins from PinNames.h
    pins = enumerate_pins(pins_file, ['./tools'] + list(includes), defines)

    out_file = '\r\n'.join(['var %s = %s;' % pin for pin in pins.iteritems()])
    args.o.write(out_file)