Пример #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 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)
Пример #3
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)
Пример #4
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)
Пример #5
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)
Пример #6
0
    def test_boards(self):
        d = tmpdir(suffix='_test')
        os.environ['ARDUINO_HOME'] = d
        boards_txt = d / 'hardware' / 'arduino' / 'boards.txt'

        boards_txt.parent.makedirs()

        boards_txt.write_text('')
        eq_(board_names(), [])
        check_keys(boards().keys(), [])

        # invalid board
        boards_txt.write_text('''
brd.x3=foo
        ''')
        eq_(board_names(), [])

        boards_txt.write_text('''
brd.name=foo
brd.build=foo
brd.x3=foo
        ''')
        eq_(board_names(), ['brd'])
        check_keys(boards().keys(), ['brd'])

        # invalid
        install_board('ardu', dict(x1='hi'))
        eq_(board_names(), ['brd'])

        install_board('ardu', dict(name='hi', build=1))
        eq_(set(board_names()), set(['brd', 'ardu']))

        install_board('ardu', dict(x1='hi'))
        eq_(set(board_names()), set(['brd', 'ardu']))

        remove_board('brd')
        eq_(board_names(), ['ardu'])