예제 #1
0
파일: main.c 프로젝트: ECSE426-GR6/lab4_new
/**
  * Main function
  */
int main (void) {

	osKernelInitialize();                     /* initialize CMSIS-RTOS          */

	HAL_Init();                               /* Initialize the HAL Library     */

	SystemClock_Config();                     /* Configure the System Clock     */

	/* User codes goes here*/
	// initializeLED_IO();                       /* Initialize LED GPIO Buttons    */
	// start_Thread_LED();                       /* Create LED thread              */

	init_acc_kstate(0.01f, 0.1f, 0.0f, 0.1f, 0.0f);
	init_temp_kstate(0.005f, 0.05f, 0.0f, 5.0f, 0.0f);

	MAIL_CONTROLLER_init_mailboxes();
	ConfigureADC();
	accelerometer_init();
	LED_init_io();
	KP_init();

	TIM3_init();
	TIM4_init();

	MAIL_CONTROLLER_start_thread();
	LED_start_thread();
	temperature_start_thread();
	accelerometer_start_thread();
	KEYPAD_start_thread();
	/* User codes ends here*/

	osKernelStart();                          /* start thread execution         */

}
예제 #2
0
//!
//! @brief This function initializes the hardware/software resources
//! required for the USB Full custom task.
//!
void device_full_custom_task_init(void)
{
  sof_cnt = 0;
#ifndef FREERTOS_USED
  #if USB_HOST_FEATURE == true
  // If both device and host features are enabled, check if device mode is engaged
  // (accessing the USB registers of a non-engaged mode, even with load operations,
  // may corrupt USB FIFO data).
  if (Is_usb_device())
  #endif  // USB_HOST_FEATURE == true
    Usb_enable_sof_interrupt();
#endif  // FREERTOS_USED

  // Initialize Leds state
  LED_Off( LED_MONO0_GREEN );
  LED_Off( LED_MONO1_GREEN );
  LED_Off( LED_MONO2_GREEN );
  LED_Off( LED_MONO3_GREEN );

  // Initialize accelerometer sensor
  accelerometer_init();

#ifdef FREERTOS_USED
  xTaskCreate(device_full_custom_task,
              configTSK_USB_DFC_NAME,
              configTSK_USB_DFC_STACK_SIZE,
              NULL,
              configTSK_USB_DFC_PRIORITY,
              NULL);
#endif  // FREERTOS_USED
}
예제 #3
0
void init(void){
	GPIO_init();
	USART_init();
	CAN_Config();
	SysTick_init();
	accelerometer_init();
	ADC_init();
	TIM4_init();
	TIM2_init();
}
void system_init(void) {
	generic_init();
	
	led_init();

	temperature_sensor_init();
	
	seven_segment_init();
	seven_segments_sm_init();
	
	keypad_init();
	accelerometer_init();
}
예제 #5
0
파일: main.c 프로젝트: avbotz/9dof-razor
void init (void)
{
    //1 = output, 0 = input
	DDRB = 0b01100000; //PORTB4, B5 output for stat LED
    DDRC = 0b00010000; //PORTC4 (SDA), PORTC5 (SCL), PORTC all others are inputs
    DDRD = 0b00000010; //PORTD (TX output on PD1)
	PORTC = 0b00110000; //pullups on the I2C bus
	
	cbi(PORTB, 5);
	
	i2cInit();
	accelerometer_init();
	magnetometer_init();
	gyro_init();
	
	check_baud();
}
예제 #6
0
파일: main.c 프로젝트: avbotz/9dof-razor
void config_menu(void)
{
	i2cInit();
	accelerometer_init();
	magnetometer_init();

	printf_P(wlcm_str);
	printf_P(accel);
	printf_P(mag);
	printf_P(gyro);
	printf_P(raw_out);
	printf_P(baud_change);
	printf("%ldbps\n\r", baud);
	printf_P(autorun);
	printf_P(help_);
	
	config_read();
}