コード例 #1
0
ファイル: CFsAdapter.cpp プロジェクト: pipi/cockpitsim
CFsAdapter::~CFsAdapter() {
	for(std::list<CAbstractOffsetFamily*>::iterator it =
			m_lstFamilies.begin(); it != m_lstFamilies.end(); it++) {
		if((*it) != NULL) {
			delete (*it);
		}
	}
	can_destroy();
	CConnector::destroyInstance();
}
コード例 #2
0
ファイル: epos.c プロジェクト: ptroja/libepos
void epos_destroy(epos_node_p node) {
  can_device_p can_dev = node->dev.can_dev;

  epos_control_destroy(&node->control);
  epos_gear_destroy(&node->gear);
  epos_motor_destroy(&node->motor);
  epos_sensor_destroy(&node->sensor);
  epos_input_destroy(&node->input);
  epos_device_destroy(&node->dev);

  if (!can_dev->num_references)
    can_destroy(can_dev);

  config_destroy(&node->config);
}
コード例 #3
0
ファイル: main.c プロジェクト: pipi/cockpitsim
void main() {
   unsigned char scan, ret;

   char plop[8];
   char plop2[8];
   char plop3[8];
   char plop4[8];
   char pouet[2];
   char ffxx[2]={0xff,0xff};
   int data0,data1,data,test;
   can_event_msg_t msg;
   int i,j,k;
   unsigned char buffer[5];

   k=1;
   for(i=0;i<16;i++){
		for(j=0;j<16;j++){
      	TAB[i][j]=k;
         k++;
      }
   }

	if(can_init(CAN_MASK, CAN_ID, CAN_BAUDRATE_1M) == 0) {
    	printf("CAN BUS init OK\n");
   } else {
   	printf("CAN BUS init FAILED\n");
      exit(1);
   }

   if(i2c_init() == 0) {
    	printf("I2C BUS init OK\n");
   } else {
    	printf("I2C BUS init FAILED\n");
      exit(1);
   }
   RTX_Install_Timer(&timer);
   RTX_Start_Timer(timerID);

   while(1){

  /* buffer[0]=0x00;
   buffer[1]=0xFF;
   buffer[2]=0xEF;
   buffer[3]=0xFF;
   buffer[4]=0xFF;
   i2c_write(0xC8,buffer,5);
   //buffer[0]=0x00;
   test=i2c_write(0xC8, buffer,1);
   getchar();
   test=i2c_read(0xc9,buffer,2);
   printf("  all 1---  ligne=  0x%04x",*(unsigned int*)buffer);

   buffer[0]=0x02;
   test=i2c_write(0xC8, buffer,1);
   getchar();
   test=i2c_read(0xc9,buffer,2);
   printf("  all 1---  collone=  0x%04x\n\n\n",*(unsigned int*)buffer);
       getchar();
    buffer[0]=0x00;
   buffer[1]=0x00;
   buffer[2]=0x00;
   buffer[3]=0x00;
   buffer[4]=0x00;
   i2c_write(0xC8,buffer,5);
   //buffer[0]=0x00;
   test=i2c_write(0xC8, buffer,1);
       getchar() ;
   test=i2c_read(0xc9,buffer,2);
   printf(" all 0 ---  ligne=  0x%04x",*(unsigned int*)buffer);

   buffer[0]=0x02;        
   test=i2c_write(0xC8, buffer,1);
   getchar();
   test=i2c_read(0xc9,buffer,2);
   getchar();
   printf("  all 0---  collone=  0x%04x\n",*(unsigned int*)buffer); */

       test=keyboard_decode(0xC9,TAB);
    //   if(test!=0){
        //	printf("\ntab=%d\n",test);
      // }
   }


    while(0){
        i2c_write(0xc8,plop,1);
    	  i2c_read(0xc9, plop2,2);
        //i2c_read(0xc9, plop3,2);

        printf("read new value= 0x%04x\n", *(unsigned int*) plop2);
    }

    while(1){

    	test=keyboard_decode(0xC8, TAB_Keyboard);
    	if(test!=0){
    		printf("touch detect = %d\n",test);
    	}


    }

     /*  I2C_receive_char(0xc9, &plop2[0], 1);
       I2C_receive_char(0xc9, &plop2[1], 1);
       I2C_receive_char(0xc9, &plop2[2], 1);
       I2C_receive_char(0xc9, &plop2[3], 0);
       printf("read new value= 0x%04x  0x%04x\n", *((unsigned int*)(plop2)), *((unsigned int*)(plop2+2)));
     */
      //sleep(1);
   //}


   i2c_destroy();
   can_destroy();

}