Exemplo n.º 1
0
 def test_mapping_registration(self):
     self.assert_equal(0, self._app.get_num_mappings(), msg="Active application %s" % str(self._app))
     self._app.add_mappings([bbapp.create_mapping("M1", autoreg=False), bbapp.create_mapping("M2", autoreg=False)])
     self.assert_equal(2, self._app.get_num_mappings())
     self._app.create_mapping("M3"),
     self._app.create_mapping("M4")
     self.assert_equal(4, self._app.get_num_mappings())
Exemplo n.º 2
0
 def test_name(self):
   m = bbapp.create_mapping("M1", autoreg=False)
   self.assert_equal("M1", m.get_name())
Exemplo n.º 3
0
 def test_thread_registration(self):
   m = bbapp.create_mapping("M1", autoreg=False)
   m.register_threads([Thread("T1"), Thread("T2")])
   self.assert_equal(2, len(m.get_threads()))
Exemplo n.º 4
0
#!/usr/bin/env python
#
# http://www.bionicbunny.org/
# Copyright (c) 2013 Sladeware LLC

from bb import app as bbapp
from bb.app import Mapping, Thread, Port
from bb.app.hardware.devices.boards import P8X32A_QuickStartBoard
from bb.app.os.drivers.gpio import ButtonDriver

board = P8X32A_QuickStartBoard()
processor = board.get_processor()
sensor = bbapp.create_mapping(
  processor=processor,
  threads=[Thread("BLINKER", "blinker_runner", port=Port(10)),
           ButtonDriver("BUTTON_DRIVER", port=Port(10))]
)