コード例 #1
0
ファイル: user_main.c プロジェクト: waitig/GasSub_LPC1788
/**
 * FMB_Poll_Task
 *
 * @param   none
 * @return  none
 *
 * @brief   FMB_Poll_Task
 */
void FMB_Poll_Task(void *arg)
{
		printf("RS485_Init ERRORCode = %d\n",eMBMasterInit(MB_RTU,RS485_1,1200,MB_PAR_ODD));
		printf("RS485_Enable ERRORCode = %d\n",eMBMasterEnable());
		while(1)
		{
			printf("RS485_Poll ERRORCode = %d\n",eMBMasterPoll());
			OSTimeDly(500);
		}
}
コード例 #2
0
ファイル: main.c プロジェクト: avr-master/M-02-15003
__noreturn main()
{
  RCC_Config();
  //I2C_Enable();
  SPI_Enable();
  GPIO_Enable();
  //ADC_Enable();
  
  MTouchInit();
  
  MTouchSetSensor(0, CH0_TRIS, CH0_LAT, CH0_IO_BIT, CH0_AN_NUM, -1, -1, -1,OUT_CH0_MODER,IN_CH0_MODER,AN_CH0_MODER);// sensor #0	
  MTouchSetSensor(1, CH1_TRIS, CH1_LAT, CH1_IO_BIT, CH1_AN_NUM, -1, -1, -1,OUT_CH1_MODER,IN_CH1_MODER,AN_CH1_MODER);// sensor #1	
  MTouchSetSensor(2, CH2_TRIS, CH2_LAT, CH2_IO_BIT, CH2_AN_NUM, -1, -1, -1,OUT_CH2_MODER,IN_CH2_MODER,AN_CH2_MODER);// sensor #2	
  MTouchSetSensor(3, CH3_TRIS, CH3_LAT, CH3_IO_BIT, CH3_AN_NUM, -1, -1, -1,OUT_CH3_MODER,IN_CH3_MODER,AN_CH3_MODER);// sensor #3	
  //                                                            thr ovs  cd                                 
  MTouchSetButton(0, 0, DECODE_PRESS_RELEASE|DECODE_ONE_EVENT);
  MTouchSetButton(1, 1, DECODE_PRESS_RELEASE|DECODE_ONE_EVENT);
  MTouchSetButton(2, 2, DECODE_PRESS_RELEASE|DECODE_ONE_EVENT);
  MTouchSetButton(3, 3, DECODE_PRESS_RELEASE|DECODE_ONE_EVENT);
  Timers_init();
  
#ifdef __MOD_BUS_ENABLE__
  eMBMasterInit(MB_RTU, 2, 38400,  MB_PAR_NONE);
  eMBMasterEnable();
#endif /*__MOD_BUS_ENABLE__*/
  
  __enable_irq();
  
  //*******************Потом заменим на чтение из EEPROM*******************
 up_led(1);
 bottom_led(0);
 chasy_led_string("er");
 minuty_led_string("r");
 Indic_struct.colon = False;
 //************************************************************************
 
 while (1)
  {
#ifdef __MOD_BUS_ENABLE__
   eMBMasterPoll();
#endif /*__MOD_BUS_ENABLE__*/
   
#ifdef __SENSOR_KEYS__
    MTouchDecode();
#endif /*__SENSOR_KEYS__*/
    
#ifdef __TOUCH_DEBUG__
    up_led(buttons[0].pSensor->delta/10);
    chasy_led(buttons[1].pSensor->delta/10);
    minuty_led(buttons[2].pSensor->delta/10);
    bottom_led(buttons[3].pSensor->delta/10);
    if(buttons[0].curState == 0x01){Indic_struct.k4 = True;} else {Indic_struct.k4 = False;};
    if(buttons[1].curState == 0x01){Indic_struct.k3 = True;} else {Indic_struct.k3 = False;};
    if(buttons[2].curState == 0x01){Indic_struct.k2 = True;} else {Indic_struct.k2 = False;};
    if(buttons[3].curState == 0x01){Indic_struct.k1 = True;} else {Indic_struct.k1 = False;};
#endif /*__TOUCH_DEBUG__*/
    
    
//    if (o < 7 ) {o++;} else {/*o = 0;*/};
//    switch(o)
//    {
//    case 0:
//      Indic_struct.k1 = True;
//      break;
//    case 1:
//      Indic_struct.k2 = True;
//      break;
//    case 2:
//      Indic_struct.k3 = True;
//      break;
//    case 3:
//      Indic_struct.k4 = True;
//      break;
//    case 4:
//      Indic_struct.red_bottom = True;
//      break;
//      case 5:
//         //Indic_struct.minus = True;
//      break;
//      case 6:
//        Indic_struct.red_up = True;
//      break;
//      case 100:
//        Indic_struct.k1 = False;
//        Indic_struct.k2 = False;
//        Indic_struct.k3 = False;
//        Indic_struct.k4 = False;
//        Indic_struct.red_bottom = False;
//        Indic_struct.minus = False;
//        Indic_struct.red_up = False;
//      break;
//    default:
//      break;
//    };
//      
//    for(uint16_t f=0;f<60000;f++){ for(uint16_t f=0;f<50;f++){};};
//    
//    Indic_struct.minuty++;
//    
//   
//   
//  //Indic_struct.blink_chasy = True;
//  Indic_struct.blink_k2 = True;
//  Indic_struct.blink_minus = False;
//  //Indic_struct.blink_minuty = True;
//  Indic_struct.blink_verhniy_indicator = True;
//  Indic_struct.blink_colon = True;
  };
  //return 0;
}