//==================================================== void MARK_Init(void) {uint16_t Pin_MARK = Pin_MARK0 #ifdef Pin_MARK1 | Pin_MARK1 #endif #ifdef Pin_MARK2 | Pin_MARK2 #endif #ifdef Pin_MARK3 | Pin_MARK3 #endif #ifdef Pin_MARK4 | Pin_MARK4 #endif #ifdef Pin_MARK5 | Pin_MARK5 #endif ; // uint16_t Pin_LED = Pin_LED1 | Pin_LED2 ; // RCC_APB2PeriphClockCmd(RCC_APB2Periph_AFIO, ENABLE); GPIO_Enable(GPIO_MARK) ; // GPIO_Enable(GPIO_LED) ; #ifdef Pin_KEYA GPIO_Enable(GPIO_KEYA) ; #endif #ifdef Pin_KEYB GPIO_Enable(GPIO_KEYB) ; #endif GPIO_PinConfig(GPIO_MARK,Pin_MARK,GPIO_Mode_OUT) ; // GPIO_PinConfig(GPIO_LED ,Pin_LED ,GPIO_Mode_OUT) ; #ifdef Pin_KEYA GPIO_PinConfig(GPIO_KEYA,Pin_KEYA,GPIO_Mode_IN_FLOATING); #endif #ifdef Pin_KEYB GPIO_PinConfig(GPIO_KEYB,Pin_KEYB,GPIO_Mode_IN_FLOATING); #endif // Это для контроля TIM3_CH1 !!!! это запуск ADC3. // GPIO_PinRemapConfig(GPIO_Remap_SWJ_JTAGDisable,ENABLE) ; // GPIO_PinRemapConfig(GPIO_PartialRemap_TIM3, ENABLE) ; // GPIO_PinConfig(GPIOB,GPIO_Pin_4,GPIO_Mode_AF_PP) ; // GPIO_InitStructure.GPIO_Pin = GPIO_Pin_15 ; // GPIO_InitStructure.GPIO_Mode = GPIO_Mode_ ; // GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz ; // GPIO_Init(GPIOA, &GPIO_InitStructure) ; }
__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; }