Пример #1
0
def install_board_with_programmer(
    mcu,
    programmer,
    f_cpu=16000000,
    core='arduino',
    replace_existing=False,
):
    """install board with programmer."""
    bunch = AutoBunch()
    board_id = '{mcu}_{f_cpu}_{programmer}'.format(
        f_cpu=f_cpu,
        mcu=mcu,
        programmer=programmer,
    )
    bunch.name = '{mcu}@{f} Prog:{programmer}'.format(
        f=strfreq(f_cpu),
        mcu=mcu,
        programmer=programmer,
    )

    bunch.upload.using = programmer

    bunch.build.mcu = mcu
    bunch.build.f_cpu = str(f_cpu) + 'L'
    bunch.build.core = core

    install_board(board_id, bunch, replace_existing=replace_existing)
Пример #2
0
def test_1():
    x = AutoBunch()
    check_keys(x.keys(), [])

    x.a = 3
    check_keys(x.keys(), ["a"])
    eq_(x["a"], 3)
    eq_(x.a, 3)
Пример #3
0
def install(replace_existing=False):
    """install stk200 programmer."""
    bunch = AutoBunch()
    bunch.name = 'STK200'
    bunch.protocol = 'stk200'
    # bunch.force = 'true'
    # bunch.delay=200

    install_programmer('stk200', bunch, replace_existing=replace_existing)
Пример #4
0
def install(replace_existing=False):
    """install dapa programmer."""
    bunch = AutoBunch()
    bunch.name = 'DAPA'
    bunch.protocol = 'dapa'
    bunch.force = 'true'
    # bunch.delay=200

    install_programmer('dapa', bunch, replace_existing=replace_existing)
Пример #5
0
def test_setattr():
    x = AutoBunch()
    setattr(x, "a.b", 3)
    check_keys(x.keys(), ["a"])
    eq_(x["a"]["b"], 3)
    eq_(x.a.b, 3)
    eq_(x["a"].b, 3)
    eq_(x.a["b"], 3)

    lines = bunch2properties("x", x)
Пример #6
0
def test_2():
    x = AutoBunch()
    x.a.b = 3
    check_keys(x.keys(), ["a"])
    eq_(x["a"]["b"], 3)
    eq_(x.a.b, 3)
    eq_(x["a"].b, 3)
    eq_(x.a["b"], 3)

    lines = bunch2properties("x", x)
Пример #7
0
    def install(mcu, f_cpu, kbyte):
        board = AutoBunch()
        board.name = TEMPL_NAME.format(mcu=mcu,
                                       f_cpu=format_freq(f_cpu),
                                       upload=upload)
        board_id = TEMPL_ID.format(mcu=mcu,
                                   f_cpu=(f_cpu),
                                   upload=upload)

        board.upload.using = upload
        board.upload.maximum_size = kbyte * 1024

        board.build.mcu = mcu
        board.build.f_cpu = str(f_cpu) + 'L'
        board.build.core = core

        # for 1.0
        board.build.variant = 'standard'

        install_board(board_id, board, replace_existing=replace_existing)
Пример #8
0
def install_metaboard(replace_existing=False, ):
    """install metaboard.

    http://metalab.at/wiki/Metaboard

    """
    metaboard = AutoBunch()
    metaboard.name = 'Metaboard'

    metaboard.upload.protocol = 'usbasp'
    metaboard.upload.maximum_size = '14336'
    metaboard.upload.speed = '19200'

    metaboard.build.mcu = 'atmega168'
    metaboard.build.f_cpu = '16000000L'
    metaboard.build.core = 'arduino'

    metaboard.upload.disable_flushing = 'true'

    board_id = 'metaboard'

    install_board(board_id, metaboard, replace_existing=replace_existing)
Пример #9
0
def install_board_with_programmer(mcu,
                                  programmer,
                                  f_cpu=16000000,
                                  core='arduino',
                                  replace_existing=False,
                                  ):
    """install board with programmer."""
    bunch = AutoBunch()
    board_id = '{mcu}_{f_cpu}_{programmer}'.format(f_cpu=f_cpu,
                                             mcu=mcu,
                                             programmer=programmer,
                                             )
    bunch.name = '{mcu}@{f} Prog:{programmer}'.format(f=strfreq(f_cpu),
                                                      mcu=mcu,
                                                      programmer=programmer,
                                                      )

    bunch.upload.using = programmer

    bunch.build.mcu = mcu
    bunch.build.f_cpu = str(f_cpu) + 'L'
    bunch.build.core = core

    install_board(board_id, bunch, replace_existing=replace_existing)
Пример #10
0
def install(
    board_id='atmega88',
    mcu='atmega88',
    f_cpu=20000000,
    upload='usbasp',
    core='arduino',
    replace_existing=True,
):
    """install atmega88 board."""

    board = AutoBunch()
    board.name = TEMPL.format(mcu=mcu, f_cpu=f_cpu, upload=upload)

    board.upload.using = upload
    board.upload.maximum_size = 8 * 1024

    board.build.mcu = mcu
    board.build.f_cpu = str(f_cpu) + 'L'
    board.build.core = core

    # for 1.0
    board.build.variant = 'standard'

    install_board(board_id, board, replace_existing=replace_existing)
Пример #11
0
def hwpacks():
    '''
        example::

{'Sanguino': {'sanguino': {'bootloader': {'extended_fuses': '0xFD',
                                          'file': 'ATmegaBOOT_644P.hex',
                                          'high_fuses': '0xDC',
                                          'lock_bits': '0x0F',
                                          'low_fuses': '0xFF',
                                          'path': 'atmega644p',
                                          'unlock_bits': '0x3F'},
                           'build': {'core': 'arduino',
                                     'f_cpu': '16000000L',
                                     'mcu': 'atmega644p'},
                           'name': 'Sanguino',
                           'upload': {'maximum_size': '63488',
                                      'protocol': 'stk500',
                                      'speed': '38400'}}},
 'arduino': {'atmega8': {'bootloader': {'file': 'ATmegaBOOT.hex',
                                        'high_fuses': '0xca',
                                        'lock_bits': '0x0F',
                                        'low_fuses': '0xdf',
                                        'path': 'atmega8',
                                        'unlock_bits': '0x3F'},
                         'build': {'core': 'arduino',
                                   'f_cpu': '16000000L',
                                   'mcu': 'atmega8'},
                         'name': 'Arduino NG or older w/ ATmega8',
                         'upload': {'maximum_size': '7168',
                                    'protocol': 'stk500',
                                    'speed': '19200'}},
             'uno': {'bootloader': {'extended_fuses': '0x05',
                                    'file': 'optiboot_atmega328.hex',
                                    'high_fuses': '0xde',
                                    'lock_bits': '0x0F',
                                    'low_fuses': '0xff',
                                    'path': 'optiboot',
                                    'unlock_bits': '0x3F'},
                     'build': {'core': 'arduino',
                               'f_cpu': '16000000L',
                               'mcu': 'atmega328p'},
                     'name': 'Arduino Uno',
                     'upload': {'maximum_size': '32256',
                                'protocol': 'stk500',
                                'speed': '115200'}}},
 'arduino-extras': {'arduino_amber128': {'bootloader': {'extended_fuses': '0xFF',
                                                        'file': 'stk500boot_v2_amber128.hex',
                                                        'high_fuses': '0xC8',
                                                        'lock_bits': '0x0F',
                                                        'low_fuses': '0x8F',
                                                        'path': 'atmega',
                                                        'unlock_bits': '0x3F'},
                                         'build': {'core': 'arduino',
                                                   'f_cpu': '14745600L',
                                                   'mcu': 'atmega128'},
                                         'name': 'Arduino-Amber 128 14.7456 Mhz',
                                         'upload': {'maximum_size': '122880',
                                                    'protocol': 'stk500v2',
                                                    'speed': '115200'}},
                       'stk525_647': {'build': {'core': 'arduino',
                                             'f_cpu': '8000000L',
                                             'mcu': 'at90usb647',
                                             'post_compile_script': 'teensy_post_compile'},
                                   'name': 'STK500 w/STK525 - at90usb647 (Arduino Core)',
                                   'upload': {'avrdude_wrapper': 'teensy_reboot',
                                              'disable_flushing': 'true',
                                              'maximum_size': '56000',
                                              'protocol': 'halfkay',
                                              'speed': '38400'}}}}
    '''
    bunch = AutoBunch()
    for x in hwpack_names():
        bunch[x] = boards(x)
    return bunch