Exemple #1
0
int main(void)
{
    uint8_t current_state = 0;				// Used to store the current state of TX state machine
    uint16_t pulse_count = 0;					// Used to store the current number of pulses

    GPIO_init();
    init_timer_0A();
    init_timer_0B();
    nvic_init();
    PWM_init();

    // IR Rx GPIO port (PB4) for asynch receive
    init_IR_rx();

    // Delay for microcontroller clock to stabilize
    delay_timer_0A(500);
    current_state = 1;  // Activate the tx_state_machine

    while(1)
    {
        // If the 562us timer expired then it is time to update state machine
        /*
        if (mod_period_flag) {
        	mod_period_flag = 0;
        	tx_state_machine(&current_state, &pulse_count, IR_address,  IR_data_GREEN);	  //<--- TX CHANGE HERE!!
        }
        */

        // If RX port senses an edge, store the timer count
        if (rx_interrupt_flag) {
            rx_interrupt_flag = 0;
            rx_handler();
        }
    }
}
/**
 * First init
 */
static void firstInit(void) {

	//Hardware init
	GPIO_init();
	USART1_init();//midi
	USART6_init();//debug
	usb_midi_init(); //Init everything for midiUSB

	ADC_init_all(); //ADC init
	SD_DMA_activate();
	//Display
	delayms(400);
#ifdef WS0010_GRAPHICS
	hd44780_init();
	hd44780_display( HD44780_DISP_ON, HD44780_DISP_CURS_OFF, HD44780_DISP_BLINK_OFF);
	ws0010_Graphics_mode();
	ws0010_Draw_buffer(pictureVMK188);
    delayms(20000);
	ws0010_Character_mode();
	hd44780_init();
#else
	hd44780_init();
	hd44780_display( HD44780_DISP_ON, HD44780_DISP_CURS_OFF, HD44780_DISP_BLINK_OFF);
	hd44780_message_center(APP_NAME, 1);
	hd44780_message_center(APP_VERSION, 2);
    delayms(3000);
#endif

}
/*
 *  ======== CSL_init =========
 *  Initialize all configured CSL peripherals
 */
void CSL_init(void)
{
    /* Stop watchdog timer from timing out during initial start-up. */
    WDTCTL = WDTPW + WDTHOLD;

    /* initialize Config for the MSP430 GPIO */
    GPIO_init();

    /* initialize Config for the MSP430 2xx family clock systems (BCS) */
    BCSplus_init();

    /* initialize Config for the MSP430 10-bit Analog to Digital Converter (ADC) */
    ADC10_init();

    /* initialize Config for the MSP430 USCI_A0 */
    USCI_A0_init();

    /* initialize Config for the MSP430 A3 Timer0 */
    Timer0_A3_init();

    /* initialize Config for the MSP430 System Registers */
    System_init();

    /* initialize Config for the MSP430 A3 Timer0 */
    Timer1_A3_init();

    /* initialize Config for the MSP430 WDT+ */
    WDTplus_init();

}
/**
 * Initalize the GPIO unit for the leds
 */
void initLeds(void)
{
    GPIO_init(&g_gpio0, COREGPIO_IN_BASE_ADDR, GPIO_APB_32_BITS_BUS);

    // DIP Switches
    GPIO_config(&g_gpio0, GPIO_0, GPIO_INPUT_MODE);
    GPIO_config(&g_gpio0, GPIO_1, GPIO_INPUT_MODE);
    GPIO_config(&g_gpio0, GPIO_2, GPIO_INPUT_MODE);
    GPIO_config(&g_gpio0, GPIO_3, GPIO_INPUT_MODE);

    // Buttons
    GPIO_config(&g_gpio0, GPIO_4, GPIO_INPUT_MODE);
    GPIO_config(&g_gpio0, GPIO_5, GPIO_INPUT_MODE);
    GPIO_config(&g_gpio0, GPIO_6, GPIO_INPUT_MODE);
    GPIO_config(&g_gpio0, GPIO_7, GPIO_INPUT_MODE);

    // LEDs
    GPIO_config(&g_gpio0, GPIO_8, GPIO_OUTPUT_MODE);
    GPIO_config(&g_gpio0, GPIO_9, GPIO_OUTPUT_MODE);
    GPIO_config(&g_gpio0, GPIO_10, GPIO_OUTPUT_MODE);
    GPIO_config(&g_gpio0, GPIO_11, GPIO_OUTPUT_MODE);
    GPIO_config(&g_gpio0, GPIO_12, GPIO_OUTPUT_MODE);
    GPIO_config(&g_gpio0, GPIO_13, GPIO_OUTPUT_MODE);
    GPIO_config(&g_gpio0, GPIO_14, GPIO_OUTPUT_MODE);
    GPIO_config(&g_gpio0, GPIO_15, GPIO_OUTPUT_MODE);

    GPIO_set_outputs(&g_gpio0, 0xFF00);
    led_state = 0;
}
Exemple #5
0
/*
 *  ======== EK_TM4C123GXL_initGPIO ========
 */
void EK_TM4C123GXL_initGPIO(void)
{
    /* Setup the LED GPIO pins used */
    GPIOPinTypeGPIOOutput(GPIO_PORTF_BASE, GPIO_PIN_1); /* EK_TM4C123GXL_LED_RED */
    GPIOPinTypeGPIOOutput(GPIO_PORTF_BASE, GPIO_PIN_2); /* EK_TM4C123GXL_LED_GREEN */
    GPIOPinTypeGPIOOutput(GPIO_PORTF_BASE, GPIO_PIN_3); /* EK_TM4C123GXL_LED_BLUE */

    /* Setup the button GPIO pins used */
    GPIOPinTypeGPIOInput(GPIO_PORTF_BASE, GPIO_PIN_4);  /* EK_TM4C123GXL_GPIO_SW1 */
    GPIOPadConfigSet(GPIO_PORTF_BASE, GPIO_PIN_4, GPIO_STRENGTH_4MA, GPIO_PIN_TYPE_STD_WPU);

    /* PF0 requires unlocking before configuration */
    HWREG(GPIO_PORTF_BASE + GPIO_O_LOCK) = GPIO_LOCK_KEY;
    HWREG(GPIO_PORTF_BASE + GPIO_O_CR) |= GPIO_PIN_0;
    GPIOPinTypeGPIOInput(GPIO_PORTF_BASE, GPIO_PIN_0);  /* EK_TM4C123GXL_GPIO_SW2 */
    GPIOPadConfigSet(GPIO_PORTF_BASE, GPIO_PIN_0, GPIO_STRENGTH_4MA, GPIO_PIN_TYPE_STD_WPU);
    HWREG(GPIO_PORTF_BASE + GPIO_O_LOCK) = GPIO_LOCK_M;

    /* Once GPIO_init is called, GPIO_config cannot be changed */
    GPIO_init();

    GPIO_write(EK_TM4C123GXL_LED_RED, EK_TM4C123GXL_LED_OFF);
    GPIO_write(EK_TM4C123GXL_LED_GREEN, EK_TM4C123GXL_LED_OFF);
    GPIO_write(EK_TM4C123GXL_LED_BLUE, EK_TM4C123GXL_LED_OFF);
}
Exemple #6
0
void inicia(void)
{
  
    system_init();
    USCI_B0_init();
    USCI_A0_init();
    GPIO_init();
    Timer0_A3_init();
    
        /* 
     * IFG2, Interrupt Flag Register 2
     * 
     * UCB0TXIFG -- Interrupt pending
     * UCB0RXIFG -- Interrupt pending
     * ~UCA0TXIFG -- No interrupt pending
     * ~UCA0RXIFG -- No interrupt pending
     * 
     * Note: ~<BIT> indicates that <BIT> has value zero
     */
    IFG2 &= ~(UCB0TXIFG + UCB0RXIFG);

    /* 
     * IE2, Interrupt Enable Register 2
     * 
     * UCB0TXIE -- Interrupt enabled
     * UCB0RXIE -- Interrupt enabled
     * ~UCA0TXIE -- Interrupt disabled
     * ~UCA0RXIE -- Interrupt disabled
     * 
     * Note: ~<BIT> indicates that <BIT> has value zero
     */
    IE2 &= ~(UCB0TXIE + UCB0RXIE);

}
Exemple #7
0
void __main(void)
{
	uint8_t k;
	uint32_t i;

	UART_init();
	TMR16_Init();
	GPIO_init();

	if ( SysTick_Config(12000000) ) {
		while(1);
	}

	__enable_irq();

	puts("LPC1114 UART Test\r\n");

	while(1) {
		for ( k = 0; k < 8*3; k++ ) {
			LPC_TMR16B1->MR0 = Freq[k];
			LPC_TMR16B1->TCR = 1;

			for (i = 0xfffff; i !=0; i--);
			LPC_TMR16B1->TCR = 0;
			LPC_TMR16B1->TCR |= (1 << 1);
		}
	}
}
/*
 *  ======== EK_TM4C123GXL_initGPIO ========
 */
void EK_TM4C123GXL_initGPIO(void) {

	GPIOPadConfigSet(GPIO_PORTA_BASE,GPIO_PIN_2,GPIO_STRENGTH_8MA,GPIO_PIN_TYPE_STD_WPD);
	GPIOPadConfigSet(GPIO_PORTA_BASE,GPIO_PIN_3,GPIO_STRENGTH_8MA,GPIO_PIN_TYPE_STD_WPD);

	GPIOPinTypeGPIOInput(GPIO_PORTA_BASE, GPIO_PIN_2); /* ENC_A */
	GPIOPinTypeGPIOInput(GPIO_PORTA_BASE, GPIO_PIN_3); /* ENC_B */
	GPIOIntTypeSet(GPIO_PORTA_BASE,GPIO_PIN_2,GPIO_INT_BOTH_EDGES);

	GPIOPinTypeGPIOOutput(GPIO_PORTB_BASE, GPIO_PIN_2); /* Load cell clock*/
	GPIOPinTypeGPIOInput(GPIO_PORTB_BASE, GPIO_PIN_3); /* Load cell data*/


	GPIOPinTypeGPIOInput(GPIO_PORTD_BASE, GPIO_PIN_0); /* Test Button 1*/
	GPIOPinTypeGPIOInput(GPIO_PORTD_BASE, GPIO_PIN_1); /* Test Button 2*/
	GPIOPinTypeGPIOInput(GPIO_PORTD_BASE, GPIO_PIN_2); /* Test Button 3*/

	/* Setup the LED GPIO pins used */
	GPIOPinTypeGPIOOutput(GPIO_PORTF_BASE, GPIO_PIN_1); /* Test led 2 */
	GPIOPinTypeGPIOOutput(GPIO_PORTF_BASE, GPIO_PIN_2); /* Test led 3 */


	/* PF0 requires unlocking before configuration */
	HWREG(GPIO_PORTF_BASE + GPIO_O_LOCK) = GPIO_LOCK_KEY;
	HWREG(GPIO_PORTF_BASE + GPIO_O_CR) |= GPIO_PIN_0;
	GPIOPinTypeGPIOOutput(GPIO_PORTF_BASE, GPIO_PIN_0); /* Test led 1 */

	HWREG(GPIO_PORTF_BASE + GPIO_O_LOCK) = GPIO_LOCK_M;

	/* Once GPIO_init is called, GPIO_config cannot be changed */
	GPIO_init();


}
/*
 *  ======== EKS_LM4F232_initGPIO ========
 */
Void EKS_LM4F232_initGPIO(Void)
{
    /* EKS_LM4F232_SW1 - EKS_LM4F232_SW5 */
  //  UChar allButtons = GPIO_PIN_0 | GPIO_PIN_1 | GPIO_PIN_2 | GPIO_PIN_3 | GPIO_PIN_4;

    /* Setup the LED GPIO pins used */
    GPIOPinTypeGPIOOutput(GPIO_PORTL_BASE, GPIO_PIN_0); /* EKS_LM4F232_LED1 */
    GPIOPinTypeGPIOOutput(GPIO_PORTL_BASE, GPIO_PIN_1); /* EKS_LM4F232_LED2 */
    GPIOPinTypeGPIOOutput(GPIO_PORTL_BASE, GPIO_PIN_2); /* EKS_LM4F232_LED3 */
    GPIOPinTypeGPIOOutput(GPIO_PORTL_BASE, GPIO_PIN_3); /* EKS_LM4F232_LED4 */
    GPIOPinTypeGPIOOutput(GPIO_PORTL_BASE, GPIO_PIN_4); /* EKS_LM4F232_LED5 */
    GPIOPinTypeGPIOOutput(GPIO_PORTL_BASE, GPIO_PIN_5); /* EKS_LM4F232_LED6 */
    GPIOPinTypeGPIOOutput(GPIO_PORTK_BASE, GPIO_PIN_4); /* EKS_LM4F232_DIOA0 */
    GPIOPinTypeGPIOOutput(GPIO_PORTK_BASE, GPIO_PIN_5); /* EKS_LM4F232_DIOA1 */
    GPIOPinTypeGPIOOutput(GPIO_PORTK_BASE, GPIO_PIN_6); /* EKS_LM4F232_DIODATA */
    GPIOPinTypeGPIOOutput(GPIO_PORTK_BASE, GPIO_PIN_7); /* EKS_LM4F232_DIOCLK */
    GPIOPinTypeGPIOOutput(GPIO_PORTD_BASE, GPIO_PIN_3); /* EKS_LM4F232_OBD */
    GPIOPinTypeGPIOOutput(GPIO_PORTH_BASE, GPIO_PIN_3); /* EKS_LM4F232_SD_ON */
    GPIOPinTypeGPIOOutput(GPIO_PORTN_BASE, GPIO_PIN_7); /* EKS_LM4F232_PWRRF */
    GPIOPinTypeGPIOOutput(GPIO_PORTD_BASE, GPIO_PIN_4); /* EKS_LM4F232_PWRTELIT_EN */
    /* Setup the button GPIO pins used */
    //GPIOPinTypeGPIOInput(GPIO_PORTM_BASE, allButtons);
    //GPIOPadConfigSet(GPIO_PORTM_BASE, allButtons, GPIO_STRENGTH_4MA, GPIO_PIN_TYPE_STD_WPU);

    /* Once GPIO_init is called, GPIO_config cannot be changed */
    GPIO_init();
    GPIO_write(EKS_LM4F232_LED1, EKS_LM4F232_LED_OFF);
    GPIO_write(EKS_LM4F232_LED2, EKS_LM4F232_LED_OFF);
    GPIO_write(EKS_LM4F232_LED3, EKS_LM4F232_LED_OFF);
    GPIO_write(EKS_LM4F232_LED4, EKS_LM4F232_LED_OFF);
    GPIO_write(EKS_LM4F232_LED5, EKS_LM4F232_LED_OFF);
    GPIO_write(EKS_LM4F232_LED6, EKS_LM4F232_LED_OFF);
}
Exemple #10
0
int main(void)
//   Input    : -
//   Output   : -
//   Function : main function. Runs the init function and then loops


{
    //Initialization
    disable_global_int();
    SysTick_init();
    GPIO_init();
    swtimers_init();
    RTCS_init();

    UART0_init(19200, 8, 1, 0);
    enable_global_int();
    LCD_init();
    queue_init(&display_lcd_queue);
    queue_init(&uart0_rx_queue);
    numpad_init();

    open_queue(Q_LCD);
    open_queue(Q_INPUT);

    start_task( TASK_RTC, RTC_task);
    start_task( TASK_DISPLAY, display_task);
    start_task( TASK_LCD, LCD_task);
    start_task( TASK_NUMPAD, numpad_task);
    start_task( TASK_UI, ui_task);
    start_task( TASK_UART0, UART0_task);

    schedule();

    return (0);
}
Exemple #11
0
/*-----------------------------------------------------------------------*
* FUNCTION
*  DclGPIO_Initialize
*
* DESCRIPTION
*  This function is to initialize GPIO module. Note that all the GPIO pin
* will be set to a predefined state.
*
* PARAMETERS
*	DCL_STATUS_OK
*
* RETURNS
*  none
*
*-----------------------------------------------------------------------*/
DCL_STATUS DclGPIO_Initialize(void)
{
   extern void GPIO_init(void);

   GPIO_init();
   return STATUS_OK;
}
Exemple #12
0
int main(void)
{
	can_message_ msg;

	GPIO_init();

	CAN_init(125000, 0, 0, 8, &CAN_Message_Received);

	USB_Init();
	USB_Connect(TRUE);

	A3984_init();
	A3984_set_state(A3984_STATE_WAKEUP);
	A3984_set_state(A3984_STATE_ACTIVE);
	A3984_set_stepping(A3984_STEP_FULL);
	A3984_set_direction(A3984_DIR_CW);
	A3984_set_idle_current(100);

	GPIO_clock_out(TRUE);

	CAN_Message_(&msg, 0x0123, 0, 5, 'R', 'E', 'A', 'D', 'Y');
	CAN_send(1, msg);


	while (1)
	{
#if A3984_CURRENT_ISR == 1
		A3984_set_current_handler();
#endif
	}
	return 0 ;
}
Exemple #13
0
void SDCard_init(PinName mosi, PinName miso, PinName sclk, PinName cs)
{
  SPI_init(mosi, miso, sclk);
  GPIO_init(cs);
  GPIO_output(cs);
  GPIO_set(cs);
  _cs = cs;
}
void BSPINIT(void)
{
    RCC_Init();		                //所有时钟使能
	  GPIO_init();	 
    adc_init();
    TIM3_Int_Init(999,10);
	TIM8_PWM_Init(999,10);       //1200Hz
  TIM_Configuration();	        //  TIM7主中断设置						
  flag=0;
}
Exemple #15
0
void init(void){
	GPIO_init();
	USART_init();
	CAN_Config();
	SysTick_init();
	accelerometer_init();
	ADC_init();
	TIM4_init();
	TIM2_init();
}
Exemple #16
0
void init_all(void)
{
	GPIO_init();
	DAC_DMA_init();
	P24_init();
	vdisplay_init();
	codec_init();
	codec_ctrl_init();
	TIM6_init();			/* Initialize timer */
	TIM3_init();			/* interrupts last... */
	TIM4_init();
}
Exemple #17
0
/**
 * \brief Application entry point.
 *
 * \return Unused (ANSI-C compatibility).
 */
int main(void)
{
	Clock_init();
	GPIO_init();
	USART0_SPI_Master_Init();
	USART0_SPI_DMA_Transfer(TxBuffer,RxBuffer,5);
	
    while (1) 
    {
        //TODO:: Please write your application code 
    }
}
int main(void) {

	rcc_init();
	GPIO_init();
	USART2_init();

	USART_SendString("Hello World\n");
    while (1) {
    	if (USART_ReceiveChar() == 'g'){
    		USART_SendString("Received your message\r\n");
    	}
    }
}
Exemple #19
0
int main(void) {

	// Initilize UART and GPIO
	UART_init();
	GPIO_init();
	
	// Turn ON LED
	GPIO1DATA = (1 << PIO1_9);
	
	// UART Read with a callback
	UART_read(UART_RX_callback);
	
	while(1);
}
/*************************************************************************
 * Function Name: MCU_init
 * Parameters: none
 * Return: none
 * Description: initialization of peripheral modules after reset
 *************************************************************************/
void MCU_init(void)
{
  Clock_init();
  ADC0_init();
  PDB_init();
  FTM0_init();
  FTM1_init();
  FTM2_init();
  SPI0_init();
  UART1_init();
  GPIO_init();
  MC33927_config();

}
Exemple #21
0
int main(void)
{
    /* Set these since libopencm3 expects them and the kernel has already
     * set the clock. */
    rcc_ppre1_frequency = 24000000;
    rcc_ppre2_frequency = 24000000;
    
    LED_init();
    GPIO_init();
    Serial_init();
    HTTP_init();
    
    Serial_run();
}
Exemple #22
0
int main(void)
{
	GPIO_init();
	Timer_init();
	PWM_init();
	ADC_init();
	NVIC_init();

	// infinite loop
	while (1)
	{
		
	}
}
Exemple #23
0
inline void setup_handles(void){
	myClk = CLK_init((void *)CLK_BASE_ADDR, sizeof(CLK_Obj));
	myPll = PLL_init((void *)PLL_BASE_ADDR, sizeof(PLL_Obj));
	myWDog = WDOG_init((void *)WDOG_BASE_ADDR, sizeof(WDOG_Obj));
	myCpu = CPU_init((void *)NULL, sizeof(CPU_Obj));

	myFlash = FLASH_init((void *)FLASH_BASE_ADDR, sizeof(FLASH_Obj));
	myGpio = GPIO_init((void *)GPIO_BASE_ADDR, sizeof(GPIO_Obj));
	myPie = PIE_init((void *)PIE_BASE_ADDR, sizeof(PIE_Obj));
	mySci = SCI_init((void *)SCIA_BASE_ADDR, sizeof(SCI_Obj));
	myAdc = ADC_init((void *)ADC_BASE_ADDR, sizeof(ADC_Obj));
	myPwm1 = PWM_init((void *)PWM_ePWM1_BASE_ADDR, sizeof(PWM_Obj));

}
int main(void)
{	
	u8 t;
	NVIC_Configuration();	 
	GPIO_init();
	delay_init();
	uart_init(9600);	 	//串口初始化为9600
	while(RTC_Init())		//RTC初始化	,一定要初始化成功
	{ 
		printf("RTC ERROR! \r\n");
		delay_ms(800);
		printf("RTC Trying...\r\n");
	}
	LED_test();
	while(1)
	{								    
		if(t!=calendar.sec)
		{
			t=calendar.sec;
			printf("%d year %d month %d date\r\n",calendar.w_year,calendar.w_month,calendar.w_date);
			switch(calendar.week)
			{
				case 0:
					printf("Sunday\r\n");
					break;
				case 1:
					printf("Monday\r\n");
					break;
				case 2:
					printf("Tuesday\r\n");
					break;
				case 3:
					printf("Wednesday\r\n");
					break;
				case 4:
					printf("Thursday\r\n");
					break;
				case 5:
					printf("Friday\r\n");
					break;
				case 6:
					printf("Saturday\r\n");
					break;  
			}
			printf("%d hour %d min %d sec\r\n",calendar.hour,calendar.min,calendar.sec);
		}	
		delay_ms(10);								  
	} 
}
Exemple #25
0
void main()
{
 memcpy(&RamfuncsRunStart, &RamfuncsLoadStart, (size_t)&RamfuncsLoadSize);
 WDOG_Handle myWDog;
 myWDog = WDOG_init((void *)WDOG_BASE_ADDR, sizeof(WDOG_Obj));
 WDOG_disable(myWDog);

 CLK_Handle myClk;
 PLL_Handle myPll;
 myClk = CLK_init((void *)CLK_BASE_ADDR, sizeof(CLK_Obj));
 myPll = PLL_init((void *)PLL_BASE_ADDR, sizeof(PLL_Obj));

  CLK_setOscSrc(myClk, CLK_OscSrc_Internal);

  PLL_setup(myPll, PLL_Multiplier_12, PLL_DivideSelect_ClkIn_by_2);

  GPIO_Handle myGpio;
  myGpio = GPIO_init((void *)GPIO_BASE_ADDR, sizeof(GPIO_Obj));

  GPIO_setMode(myGpio, GPIO_Number_0, GPIO_0_Mode_GeneralPurpose);
  GPIO_setDirection(myGpio, GPIO_Number_0, GPIO_Direction_Output);
  GPIO_setMode(myGpio, GPIO_Number_1, GPIO_1_Mode_GeneralPurpose);
  GPIO_setDirection(myGpio, GPIO_Number_1, GPIO_Direction_Output);
  GPIO_setMode(myGpio, GPIO_Number_2, GPIO_2_Mode_GeneralPurpose);
  GPIO_setDirection(myGpio, GPIO_Number_2, GPIO_Direction_Output);
  GPIO_setMode(myGpio, GPIO_Number_3, GPIO_3_Mode_GeneralPurpose);
  GPIO_setDirection(myGpio, GPIO_Number_3, GPIO_Direction_Output);

  GPIO_setHigh(myGpio, GPIO_Number_0);
  GPIO_setHigh(myGpio, GPIO_Number_1);
  GPIO_setHigh(myGpio, GPIO_Number_2);
  GPIO_setHigh(myGpio, GPIO_Number_3);

  while(1)
  {
    GPIO_setLow(myGpio, GPIO_Number_3);
    DELAY_US(1000000);
    GPIO_setHigh(myGpio, GPIO_Number_3);
    DELAY_US(1000000);
  }

}
Exemple #26
0
/*
 *  ======== CSL_init =========
 *  Initialize all configured CSL peripherals
 */
void CSL_init(void)
{
    /* initialize Config for the MSP430 WDT+ */
    WDTplus_init();

    /* initialize Config for the MSP430 GPIO */
    GPIO_init();

    /* initialize Config for the MSP430 2xx family clock systems (BCS) */
    BCSplus_init();

    /* initialize Config for the MSP430 USI */
    USI_init();

    /* initialize Config for the MSP430 A3 Timer0 */
    Timer0_A3_init();

    /* initialize Config for the MSP430 System Registers */
    System_init();

}
Exemple #27
0
//--------------------------------------------------------------------------------------------------------------------------
void uComOnChipInitial(void)
{
//	BYTE testi = 89;
//	BYTE test2[2] ;
//	BYTE i;
	SystemInit();
	GPIO_init();
	SetUARTFunction();		// set uart operation		right
	AnalogI2CInit();
	I2C1Init(100000);			//adv7181
	DSA_Init();
	timer0Init();
//	Delayms(2000);

	ADV_RST_LOW();
	REST_N_380_LOW();
	Delayms(500);
	ADV_RST_HIGH();
	REST_N_380_HIGH();


}
Exemple #28
0
int main(){
	uint32_t Old_timer = 0;

	// RCC clocking: 8MHz oscillator -> 72MHz system
	rcc_clock_setup_in_hse_8mhz_out_72mhz();

	GPIO_init();

	usb_disconnect(); // turn off USB while initializing all
	steppers_init();

	// USB
	usbd_dev = USB_init();

	// SysTick is a system timer with 1ms period
	SysTick_init();

	// wait a little and then turn on USB pullup
//	for (i = 0; i < 0x800000; i++)
//		__asm__("nop");

	usb_connect(); // turn on USB

	while(1){
		usbd_poll(usbd_dev);
		if(usbdatalen){ // there's something in USB buffer
			usbdatalen = parce_incoming_buf(usbdatabuf, usbdatalen);
		}
		//check_and_parce_UART(USART1); // also check data in UART buffers
		if(Timer - Old_timer > 999){ // one-second cycle
			Old_timer += 1000;
		}else if(Timer < Old_timer){ // Timer overflow
			Old_timer = 0;
		}
	}
}
Exemple #29
0
int main(void){
  
  // initialize the GPIO pins we need
  GPIO_init();

  /* This flashes the LEDs on the board once
   * Two registers are used to set the pins (pin level is VCC)
   * or to reset the pins (pin level is GND)
   */
  GPIOC->ODR = GPIO_Pin_8 | GPIO_Pin_9; // set PD8 and PC9

  while (1){  
		GPIOC->ODR |= GPIO_Pin_8; 		// set PC8 without affecting other bits
		
		if (GPIOA->IDR & GPIO_Pin_0)	// check if PA0 button is pressed
		{	
			GPIOC->ODR |= GPIO_Pin_9;	// turn on PC9
		}
		Delay(1000000L);				// wait a little
		
		GPIOC->ODR &= ~GPIO_Pin_9;		// clear PC8 and PC9
		Delay(1000000L);				// wait a little
	}
}
Exemple #30
0
/*
 *  ======== CSL_init =========
 *  Initialize all configured CSL peripherals
 */
void CSL_init(void)
{
    /* Stop watchdog timer from timing out during initial start-up. */
    WDTCTL = WDTPW + WDTHOLD;

    /* initialize Config for the MSP430 GPIO */
    GPIO_init();

    /* initialize Config for the MSP430 2xx family clock systems (BCS) */
    BCSplus_init();

    /* initialize Config for the MSP430 USCI_B0 */
    USCI_B0_init();

    /* initialize Config for the MSP430 A3 Timer */
    Timer_A3_init();

    /* initialize Config for the MSP430 System Registers */
    System_init();

    /* initialize Config for the MSP430 WDT+ */
    WDTplus_init();

}