void QMV_UART_Config( pFunc pUARTx ) { UART6_irqEven = pUARTx; Serial_Config(); printf("\r\nHello World!\r\n\r\n"); }
/*====================================================================================================*/ void System_Init( void ) { MPU_InitTypeDef MPU_InitStruct; HAL_Init(); GPIO_Config(); Serial_Config(); MPU6050_Config(); Delay_100ms(1); printf("\r\nHello World!\r\n\r\n"); LED_B_Reset(); MPU_InitStruct.MPU_Gyr_FullScale = MPU_GyrFS_2000dps; MPU_InitStruct.MPU_Gyr_LowPassFilter = MPU_GyrLPS_41Hz; MPU_InitStruct.MPU_Acc_FullScale = MPU_AccFS_4g; MPU_InitStruct.MPU_Acc_LowPassFilter = MPU_AccLPS_41Hz; while(MPU6050_Init(&MPU_InitStruct) != SUCCESS) { LED_R_Toggle(); Delay_100ms(1); } LED_R_Set(); LED_B_Set(); Delay_100ms(1); }
/*====================================================================================================*/ void System_Init( void ) { uint8_t state = ERROR; MPU_InitTypeDef MPU_InitStruct; HAL_Init(); SystemClock_Config(); GPIO_Config(); Serial_Config(); LED_R_Reset; Delay_100ms(1); MPU_InitStruct.MPU_Gyr_FullScale = MPU_GyrFS_2000dps; MPU_InitStruct.MPU_Gyr_LowPassFilter = MPU_GyrLPS_41Hz; MPU_InitStruct.MPU_Acc_FullScale = MPU_AccFS_4g; MPU_InitStruct.MPU_Acc_LowPassFilter = MPU_AccLPS_41Hz; state = IMU_Init(&MPU_InitStruct); while(state != SUCCESS) { LED_G_Toggle; Delay_100ms(1); } LED_G_Reset; Delay_100ms(1); }
/** Configures the board hardware and chip peripherals for the demo's functionality. */ void SetupHardware(void) { /* Disable watchdog if enabled by bootloader/fuses */ MCUSR &= ~(1 << WDRF); wdt_disable(); /* enable clock division, run on 16MHz */ clock_prescale_set(clock_div_1); /* enable Interrupts */ GlobalInterruptEnable(); /* disable JTAG since we use the pins for I/O, e.g. the STBY pin */ JTAG_DISABLE(); /* pull STBY low, so enough power can be provided */ DDRF |= (PWR_STBY); PORTF &= ~(PWR_STBY); /* reset sensors */ DDRC |= PWR_SENSORS; PORTC &= ~(PWR_SENSORS); /* enable pushbutton */ DDRB |= ~(PWR_BUTTON); /* set default uart configuration */ Serial_Config(1000000, 8, CDC_LINEENCODING_OneStopBit, CDC_PARITY_None); /* get off the spi-bus */ DDRB &= ~JEN_SPIMISO; DDRB &= ~JEN_SPIMOSI; DDRB &= ~JEN_CLOCK; DDRE &= ~JEN_SPISS; }
void KDWM_UART1_Config( pFunc pUARTx ) { UART1_Rx_irqEven = pUARTx; Serial_Config(); printf("\r\nHello World!\r\n\r\n"); }
/*====================================================================================================*/ void System_Init( void ) { MPU_InitTypeDef MPU_InitStruct; CLOCK_SourceXTAL(NRF_CLOCK_XTALFREQ_16MHz); CLOCK_SourceLFCLK(NRF_CLOCK_LF_SRC_RC); CLOCK_CmdHFCLK(ENABLE); CLOCK_CmdLFCLK(ENABLE); GPIO_Config(); Serial_Config(); MPU9250_Config(); Delay_100ms(1); printf("\r\nHello World!\r\n\r\n"); MPU_InitStruct.MPU_Gyr_FullScale = MPU_GyrFS_2000dps; MPU_InitStruct.MPU_Gyr_LowPassFilter = MPU_GyrLPS_41Hz; MPU_InitStruct.MPU_Acc_FullScale = MPU_AccFS_4g; MPU_InitStruct.MPU_Acc_LowPassFilter = MPU_AccLPS_41Hz; printf("MPU9250 Init ..."); if(MPU9250_Init(&MPU_InitStruct) != SUCCESS) { printf("ERROR\r\n"); while(1) { LED2_Toggle(); Delay_100ms(1); } } printf("SUCCESS\r\n"); LED2_Set(); Delay_100ms(1); }
/*=====================================================================================================*/ void System_Init( void ) { HAL_Init(); Serial_Config(); Delay_100ms(1); printf("\r\nHello World!\r\n\r\n"); }
/*====================================================================================================*/ void System_Init( void ) { HAL_Init(); GPIO_Config(); Serial_Config(); delay_ms(100); printf("\r\nHello World!\r\n\r\n"); }
/*====================================================================================================*/ void System_Init( void ) { Clock_Config(); GPIO_Config(); SAADC_Config(); Serial_Config(); printf("\fHello World!!\r\n"); }
void lufaLoop(void) { if(!jennic_in_programming_mode){ CDC_Device_USBTask(&VirtualSerial_CDC0_Interface); CDC_Arduino_In_Task(); } do{ if (jennic_reset_event) { if (!jennic_in_programming_mode) { jennic_in_programming_mode = true; Serial_Config(38400, 8, CDC_LINEENCODING_OneStopBit, CDC_PARITY_None); Jennic_Set_Mode(true); /* pull jennic into programming mode */ } else { jennic_in_programming_mode = false; Serial_Config(1000000, 8, CDC_LINEENCODING_OneStopBit, CDC_PARITY_None); Jennic_Set_Mode(false); /* pull jennic into normal mode */ } jennic_reset_event = false; } //if(jennic_in_programming_mode){ Jennic_In_Task(); CDC_In_Task(); CDC_Device_USBTask(&VirtualSerial_CDC1_Interface); USB_USBTask(); /* do house-keeping */ // UDRE Interrupt enable (USART) // cause if our USB->USART ringbuf is full we disable the interrupt. if ( ringbuf_elements(&USBtoUSART_Buffer) && !(UCSR1B & (1 << UDRIE1)) ) UCSR1B |= (1 << UDRIE1); }while(jennic_in_programming_mode); }
/** Event handler for the CDC Class driver Line Encoding Changed event. * * \param[in] CDCInterfaceInfo Pointer to the CDC class interface configuration structure being referenced */ void EVENT_CDC_Device_LineEncodingChanged(USB_ClassInfo_CDC_Device_t* const CDCInterfaceInfo) { if(CDCInterfaceInfo->Config.ControlInterfaceNumber == 2 && jennic_in_programming_mode) { /* only allowed in programming mode through programmer (jenprog) */ Serial_Config(CDCInterfaceInfo->State.LineEncoding.BaudRateBPS, CDCInterfaceInfo->State.LineEncoding.DataBits, CDCInterfaceInfo->State.LineEncoding.CharFormat, CDCInterfaceInfo->State.LineEncoding.ParityType); } }
/*====================================================================================================*/ void System_Init( void ) { CLOCK_SourceXTAL(NRF_CLOCK_XTALFREQ_16MHz); CLOCK_SourceLFCLK(NRF_CLOCK_LF_SRC_RC); CLOCK_CmdHFCLK(ENABLE); CLOCK_CmdLFCLK(ENABLE); GPIO_Config(); Serial_Config(); Delay_100ms(1); Serial_SendStr("\r\nHello World!\r\n\r\n"); }
/** Main program entry point. This routine contains the overall program flow, including initial * setup of all components and the main program loop. */ void lufaInit(void) { /* activate specific usb config */ SetupHardware(); USB_Init(); //CDC_Device_CreateStream(&VirtualSerial_CDC0_Interface, &stdout); ringbuf_init(&USARTtoUSB_Buffer, uarttousb, sizeof(uarttousb)); ringbuf_init(&USBtoUSART_Buffer, usbtouart, sizeof(uarttousb)); ringbuf_init(&serialRx_Buffer, serialRx, sizeof(serialRx)); callback = nothing; /* restart jennic and set to normal mode. XXX needs serial line ops */ Serial_Config(1000000, 8, CDC_LINEENCODING_OneStopBit, CDC_PARITY_None); Jennic_Set_Mode(false); }
void system_init(void) { LED_Config(); Serial_Config(Serial_Baudrate); Motor_Config(); PWM_Capture_Config(); //IMU Config Sensor_Config(); nRF24L01_Config(); //SD Config if ((SD_status = SD_Init()) != SD_OK) system.status = SYSTEM_ERROR_SD; PID_Init(&PID_Pitch, 4.0, 0.0, 1.5); PID_Init(&PID_Roll, 4.0, 0.0, 1.5); PID_Init(&PID_Yaw, 5.0, 0.0, 15.0); Delay_10ms(10); Motor_Control(PWM_MOTOR_MIN, PWM_MOTOR_MIN, PWM_MOTOR_MIN, PWM_MOTOR_MIN); /* nRF Check */ while (nRF_Check() == ERROR); /* Sensor Init */ while (Sensor_Init() == ERROR); Delay_10ms(10); /* Lock */ SetLED(LED_R, DISABLE); SetLED(LED_G, ENABLE); SetLED(LED_B, ENABLE); //Check if no error if (system.status != SYSTEM_ERROR_SD) system.status = SYSTEM_INITIALIZED; }
/*====================================================================================================*/ void NRF51_UART_Config( void ) { Serial_Config(); printf("\fHello World!!\r\n"); }