当前位置: 首页>>代码示例>>C++>>正文


C++ PT_INIT函数代码示例

本文整理汇总了C++中PT_INIT函数的典型用法代码示例。如果您正苦于以下问题:C++ PT_INIT函数的具体用法?C++ PT_INIT怎么用?C++ PT_INIT使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了PT_INIT函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: setup

void setup() {

	DDRD  |= 0b01000000;	// ������� ��������� 
	PORTD &= 0b10111111;	// ������� ���������

	DDRD  |= 0b00100000;	// ����� �������
	PORTD &= 0b11011111;	// ����� �������

	DDRD  |= 0b00010000;	// ��������� ��
	PORTD &= 0b11101111;	// ��������� ��


	DDRD  &= 0b11111011;	// ������
	PORTD |= 0b00000100;	// ������
  
	enableIROut(56);	
	enableIRIn();

	//���������� ��� ���� ISCxx
	//����������� �� ������������ INT0 �� ������� ������
	MCUCR &= ~( (1<<ISC11)|(1<<ISC10)|(1<<ISC01)|(1<<ISC00) );

	//��������� ������� ���������� INT0
	GICR |= (1<<INT0);
	//���������� ���� ����������� ���������� ����������

	PT_INIT(&ptIRReceive);
	PT_INIT(&ptWaitForTrigger);
	PT_INIT(&ptExplode);
	PT_INIT(&ptFinder);
	set_sleep_mode(SLEEP_MODE_PWR_DOWN);
  
  
} 
开发者ID:schernushenko,项目名称:lt_grenade,代码行数:34,代码来源:Grenade_19_05_new.cpp

示例2: MNT_init

void MNT_init(void)
{
	// init state machine
	STM_init(&MNT.stm, &init);

	// set the door pins direction
	CONE_DDR &= ~_BV(CONE_PIN);

	// init the cone state with its opposite value to generate the first event
	MNT.cone_state = ~(CONE & _BV(CONE_PIN));

	// init fifoes
	FIFO_init(&MNT.ev_fifo, MNT.ev_buf, NB_EVENTS, sizeof(mnt_event_t));
	FIFO_init(&MNT.cmds_fifo, MNT.cmds_buf, NB_CMDS, sizeof(frame_t));
	FIFO_init(&MNT.out_fifo, MNT.out_buf, NB_OUT_FR, sizeof(frame_t));

	// register to dispatcher
	MNT.interf.channel = 7;
	MNT.interf.cmde_mask = _CM(FR_TAKE_OFF) | _CM(FR_MINUT_TIME_OUT) | _CM(FR_STATE) | _CM(FR_APPLI_START);
	MNT.interf.queue = &MNT.cmds_fifo;
	DPT_register(&MNT.interf);

	// init threads
	PT_INIT(&MNT.pt_chk_time_out);
	PT_INIT(&MNT.pt_chk_cmds);
	PT_INIT(&MNT.pt_out);

	// prevent any time-out
	MNT.time_out = TIME_MAX;
	MNT.sampling_rate = SAMPLING_START;

	// the application start signal shall be received
	MNT.started = 0;
}
开发者ID:nnayo,项目名称:egere,代码行数:34,代码来源:minut.c

示例3: main

int main(int argc, char** argv) {
    PT_setup();
    
	// Enable multivector interrupts
    INTEnableSystemMultiVectoredInt();
	// Initialize threads
    PT_INIT(&pt_cap);
    
    
    PT_INIT(&pt_blink);
    PT_INIT(&pt_cap_read)
    
    //init the display
    tft_init_hw();
    tft_begin();
    tft_fillScreen(ILI9340_BLACK);
    
	// Set orientation of the display
    tft_setRotation(1);
	
	// Set up pins
    PerPinSetup();
    while(1){
        PT_SCHEDULE(protothread_blink(&pt_blink));
        PT_SCHEDULE(protothread_cap(&pt_cap));
        PT_SCHEDULE(protothread_cap_read(&pt_cap_read));
    }
  
}
开发者ID:fkummer,项目名称:4760,代码行数:29,代码来源:fakemain.c

示例4: main

void main(void) //using 0
{			   	
	EA = 0;
		
	PLLCON&=PLLCON_VAL;//настройка частоты процессора

	if(!BUTTON1)
	{
		SHOW_VOLTAGE=1;
	}
	
	Timer1_Initialize(); //таймер шедулера 200Гц
	
	ADC_Initialize();

	ChannelsInit();
	UART_Init();

	WDT_Init(WDT_250);//включить сторожевой таймер



	EA=1;
	PT_INIT(&pt_display);
	PT_INIT(&pt_led);
	PT_INIT(&pt_key);
	PT_INIT(&pt_blink);

 	if(!SHOW_VOLTAGE)
	{
	   if(skd.SKD_Set.SKD_Settings.diap_high>=100.0 || skd.SKD_Set.SKD_Settings.diap_low<-100.0) //передвигаем десятичную точку
	   {
	   		LED_SetPoint(INDICATOR_1,2);
	   }
	   else
	   {
	   		LED_SetPoint(INDICATOR_1,3);
	   }
		LED_Set_Brightness(INDICATOR_1,0);
		//LED_Out_Float(INDICATOR_1,0.0);
	}
	else
	{
		LED_SetPoint(INDICATOR_1,4);
		LED_Set_Brightness(INDICATOR_1,0);
		LED_Out_Float(INDICATOR_1,0.0);	
	}
	Protocol_Init();
	while(1)
	{		
		LED_Process(&pt_led);
		Display_Out_Process(&pt_display);
		Keyboard_Process(&pt_key);
		ProtoProcess(&pt_proto);
		LED_BlinkTask(&pt_blink);
		WDT_Clear();
	}
}
开发者ID:nowhard,项目名称:SKD_PT,代码行数:58,代码来源:debug.c

示例5: connect

/*---------------------------------------------------------------------------*/
static struct uip_conn *
connect(u16_t *host, u16_t port)
{
  PSOCK_INIT(&s.sin, s.inputbuf, sizeof(s.inputbuf));
  PSOCK_INIT(&s.sout, s.inputbuf, sizeof(s.inputbuf));
  PT_INIT(&s.inpt);
  PT_INIT(&s.outpt);
  return tcp_connect(host, uip_htons(port), NULL);
}
开发者ID:kincki,项目名称:contiki,代码行数:10,代码来源:cgterm.c

示例6: I2C_Init

void I2C_Init(void)
{
	I2CM=1;//ведущий
	PT_INIT(&pt_i2c_read_buf);//инициализация дочерних потоков
	PT_INIT(&pt_i2c_write_buf);
	PT_INIT(&pt_i2c_read_complete);

	return;
}
开发者ID:nowhard,项目名称:RVDT-DOL,代码行数:9,代码来源:i2c.c

示例7: psock_init

/*---------------------------------------------------------------------------*/
void
psock_init( struct psock *psock, uint8_t *buffer, uint16_t buffersize)
{
  psock->state = STATE_NONE;
  psock->readlen = 0;
  psock->bufptr = (uint8_t*)buffer;
  psock->bufsize = buffersize;
  buf_setup(&psock->buf, (uint8_t *)buffer, buffersize);
  PT_INIT(&psock->pt);
  PT_INIT(&psock->psockpt);
}
开发者ID:UNIVERSAL-IT-SYSTEMS,项目名称:avrfreertos,代码行数:12,代码来源:psock.c

示例8: setup

void setup() {

    Serial.begin(9600);
//    initalizeServos();
    initalizePWM();
//    initializeSD();
    initalizeOLED();
    initalizeMPU();
    PT_INIT(&pt1);
    PT_INIT(&pt2);
}
开发者ID:sammyboy45467,项目名称:omnius,代码行数:11,代码来源:main.cpp

示例9: psock_init

/*---------------------------------------------------------------------------*/
void
psock_init(register struct psock *psock, char *buffer, unsigned int buffersize)
{
  psock->state = STATE_NONE;
  psock->readlen = 0;
  psock->bufptr = buffer;
  psock->bufsize = buffersize;
  buf_setup(&psock->buf, (unsigned char*)buffer, buffersize);
  PT_INIT(&psock->pt);
  PT_INIT(&psock->psockpt);
}
开发者ID:BashfulBladder,项目名称:gargoyle,代码行数:12,代码来源:psock.cpp

示例10: psock_init

/*---------------------------------------------------------------------------*/
void
psock_init(struct psock *psock, u8 *buffer, u32 buffersize)
{
  psock->state = STATE_NONE;
  psock->readlen = 0;
  psock->bufptr = buffer;
  psock->bufsize = buffersize;
  buf_setup(&psock->buf, (u8 *)(buffer), buffersize);
  PT_INIT(&psock->pt);
  PT_INIT(&psock->psockpt);
}
开发者ID:cristi85,项目名称:uIP_ENC28J60,代码行数:12,代码来源:psock.c

示例11: BSC_init

// basic module initialization
void BSC_init(void)
{
	frame_t fr;

	// fifoes init
	FIFO_init(&BSC.in_fifo, &BSC.in_buf, NB_IN_FRAMES, sizeof(frame_t));
	FIFO_init(&BSC.out_fifo, &BSC.out_buf, NB_OUT_FRAMES, sizeof(frame_t));

	// thread init
	PT_INIT(&BSC.in_pt);
	PT_INIT(&BSC.out_pt);

	// reset time-out
	BSC.time_out = 0;
	BSC.is_running = FALSE;

	// register own call-back for specific commands
	BSC.interf.channel = 0;
	BSC.interf.cmde_mask = _CM(FR_NO_CMDE)
				| _CM(FR_RAM_READ)
				| _CM(FR_RAM_WRITE)
				| _CM(FR_EEP_READ)
				| _CM(FR_EEP_WRITE)
				| _CM(FR_FLH_READ)
				| _CM(FR_FLH_WRITE)
				| _CM(FR_SPI_READ)
				| _CM(FR_SPI_WRITE)
				| _CM(FR_WAIT)
				| _CM(FR_CONTAINER);
	BSC.interf.queue = &BSC.in_fifo;
	DPT_register(&BSC.interf);

	// drivers init
	SLP_init();
	EEP_init();
	SPI_init(SPI_MASTER, SPI_THREE, SPI_MSB, SPI_DIV_16);

	// read reset frame
	EEP_read(0x00, (u8*)&fr, sizeof(frame_t));
	while ( ! EEP_is_fini() )
		;

	// check if the frame is valid
	if ( fr.dest == 0xff || fr.orig == 0xff || fr.cmde == 0xff || fr.status == 0xff ) {
		return;
	}

	// enqueue the reset frame
	FIFO_put(&BSC.out_fifo, &fr);

	// lock the dispatcher to be able to treat the frame
	DPT_lock(&BSC.interf);
}
开发者ID:nnayo,项目名称:scalp,代码行数:54,代码来源:basic.c

示例12: psock_init

/*---------------------------------------------------------------------------*/
void
psock_init(CC_REGISTER_ARG struct psock *psock,
	   uint8_t *buffer, unsigned int buffersize)
{
  psock->state = STATE_NONE;
  psock->readlen = 0;
  psock->bufptr = buffer;
  psock->bufsize = buffersize;
  buf_setup(&psock->buf, buffer, buffersize);
  PT_INIT(&psock->pt);
  PT_INIT(&psock->psockpt);
}
开发者ID:DIYzzuzpb,项目名称:contiki-mplabx,代码行数:13,代码来源:psock.c

示例13: main

int main(void)
{

  // === config the uart, DMA, SPI ===========
  PT_setup();

  // == SPI ==
  //enable SPI at 10 MHz clock to meet digital potentiometer specifications
  SpiChnOpen(spiChn, SPI_OPEN_ON | SPI_OPEN_MODE16 | SPI_OPEN_MSTEN | SPI_OPEN_CKE_REV , spiClkDiv);
  
  // === setup system wide interrupts  ====================
  INTEnableSystemMultiVectoredInt();
    
  // === set up i/o port pin ===============================
  //Port B bits, 3,7,8, and 9 are used to select digital output
  //Port B bit 4 is used as chip select for treble digital potentiometer
  //Port B bit 13 is used as a select signal for output effect selection multiplexer
  //Additional functionality would use the TFT to display which output was being
  //selected
  mPORTBSetPinsDigitalOut(BIT_4 | BIT_3|BIT_7 | BIT_8 | BIT_9 |BIT_13);    //Set port as output
 
  //Port A Bits 0,2,and 3 are used to configure digital potentiometers (chip selects). Port A bit 4 is used
  //for multiplexing whether to have input from Digital effector chip, distortion,
  //or pure tonestack sound
  mPORTASetPinsDigitalOut(BIT_0 | BIT_2 | BIT_3 | BIT_4);
  // === now the threads ===================================
  
  // init the threads
  PT_INIT(&pt_cmd);
  PT_INIT(&pt_time);
  
  //==Digipot spi stuff
   // SCK2 is pin 26 
    // SDO1 (MOSI) is in PPS output group 1, could be connected to RB5 which is pin 14
    PPSOutput(2, RPB5, SDO1);
    // control CS for DAC
    //mPORTBSetPinsDigitalOut(BIT_4); //CS
    mPORTBSetBits(BIT_4 | BIT_6);
    //===
    
    mPORTASetBits(BIT_0 | BIT_2 | BIT_3 | BIT_4); //CS pins active high
    mPORTAClearBits(BIT_4);
    mPORTBClearBits(BIT_13);
    mPORTBSetBits(BIT_13);
    
    
  // schedule the threads
  while(1) {
      //cmd used as command center for all effects
    PT_SCHEDULE(protothread_cmd(&pt_cmd));
  }
} // main
开发者ID:SamirDurvasula,项目名称:GuitarAmp,代码行数:52,代码来源:TFT_ADC_read.c

示例14: main

int main(void)
{
  // === config the uart, DMA, vref, timer5 ISR =============
  PT_setup();

   // === setup system wide interrupts  ====================
  INTEnableSystemMultiVectoredInt();
    
  // === set up i/o port pin ===============
  mPORTASetBits(BIT_0 | BIT_1 );	//Clear bits to ensure light is off.
  mPORTASetPinsDigitalOut(BIT_0 | BIT_1 );    //Set port as output
  mPORTBSetBits(BIT_0 );	//Clear bits to ensure light is off.
  mPORTBSetPinsDigitalOut(BIT_0 );    //Set port as output

  // === now the threads ====================
  // init  the thread control semaphores
  PT_SEM_INIT(&control_t1, 0); // start blocked
  PT_SEM_INIT(&control_t2, 1); // start unblocked
  PT_SEM_INIT(&send_sem, 1); // start with ready to send

  // init the threads
  PT_INIT(&pt1);
  PT_INIT(&pt2);
  PT_INIT(&pt3);
  PT_INIT(&pt4);
  PT_INIT(&pt5);

  // init the optional rate scheduler
  PT_RATE_INIT();

  // schedule the threads
  while(1) {
    PT_RATE_LOOP(); // not necessary if you use PT_SCHEDULE
    PT_RATE_SCHEDULE(protothread1(&pt1), t1_rate);
    if (run_t4) PT_RATE_SCHEDULE(protothread4(&pt4), t4_rate); //run always
    PT_RATE_SCHEDULE(protothread2(&pt2), t1_rate);
    if (cmd[0] != 'k') PT_RATE_SCHEDULE(protothread3(&pt3),t3_rate);
    PT_SCHEDULE(protothread5(&pt5));

     /*
    // alternate scheme
    PT_SCHEDULE(protothread1(&pt1));
    if (run_t4) PT_SCHEDULE(protothread4(&pt4));
   PT_SCHEDULE(protothread2(&pt2));
    if (run_t4) PT_SCHEDULE(protothread4(&pt4));
    if (cmd[0] != 'k') PT_SCHEDULE(protothread3(&pt3));
     */
  }
} // main
开发者ID:CornellMarsRover,项目名称:CMR_PIC32_code,代码行数:49,代码来源:Schedule_uart_demo.c

示例15: PROCESS_THREAD

PROCESS_THREAD(ieee_process, ev, data)
{
  static void (*ieee_mlmehandler)(MAC_MlmeDcfmInd_s*);
  static void (*ieee_mcpshandler)(MAC_McpsDcfmInd_s*);

  PROCESS_BEGIN();
  PUTS("ieee_process: starting\n");

  ieee_init();
  ieee_serial_init();

  PT_INIT(&ieee_mlme); ieee_mlmehandler = ieee_mlmept;
  PT_INIT(&ieee_mcps); ieee_mcpshandler = ieee_mcpspt;

  /* start the mlme thread by requesting a scan. */
  req_scan(MAC_MLME_SCAN_TYPE_ACTIVE,0);

  PUTS("ieee_process: started\n");

  /* run until this process is exiting */
  while(true)
  {
    size_t i;
    MAC_DcfmIndHdr_s *macev;

    for(i=0; i<RX_QUEUE_SIZE && (macev=rxq_peek())!=NULL; i++)
    {
      if(rxq_peektype()==MLME) {
        //ieee_serial_mlme((MAC_MlmeDcfmInd_s*) macev);
        ieee_mlmehandler((MAC_MlmeDcfmInd_s*) macev);
      }
      else if(rxq_peektype()==MCPS) {
        //ieee_serial_mcps((MAC_McpsDcfmInd_s*) macev);
        ieee_mcpshandler((MAC_McpsDcfmInd_s*) macev);
      }

      rxq_dequeue();
    }

    if (ev==ieee_event && data == IEEE_STARTED)
      ieee_started = true;

    PROCESS_YIELD();
  }

  PUTS("ieee_process: exiting\n");
  PROCESS_END();
}
开发者ID:hopfgarten,项目名称:contiki-jn51xx,代码行数:48,代码来源:ieee802.c


注:本文中的PT_INIT函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。