//Function to initialize all the peripherals void init_devices(void) { cli(); //disable all interrupts port_init(); timer1_init(); timer5_init(); sei(); //re-enable interrupts }
void init_devices (void) { cli(); //Clears the global interrupts port_init(); adc_init(); timer1_init(); sei(); //Enables the global interrupts }
void buzzer_start(void) { ppi_init(); timer1_init(); gpiote_init(); NRF_TIMER1->TASKS_START = 1; }
void init_devices(void){ cli(); //disable all interrupts timer1_init(); lcd_init(); uart3_init(); servo2_pin_config(); motion_port_init(); sei(); //re-enable interrupts }
//Function to initialize all the peripherals void init_devices(void) { cli(); //disable all interrupts DDRC = DDRC | 0x08; //Setting PORTC 3 as output PORTC = PORTC & 0xF7; port_init(); timer1_init(); sei(); //re-enable interrupts }
void main(void) { u8 TxFlag=0; u8 RxFlag=0; InitSfr(); //PIC16 Register Initialization PowerUpDelay(); //Power on delay InitPort(); //PIC16 IO port Initialization timer1_init(); timer2_init(); LCD_Init(); //LCD initialize BeepOff(); //Close buzzer ModuleSelectModeEntryCheck(); //Confirm whether you can enter module select mode Uart_init(); PowerOnMusic(); //Power on music while(1) { MenuConfig(); //Menu config & display if(gb_ModuleWorkEnableFlag) { RFM22B_Running(gb_SystemMode,gb_ModuleWorkMode,gb_ParameterChangeFlag,&TxFlag,&RxFlag,&gb_RF_RSSI); if(TxFlag==1) //Sent successfully { TxFlag=0; gw_SendDataCount++; if(gw_SendDataCount>9999){gw_SendDataCount=0;} } if(RxFlag==1) //Successfully received { RxFlag=0; gw_ReceiveDataCount++; if(gw_ReceiveDataCount>9999){gw_ReceiveDataCount=0;} } if(gb_ParameterChangeFlag==1){gb_ParameterChangeFlag=0;} //clear parameter flag if(gb_ModuleWorkMode!=C_ModuleWorkMode_FSK && gb_ModuleWorkMode!=C_ModuleWorkMode_OOK && gb_ModuleWorkMode!=C_ModuleWorkMode_LoRa) { gb_StatusTx=0; gb_StatusRx=0; } } else { gb_StatusTx=0; gb_StatusRx=0; } if(gb_ErrorFlag!=1) { TxLED_Deal(); //Tx LED display deal RxLED_Deal(); //Rx LED display deal } } }
/* * Function For Devices Initialisation */ void init_devices (void) { cli(); ///< Clears the global interrupts port_init(); ///< initialise the ports adc_init(); uart0_init(); timer5_init(); timer1_init(); sei(); //Enables the global interrupts }
void init_devices (void) { cli(); //Clears the global interrupts port_init(); uart0_init(); //Initailize UART1 for serial communiaction adc_init(); timer5_init(); timer1_init(); sei(); //Enables the global interrupts }
/**@brief Function for starting flashing the LED. * @details This will start the TIMER1 and enable the GPIOTE task that toggles the LED. * The PPI and GPIOTE configurations done by this app will make this action result in the * flashing of the LED. * @pre Can only be called after the SoftDevice is enabled - uses nrf_soc API */ void led_start(void) { nrf_gpio_cfg_output(ADVERTISING_LED); ppi_init(); timer1_init(); gpiote_init(); NRF_TIMER1->TASKS_START = 1; }
//function to initialize all devices void init_devices() { cli(); //Clears the global interrupts timer1_init(); port_init(); //Initializes all the ports uart0_init(); //Initailize UART1 for serial communication //adc_init(); sei(); //Enables the global interrupts }
void main() { unsigned short i=0; io_init(); //timer0_init(); //pwm timer1_init(); //1ms irqon(); //enable global interrupt sleep(0); // just refrence #if 0 for(i=0;1;i++){ setdot(i%4); segprint10(i); mdelay(222); if(i>9999) i=0; } #endif #define DL 1 /*sent start ADC to attiny13, address A2, cmd 12*/ again: segprint10(0); //mdelay(DL); i2c_start(); // send start sequence segprint10(1); //mdelay(DL); i2c_tx(0x55); // SRF08 I2C address with R/W bit clear segprint10(2); //mdelay(DL); i2c_tx(0xAA); // SRF08 command register address segprint10(3); //mdelay(DL); i2c_stop(); // send stop sequence segprint10(4); //mdelay(DL); goto again; while(1){ // KEY_FUNC P3_3 KEY_DISCHARGER P3_2 KEY_RESUME P3_1 charging_update_lcd(); } }
int main() { ioinit(); timer2_init(); timer2_overflow_hook = timer2_hook; timer1_init(); _delay_ms(100); spi_init(); sound_reset(); usart_init(1);// usart_init(23); // 9600bps spdif_configure(); ad1955_configure(); ad1955_mute(); #define NO_NOISE_MEASURE #ifdef NOISE_MEASURE ad1955_unmute(); cli(); set_sleep_mode(SLEEP_MODE_PWR_DOWN); for(;;) { sleep_mode(); } #endif spdif_selectChannel(1); spdif_dumpRegisters(); printf("\n\nSVODAC V%s\n", idstring); for (;;) { if (main_state_machine() == STATE_READY) { if ((REQUEST_STATUS & _BV(REQUEST_MUTE)) != 0) { ad1955_mute(); } else if ((REQUEST_STATUS & _BV(REQUEST_UNMUTE)) != 0) { ad1955_unmute(); } if ((REQUEST_STATUS & _BV(REQUEST_STOP)) != 0) { //printf("STOP"); spdif_stop(); } else if ((REQUEST_STATUS & _BV(REQUEST_RUN)) != 0) { //printf("RUN"); spdif_run(); } REQUEST_STATUS = 0; sleep_mode(); } } return 0; // make happy }
//Function to initialize all the peripherals void init_devices(void) { cli(); //disable all interrupts port_init(); timer1_init(); adc_init(); uart0_init(); // left_position_encoder_interrupt_init(); // right_position_encoder_interrupt_init(); sei(); //re-enable interrupts }
void init_devices (void) { cli(); //Clears the global interrupts timer1_init(); port_init(); adc_init(); timer5_init(); left_position_encoder_interrupt_init(); right_position_encoder_interrupt_init(); sei(); //Enables the global interrupts }
/** * @brief Function for application main entry. */ int main(void) { timer0_init(); // Timer used to blink the LEDs. timer1_init(); // Timer to generate events on even number of seconds. timer2_init(); // Timer to generate events on odd number of seconds. ppi_init(); // PPI to redirect the event to timer start/stop tasks. uint32_t err_code; const app_uart_comm_params_t comm_params = { RX_PIN_NUMBER, TX_PIN_NUMBER, RTS_PIN_NUMBER, CTS_PIN_NUMBER, APP_UART_FLOW_CONTROL_ENABLED, false, UART_BAUDRATE_BAUDRATE_Baud115200 }; APP_UART_FIFO_INIT(&comm_params, UART_RX_BUF_SIZE, UART_TX_BUF_SIZE, uart_error_handle, APP_IRQ_PRIORITY_LOW, err_code); APP_ERROR_CHECK(err_code); // Enabling constant latency as indicated by PAN 11 "HFCLK: Base current with HFCLK // running is too high" found at Product Anomaly document found at // https://www.nordicsemi.com/eng/Products/Bluetooth-R-low-energy/nRF51822/#Downloads // // @note This example does not go to low power mode therefore constant latency is not needed. // However this setting will ensure correct behaviour when routing TIMER events through // PPI (shown in this example) and low power mode simultaneously. NRF_POWER->TASKS_CONSTLAT = 1; // Start clock. nrf_drv_timer_enable(&timer0); nrf_drv_timer_enable(&timer1); nrf_drv_timer_enable(&timer2); // Loop and increment the timer count value and capture value into LEDs. @note counter is only incremented between TASK_START and TASK_STOP. while (true) { printf("Current count: %d\n\r", (int)nrf_drv_timer_capture(&timer0,NRF_TIMER_CC_CHANNEL0)); /* increment the counter */ nrf_drv_timer_increment(&timer0); nrf_delay_ms(100); } }
int main(void) { io_init(); timer0_init(); timer1_init(OFF); interrupts_on(); while (1) { } return 0; }
//Function to initialize all the devices void init_devices() { cli(); //Clears the global interrupt port_init(); //Initializes all the ports timer5_init(); timer3_init(); timer1_init(); left_position_encoder_interrupt_init(); right_position_encoder_interrupt_init(); ext_position_encoder_interrupt_init (); sei(); // Enables the global interrupt }
int main () { DDRD = 0x00; PORTD = 0xff; lcd_init (); /*display on, cursor & blink off */ lcd_control (1, 0, 0); timer1_init (); lcd_cls (); lcd_clear_CRGAM (); //az elso sorba irunk lcd_putstr ("Vertical", LCD_FIRST_LN_ADDR); /* main -loop */ for (;;) { if (cnt1 == CNT1_THRESHOLD) { cnt1 = 0; cnt3_flag = 1; //clear second line for (ch = 0; ch < 20; ch++) { lcd_set_DDRAM_addr (LCD_SECND_LN_ADDR + ch); lcd_putch (' '); } /* * array2d: custom chars array * ROWS: number of chars * 30: vertical delay in ms * 0: horiz. delay * LCD_FIRST_LN_ADDR + 9 : ddram addr. * 1: set CGRAM clear mode; 0: no CGRAM clear */ //nem clear modban erdekes hatast kelt ;-) lcd_vertical_scroll (array2d, ROWS, 40, 0 /* delay ms */ , LCD_FIRST_LN_ADDR + 9, 0); } if (cnt3 == CNT3_THRESHOLD) { cnt3 = 0; cnt3_flag = 0; lcd_putstr ("Is COOL!", LCD_SECND_LN_ADDR + 5); } } return 0; }
int main(void) { init_ctrl(); adc_init(); sync_init(); timer1_init(); ui_init(); timer1_load(); while (1) { ui_update(); } }
//-------------------------------------------------------------------------------- //call this routine to initialize all peripherals //-------------------------------------------------------------------------------- void init_devices(void) { //stop errant interrupts until set up cli(); // disable all interrupts servo_pin_config(); // servo configuration timer1_init(); // initilize timer1 TIMSK1 = 0x0F; // timer1 interrupt sources sei(); //re-enable interrupts //all peripherals are now initialized }
void main_init(void) { OSC_init(); TRISA = 0b00010000; // x,x,x,Vcap,x,x,x,x TRISB = 0b00110001; // x,x,SDA,SCL,x,x,x,x TRISC = 0b10111010; // RX,TX,D+,D-,Vusb,LED,T1OSI,T1OSO ANCON0 = 0b11111111; // xxx,xxx,xxx,RA5,RA3,RA2,RA1,RA0 ANCON1 = 0b00011111; // VBG,xxx,xxx,RB0,RC2,RB1,RB3,RB2 INTCON2bits.RBPU = 0; // Pull-up enable timer1_init(0, T1OSC); I2C_LCD_init(); }
void init_devices(void) { cli(); //Clears the global interrupt port_init_poz(); //Initializes all the ports left_position_encoder_interrupt_init(); right_position_encoder_interrupt_init(); port_init(); //Initializes all the ports color_sensor_pin_interrupt_init(); adc_init(); motion_pin_config(); timer5_init(); timer1_init(); sei(); // Enables the global interrupt }
/** * @brief Function for application main entry. */ int main(void) { gpiote_init(); ppi_init(); timer1_init(); NVIC_EnableIRQ(GPIOTE_IRQn); __enable_irq(); while (true) { // Do nothing. } }
void init_devices (void) { cli(); //Clears the global interrupts port_init(); adc_init(); timer5_init(); left_position_encoder_interrupt_init(); right_position_encoder_interrupt_init(); uart0_init(); //Initailize UART1 for serial communiaction c2_position_encoder_interrupt_init(); //Slider_position_encoder_interrupt_init(); timer1_init(); sei(); //Enables the global interrupts }
//-------------------------------------------------------------------------------- //call this routine to initialise all peripherals //-------------------------------------------------------------------------------- void init_devices(void) { //stop errant interrupts until set up cli(); //disable all interrupts buzzer_pin_config (); uart_init(); adc_init(); timer1_init(); TIMSK = 0x04; //timer interrupt sources sei(); //enable all interrupts }
/** * roombaの通信の初期化 */ void roomba_init (void) { // UARTのポートの割り付け InitUartPort (); // UARTモジュールの初期化 UART2Init (); /* 受信割り込みの許可 */ IEC1bits.U2RXIE=1; /* 送信割り込みの許可 */ IEC1bits.U2TXIE=0; /* 受信割り込みレベルの設定 */ IPC7bits.U2RXIP = 7; /* タイマの初期化 */ timer1_init (); }
uint16_t DFRobot2WD::lireTelecommande(void) /** * \brief renvoie le code de la touche envoyé par la télécommande infrarouge * \return 2 octets correspondant au code de la touche * Cette fonction n'utilise pas le processus d'interruption * * exemple: * int codeIR = terminator.lireTelecommande(); * Serial.println(codeIR, HEX); */ { timer1_init(); remote_decode(); return ir_code; }
int main() { /* Semaphore creation */ vSemaphoreCreateBinary(ahrs_task_semaphore); vSemaphoreCreateBinary(flight_control_task_semaphore); /* Peripheral initialization */ NVIC_PriorityGroupConfig(NVIC_PriorityGroup_4); led_init(); debug_port_init(); usart3_init(57600); i2c1_init(); spi1_init(); timer1_init(); pwm_timer4_init(); pwm_timer5_init(); pwm_capture_timer2_init(); pwm_capture_timer3_init(); pwm_capture_timer8_init(); //Make sure all the peripheral is finished the initialization delay_ms(5); /* Device initialization */ while(mpu6050_init()); while(hmc5983_init()); nrf24l01_init(); motor_init(); /* Task creation */ //Attitude and Heading Reference System (AHRS) task xTaskCreate(ahrs_task, (portCHAR *)"AHRS task", 4096, NULL, tskIDLE_PRIORITY + 3, NULL); xTaskCreate(flight_control_task, (portCHAR *)"Flight control task", 4096, NULL, tskIDLE_PRIORITY + 2, NULL); #ifndef DEBUG_PRINT //USART plot task xTaskCreate(usart_plot_task, (portCHAR *)"USART plot task", 2048, NULL, tskIDLE_PRIORITY + 1, NULL); #endif /* Start schedule */ vTaskStartScheduler(); return 0; }
// Public functions // Initialize peripheral devices void robockey_init(void) { m_clockdivide(0); // 16 MHz sei(); // Enable global interrupt timer1_init(0.5); // kHz timer3_init(50); // Hz //timer0_init(1); // kHz adc_init(); mode_init(); m_rf_open(CHANNEL,RXADDRESS,PACKET_LENGTH_RF); // Enable wireless m_usb_init(); // Enable usb communication m_bus_init(); // Enable mbus m_wii_open(); // Enable wii camera }
void inits( void) { cli(); USART_init(MYUBRR, TRUE); can_init(); spi_init_master(); fm_init(); timer0_init(); timer1_init(); //TODO: RUN timer3_init(); timer3_init(); prepare_rx(1, ID_steeringWheel, MASK_FRONT_MODULE, fm_msg_handler); printf("\r\nFront module initialized"); sei(); set_bit(DDRB, DDB6); clear_bit(PORTB, PB6); }