Example #1
0
int main()
{
	SysCtlClockSet(SYSCTL_SYSDIV_2_5|SYSCTL_USE_PLL|SYSCTL_XTAL_16MHZ|SYSCTL_OSC_MAIN);

	SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOB);
	SysCtlPeripheralEnable(SYSCTL_PERIPH_SSI2);
	GPIOPinConfigure(GPIO_PB4_SSI2CLK);
	GPIOPinConfigure(GPIO_PB7_SSI2TX);
	GPIOPinTypeSSI(GPIO_PORTB_BASE,GPIO_PIN_4|GPIO_PIN_7);
	SSIConfigSetExpClk(SSI2_BASE,SysCtlClockGet(),SSI_FRF_MOTO_MODE_0,SSI_MODE_MASTER,2000000,8);
	SSIEnable(SSI2_BASE);

	SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOA);
	GPIOPinTypeGPIOOutput(GPIO_PORTA_BASE, GPIO_PIN_2|GPIO_PIN_3);
	GPIOPinWrite(GPIO_PORTA_BASE,GPIO_PIN_2,0);
	GPIOPinWrite(GPIO_PORTA_BASE,GPIO_PIN_3,0);

	GPIOPinTypeGPIOOutput(GPIO_PORTB_BASE, GPIO_PIN_6);
	GPIOPinWrite(GPIO_PORTB_BASE,GPIO_PIN_6,0);

	while(1)
	{
		SSIDataPut(SSI2_BASE,0xAA);
		latch();
		SysCtlDelay(SysCtlClockGet()/10);

		SSIDataPut(SSI2_BASE,0x55);
		latch();
		SysCtlDelay(SysCtlClockGet()/10);
	}
}
void max7221::put( byte reg, byte data )
{
	/*
	 * Updates one register of our chip by first selecting the register byte reg
	 * and then putting the data byte data and switching the LOAD pin once.
	 */
	latch(0);
	putByte( reg );
	putByte( data );
	noOp(_chipselect);
	latch(1);
}
Example #3
0
::testing::AssertionResult AwaitAssertAbandoned(
    const char* expr,
    const char*, // Unused string representation of 'duration'.
    const process::Future<T>& actual,
    const Duration& duration)
{
  process::Owned<process::Latch> latch(new process::Latch());

  actual.onAny([=]() { latch->trigger(); });
  actual.onAbandoned([=]() { latch->trigger(); });

  if (!latch->await(duration)) {
    return ::testing::AssertionFailure()
      << "Failed to wait " << duration << " for " << expr;
  } else if (actual.isDiscarded()) {
    return ::testing::AssertionFailure()
      << expr << " was discarded";
  } else if (actual.isReady()) {
    return ::testing::AssertionFailure()
      << expr << " is ready (" << ::testing::PrintToString(actual.get()) << ")";
  } else if (actual.isFailed()) {
    return ::testing::AssertionFailure()
      << "(" << expr << ").failure(): " << actual.failure();
  }

  CHECK_ABANDONED(actual);

  return ::testing::AssertionSuccess();
}
// write the values stored in ledStatus to the cube, ideally this method should
// be called atleast once every millisecond for multiplexing to give a smooth
// image and avoid flickering.
// displays 1 layer at a time at a high frequency to give a smooth image.
void CubeInterface::writeCube()
{
  // 9th shift register controls cathodes
  for(byte i = 0; i < 8; i++)
  {
    if(CATHODE_PINS[i] == currentLayer)
      highBit();
    else
      lowBit();
  } // for

  // first 8 shift registers control anodes
  for(byte i = 0; i < 64; i++)
    if(ledStatus[ANODE_PINS[i][0]]
                [ANODE_PINS[i][1]]
                [currentLayer] == HIGH)
      highBit();
    else
      lowBit();

  if(currentLayer < 7)
    currentLayer++;
  else
    currentLayer = 0;

  latch();
} // writeCube
Example #5
0
void HL1606::setAll(unsigned char command) {
  unsigned int a;
  for(a = 0; a < _LEDCount; a++) {
    sendByte(command);
  }
  latch();   
}
Example #6
0
 void write(const VALUE& value, uint8_t bits) const
 {
     static_assert(std::is_scalar<VALUE>::value, "need scalar type");
     static_assert(bits > sizeof(value)*8, "bits exceed value type's size");
     
     latch(false);
     VALUE mask;
     if (m_direction == DIRECTION::LSBFIRST) mask = 1;
     else mask = 1 << (bits - 1);
     for (uint8_t b = 0; b < bits; ++b){
         write1(value & mask);
         if (m_direction == DIRECTION::LSBFIRST) mask <<= 1;
         else mask >>= 1;
     }
     latch(true);
 }
Example #7
0
void HL1606::setOne(unsigned int led, unsigned char command, unsigned char background) {
  unsigned int a;
  for(a = led+1; a < _LEDCount; a++) sendByte(background);
  sendByte(command);
  for(a = 0; a < led; a++) sendByte(background);
  latch();     
}
Example #8
0
GFXDECODE_END


void gomoku_state::gomoku(machine_config &config)
{
	/* basic machine hardware */
	Z80(config, m_maincpu, XTAL(18'432'000)/12);      /* 1.536 MHz ? */
	m_maincpu->set_addrmap(AS_PROGRAM, &gomoku_state::gomoku_map);
	m_maincpu->set_vblank_int("screen", FUNC(gomoku_state::irq0_line_hold));

	ls259_device &latch(LS259(config, "latch")); // 7J
	latch.q_out_cb<1>().set(FUNC(gomoku_state::flipscreen_w));
	latch.q_out_cb<2>().set(FUNC(gomoku_state::bg_dispsw_w));
	latch.q_out_cb<7>().set_nop(); // start LED?

	/* video hardware */
	SCREEN(config, m_screen, SCREEN_TYPE_RASTER);
	m_screen->set_refresh_hz(60);
	m_screen->set_vblank_time(ATTOSECONDS_IN_USEC(0));
	m_screen->set_size(256, 256);
	m_screen->set_visarea(0, 256-1, 16, 256-16-1);
	m_screen->set_screen_update(FUNC(gomoku_state::screen_update_gomoku));
	m_screen->set_palette("palette");

	GFXDECODE(config, m_gfxdecode, "palette", gfx_gomoku);
	PALETTE(config, "palette", FUNC(gomoku_state::gomoku_palette), 64);

	/* sound hardware */
	SPEAKER(config, "mono").front_center();

	GOMOKU_SOUND(config, "gomoku").add_route(ALL_OUTPUTS, "mono", 1.0);
}
Example #9
0
TEST_F(RingBufferTest, shouldPreventPublishersOvertakingEventProcessorWrapPoint) {
  const int ringBufferSize = 4;
  CountDownLatch latch(ringBufferSize);
  std::atomic_bool publisherComplete(false);
  MultiThreadedClaimStrategy claimStrategy(ringBufferSize);
  BlockingWaitStrategy waitStrategy;
  RingBuffer<StubEvent> ringBuffer(claimStrategy, waitStrategy);

  std::unique_ptr<SequenceBarrier> sequenceBarrier = ringBuffer.newBarrier({});

  TestEventProcessor processor(*sequenceBarrier);
  ringBuffer.setGatingSequences({ &processor.getSequence() });
  std::thread thread([&] {
      for (int i = 0; i <= ringBufferSize; i++) {
        long sequence = ringBuffer.next();
        StubEvent& event = ringBuffer.get(sequence);
        event.setValue(i);
        ringBuffer.publish(sequence);
        latch.countDown();
      }

      publisherComplete.store(true);
    });

  latch.await();
  EXPECT_EQ((long)ringBuffer.getCursor(), (long)(ringBufferSize - 1));
  ASSERT_FALSE(publisherComplete.load());

  processor();
  thread.join();

  ASSERT_TRUE(publisherComplete.load());
}
static void updateReport()
{	
	latch(CD4021BE_LATCH_PIN);
	
	currentState.buttons0 = shiftIn(CD4021BE_DATA_PIN, CD4021BE_CLOCK_PIN);
	currentState.buttons1 = shiftIn(CD4021BE_DATA_PIN, CD4021BE_CLOCK_PIN);
	currentState.buttons2 = ~PINB & 0x1f /*00011111 = PB0-PB4*/ | (currentState.buttons2 & 0xe0); /*11100000 = REL0 RER0 REL1*/
	// currentState.buttons3 = RER1 REL2 RER2 REL3 RER3 REL4 RER4
	
	uint8_t change0 = currentState.buttons0 ^ previousState.buttons0;
	uint8_t change1 = currentState.buttons1 ^ previousState.buttons1;
	uint8_t change2 = (currentState.buttons2 & 0x1f) | ( (currentState.buttons2 ^ previousState.buttons2) & 0xe0 );
	uint8_t change3 = currentState.buttons3 ^ previousState.buttons3;
	
	memcpy(&previousState, &currentState, sizeof(gamepad_report_t));
	
	for (uint8_t i = 0; i < CHANGE_BUFFER_LENGTH; i++)
	{
		changeBuffer[i].buttons0 |= change0;
		changeBuffer[i].buttons1 |= change1;
		changeBuffer[i].buttons2 |= change2;
		changeBuffer[i].buttons3 |= change3;
	}
	
	memcpy(&gamepad_report, &changeBuffer[changeBufferIndex], sizeof(gamepad_report_t));
	
	changeBuffer[changeBufferIndex].buttons0 = 0;
	changeBuffer[changeBufferIndex].buttons1 = 0;
	changeBuffer[changeBufferIndex].buttons2 = 0;
	changeBuffer[changeBufferIndex].buttons3 = 0;
	
	changeBufferIndex++;
	changeBufferIndex %= CHANGE_BUFFER_LENGTH;
}
TEST(CountDownLatchTest, testCountDownMethod) {
  CountDownLatch latch(2);
  latch.countDown();

  // countDown should decrement the value
  EXPECT_EQ(latch.getCount(), static_cast<sp_uint32>(1));
}
Example #12
0
// Write all 512 channel values to the pending packet and latch
//
DMX_STATUS AbstractDMXDriver::write_all( BYTE *dmx_512 ) {
    CSingleLock lock( &m_write_mutex, TRUE );

    memcpy( &m_pending_packet[1], dmx_512, DMX_PACKET_SIZE );

    return latch();
}
Example #13
0
void airbear::heart(){
  if(digitalRead(heartpin)==1){
    vs1053.playFullFile("Sounds/confirm.mp3");
    latch("hrtp");
    MqttBlock(5000);//Force mqtt to wait until received message TODO add timeout
    inbox();
  }//end if
}//endfunction
Example #14
0
int main()
{
	MutexLock mutex;

	CountDownLatch latch(5);

	return 0;
}
Example #15
0
/*************************************
 *
 *  Graphics definitions
 *
 *************************************/

static const gfx_layout playfield_layout =
{
	8,8,
	256,
	1,
	{ 0 },
	{ 0, 1, 2, 3, 4, 5, 6, 7 },
	{ 0, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8 },
	8*8
};


static const gfx_layout motion_layout =
{
	16,16,
	64,
	1,
	{ 0 },
	{ 3 + 0x400*8, 2 + 0x400*8, 1 + 0x400*8, 0 + 0x400*8,
		7 + 0x400*8, 6 + 0x400*8, 5 + 0x400*8, 4 + 0x400*8,
		3, 2, 1, 0, 7, 6, 5, 4 },
	{ 0, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8,
		8*8, 9*8, 10*8, 11*8, 12*8, 13*8, 14*8, 15*8 },
	16*8
};


static GFXDECODE_START( gfx_subs )
	GFXDECODE_ENTRY( "gfx1", 0, playfield_layout, 0, 2 )    /* playfield graphics */
	GFXDECODE_ENTRY( "gfx2", 0, motion_layout,    0, 2 )    /* motion graphics */
GFXDECODE_END


/*************************************
 *
 *  Machine driver
 *
 *************************************/

void subs_state::subs(machine_config &config)
{
	/* basic machine hardware */
	M6502(config, m_maincpu, 12096000/16);      /* clock input is the "4H" signal */
	m_maincpu->set_addrmap(AS_PROGRAM, &subs_state::main_map);
	m_maincpu->set_periodic_int(FUNC(subs_state::interrupt), attotime::from_hz(4*57));


	/* video hardware */
	GFXDECODE(config, m_gfxdecode, m_palette, gfx_subs);

	PALETTE(config, m_palette, FUNC(subs_state::subs_palette), 4);

	config.set_default_layout(layout_dualhsxs);

	screen_device &lscreen(SCREEN(config, "lscreen", SCREEN_TYPE_RASTER));
	lscreen.set_refresh_hz(57);
	lscreen.set_vblank_time(ATTOSECONDS_IN_USEC(2500) /* not accurate */);
	lscreen.set_size(32*8, 32*8);
	lscreen.set_visarea(0*8, 32*8-1, 0*8, 28*8-1);
	lscreen.set_screen_update(FUNC(subs_state::screen_update_left));
	lscreen.set_palette(m_palette);

	screen_device &rscreen(SCREEN(config, "rscreen", SCREEN_TYPE_RASTER));
	rscreen.set_refresh_hz(57);
	rscreen.set_vblank_time(ATTOSECONDS_IN_USEC(2500) /* not accurate */);
	rscreen.set_size(32*8, 32*8);
	rscreen.set_visarea(0*8, 32*8-1, 0*8, 28*8-1);
	rscreen.set_screen_update(FUNC(subs_state::screen_update_right));
	rscreen.set_palette(m_palette);


	/* sound hardware */
	SPEAKER(config, "lspeaker").front_left();
	SPEAKER(config, "rspeaker").front_right();

	DISCRETE(config, m_discrete, subs_discrete).add_route(0, "lspeaker", 1.0).add_route(1, "rspeaker", 1.0);

	ls259_device &latch(LS259(config, "latch")); // C9
	latch.q_out_cb<0>().set_output("led0").invert(); // START LAMP 1
	latch.q_out_cb<1>().set_output("led1").invert(); // START LAMP 2
	latch.q_out_cb<2>().set(m_discrete, FUNC(discrete_device::write_line<SUBS_SONAR2_EN>));
	latch.q_out_cb<3>().set(m_discrete, FUNC(discrete_device::write_line<SUBS_SONAR1_EN>));
	// Schematics show crash and explode reversed.  But this is proper.
	latch.q_out_cb<4>().set(m_discrete, FUNC(discrete_device::write_line<SUBS_EXPLODE_EN>));
	latch.q_out_cb<5>().set(m_discrete, FUNC(discrete_device::write_line<SUBS_CRASH_EN>));
	latch.q_out_cb<6>().set(FUNC(subs_state::invert1_w));
	latch.q_out_cb<7>().set(FUNC(subs_state::invert2_w));
}
TEST(CountDownLatchTest, testWaitMethod1) {
  CountDownLatch latch(2);

  std::thread t1(testWaitFuncTrue, std::ref(latch));
  latch.countDown();

  // the wait method should see the countDown and release the blocked thread
  t1.join();
  EXPECT_EQ(latch.getCount(), static_cast<sp_uint32>(1));
}
TEST(CountDownLatchTest, testWaitMethod2) {
  CountDownLatch latch(2);

  std::thread t1(testWaitFuncFalse, std::ref(latch));
  std::this_thread::sleep_for(std::chrono::seconds(2));
  latch.countDown();

  // the wait method should see the countDown and release the blocked thread
  t1.join();
  EXPECT_EQ(latch.getCount(), static_cast<sp_uint32>(1));
}
TEST_F(CountdownLatchTest, TwoThreadsWaitLatchAlreadyZero) {
   CountdownLatch latch(1);
   latch.countDown();

   auto futureOne = std::async(std::launch::async, WaitLatch, std::ref(latch));
   auto futureTwo = std::async(std::launch::async, WaitLatch, std::ref(latch));

   ASSERT_EQ(std::future_status::ready, futureOne.wait_for(std::chrono::seconds(1)));
   ASSERT_EQ(std::future_status::ready, futureTwo.wait_for(std::chrono::seconds(1)));

}
TEST(CountDownLatchTest, testWaitNotifyWithTwoThreads) {
  CountDownLatch latch(1);

  std::thread t1(testWaitFunc, std::ref(latch));
  std::thread t2(testCountDownFunc, std::ref(latch));

  t2.join();
  t1.join();

  // If the test reached here, then it has passed
  EXPECT_EQ(latch.getCount(), static_cast<sp_uint32>(0));
}
static int aml_m1_codec_mute(struct snd_soc_dai *dai, int mute)
{
	struct snd_soc_codec *codec = dai->codec;
	u16 reg;

	reg = snd_soc_read(codec, ADAC_MUTE_CTRL_REG1);
	if(mute){
		reg |= 3|(3<<6);    /* mute hs and ls*/
	}
	else{
		reg &= ~(3|(3<<6));
	}
	snd_soc_write(codec, ADAC_MUTE_CTRL_REG1, reg);

	snd_soc_write(codec, ADAC_RESET, (0<<1));
    latch(codec);
	snd_soc_write(codec, ADAC_RESET, (1<<1));
    latch(codec);

	return 0;
}
Example #21
0
void mc1000_state::mc1000(machine_config &config)
{
	/* basic machine hardware */
	Z80(config, m_maincpu, 3579545);
	m_maincpu->set_addrmap(AS_PROGRAM, &mc1000_state::mc1000_mem);
	m_maincpu->set_addrmap(AS_OPCODES, &mc1000_state::mc1000_banking_mem);
	m_maincpu->set_addrmap(AS_IO, &mc1000_state::mc1000_io);

	/* timers */
	timer_device &ne555clear(TIMER(config, "ne555clear"));
	ne555clear.configure_periodic(FUNC(mc1000_state::ne555_tick), attotime::from_hz(MC1000_NE555_FREQ));
	ne555clear.config_param(CLEAR_LINE);

	timer_device &ne555assert(TIMER(config, "ne555assert"));
	ne555assert.configure_periodic(FUNC(mc1000_state::ne555_tick), attotime::from_hz(MC1000_NE555_FREQ));
	ne555assert.set_start_delay(attotime::from_hz(MC1000_NE555_FREQ * 100 / MC1000_NE555_DUTY_CYCLE));
	ne555assert.config_param(ASSERT_LINE);

	/* video hardware */
	SCREEN(config, SCREEN_TAG, SCREEN_TYPE_RASTER);

	MC6847_NTSC(config, m_vdg, XTAL(3'579'545));
	m_vdg->hsync_wr_callback().set(FUNC(mc1000_state::hs_w));
	m_vdg->fsync_wr_callback().set(FUNC(mc1000_state::fs_w));
	m_vdg->input_callback().set(FUNC(mc1000_state::videoram_r));
	m_vdg->set_screen(SCREEN_TAG);

	/* sound hardware */
	SPEAKER(config, "mono").front_center();
	ay8910_device &ay8910(AY8910(config, AY8910_TAG, 3579545/2));
	ay8910.set_flags(AY8910_SINGLE_OUTPUT);
	ay8910.set_resistors_load(RES_K(2.2), 0, 0);
	ay8910.port_b_read_callback().set(FUNC(mc1000_state::keydata_r));
	ay8910.port_a_write_callback().set(FUNC(mc1000_state::keylatch_w));
	ay8910.add_route(ALL_OUTPUTS, "mono", 0.25);

	/* devices */
	CASSETTE(config, m_cassette);
	m_cassette->set_default_state(CASSETTE_STOPPED | CASSETTE_MOTOR_ENABLED | CASSETTE_SPEAKER_ENABLED);
	m_cassette->set_interface("mc1000_cass");

	SOFTWARE_LIST(config, "cass_list").set_original("mc1000_cass");

	CENTRONICS(config, m_centronics, centronics_devices, "printer");
	m_centronics->busy_handler().set(FUNC(mc1000_state::write_centronics_busy));

	output_latch_device &latch(OUTPUT_LATCH(config, "cent_data_out"));
	m_centronics->set_output_latch(latch);

	/* internal ram */
	RAM(config, RAM_TAG).set_default_size("16K").set_extra_options("48K");
}
 TEST_F(RawPointerTxnMultiMapTest, testPutGetRemove) {
     MultiMap<std::string, std::string> mm = client->getMultiMap<std::string, std::string >("testPutGetRemove");
     int n = 10;
     util::CountDownLatch latch(n);
     std::vector<util::Thread*> threads(n);
     for (int i = 0; i < n; i++) {
         threads[i] = new util::Thread(putGetRemoveTestThread, &mm, client, &latch);
     }
     ASSERT_TRUE(latch.await(1));
     for (int i = 0; i < n; i++) {
         delete threads[i] ;
     }
 }
TEST_F(CountdownLatchTest, OneThreadsWaitLatchOfTwo) {
   CountdownLatch latch(2);
   auto futureOne = std::async(std::launch::async, WaitLatch, std::ref(latch));

   ASSERT_EQ(std::future_status::timeout, futureOne.wait_for(std::chrono::milliseconds(100)));

   latch.countDown();

   ASSERT_EQ(std::future_status::timeout, futureOne.wait_for(std::chrono::milliseconds(100)));

   latch.countDown();

   ASSERT_EQ(std::future_status::ready, futureOne.wait_for(std::chrono::seconds(1)));
}
// Same test as above, but coundDown is called before wait
TEST(CountDownLatchTest, testWaitNotifyWithTwoThreads2) {
  CountDownLatch latch(1);
  std::thread t2(testCountDownFunc, std::ref(latch));

  // ensures that countdown is called first
  t2.join();

  // the wait thread should not block at this point
  std::thread t1(testWaitFunc, std::ref(latch));
  t1.join();

  // If the test reached here, then it has passed
  EXPECT_EQ(latch.getCount(), static_cast<sp_uint32>(0));
}
Example #25
0
File: tlc5916.c Project: smeyel/M2
//init-eli a változókat, a GPIO-kat, kikapcsolja az összes LED-et, majd engedélyezi a meghajtást
static void init(void){

	int i;
	
	gpio_init();

	for(i=DRIVER_COUNT ; i-- > 0 ; )
		data[i] = 0;
	send();

	latch();
	CLR_nOE();

}
Example #26
0
void airbear::circle(){
  if(digitalRead(circlepin)==1){
  Serial.println("working3");
  vs1053.playFullFile("Sounds/close.mp3");
  char* req = (char*)malloc(strlen("cloud")+8);// TODO change to 'new' function (memory alloc)
  strcpy(req,"sd?*cloud,4");
  Serial.println(req);
  latch(req); // Ask server for the file data
  MqttBlock(7000);//TODO add a mqtt block statement
  free(req);
  delay(1000);
  refresh();
}
}
TEST_F(CountdownLatchTest, OneThreadsWaitForLatchOfTwo) {
   CountdownLatch latch(2);

   auto futureFirst = std::async(std::launch::async, WaitForLatch, std::ref(latch), std::chrono::milliseconds(100));
   ASSERT_FALSE(futureFirst.get());

   auto futureSecond = std::async(std::launch::async, WaitForLatch, std::ref(latch), std::chrono::milliseconds(100));
   latch.countDown();
   ASSERT_FALSE(futureSecond.get());

   auto futureThird = std::async(std::launch::async, WaitForLatch, std::ref(latch), std::chrono::milliseconds(100));
   latch.countDown();
   ASSERT_TRUE(futureThird.get());
}
static int aml_m1_codec_hw_params(struct snd_pcm_substream *substream,
			    struct snd_pcm_hw_params *params,
			    struct snd_soc_dai *dai)
{
	struct snd_soc_pcm_runtime *rtd = substream->private_data;
	struct snd_soc_device *socdev = rtd->socdev;
	struct snd_soc_codec *codec = socdev->card->codec;
	//struct aml_m1_codec_priv *aml = codec->private_data;
    u16 reg, val;
    
    switch(params_rate(params)){
      case 8000:    val=0;  break;
      case 11025:   val=1;  break;
      case 12000:   val=2;  break;
      case 16000:   val=3;  break;
      case 22050:   val=4;  break;
      case 24000:   val=5;  break;
      case 32000:   val=6;  break;
      case 44100:   val=7;  break;
      case 48000:   val=8;  break;
      case 88200:   val=9;  break;
      case 96000:   val=10; break;
      case 19200:   val=11; break;
      default:  val=8; break;
    }
    reg = snd_soc_read(codec, ADAC_I2S_CONFIG_REG1);
    reg &= ~0xf;
    reg |= val;
    snd_soc_write(codec, ADAC_I2S_CONFIG_REG1, reg);

    snd_soc_write(codec, ADAC_RESET, (0<<1));
    latch(codec);
	snd_soc_write(codec, ADAC_RESET, (1<<1));
    latch(codec);

	return 0;
}
            TEST_F(ClientSetTest, testListener) {
                util::CountDownLatch latch(6);

                MySetItemListener listener(latch);
                std::string registrationId = set->addItemListener(listener, true);

                for (int i = 0; i < 5; i++) {
                    set->add(std::string("item") + util::IOUtil::to_string(i));
                }
                set->add("done");

                ASSERT_TRUE(latch.await(20 ));

                ASSERT_TRUE(set->removeItemListener(registrationId));
            }
Example #30
0
void shift_sequence()
{
    _latch = FALSE;
    _delay_ms(1);
    
    SETBIT(PORTB, SERIAL_OUT);
    for (uint8_t i = 0; i < 32; i++) {
		push_sequence(i, seq.buttons[cycle/3]);
		
		_delay_us(1);
    }
    
    CLRBIT(PORTB, SERIAL_OUT);
    latch();
    SETBIT(PORTB, OVERRIDE);
}