Skip to content
Snippets Groups Projects
Select Git revision
  • 7335234d71e09073acd19b26784f5a7df3a1c0c1
  • master default protected
  • removing_internal_representations
3 results

Server.java

Blame
  • min2.c 3.98 KiB
    #include "msp430fr5994.h"
    #include "stdio.h"
    #include "lib/radio_drv/hal_spi_rf.h"
    #include "lib/radio_drv/hal_types.h"
    #include "lib/hal_mcu/hal_mcu_fr5.h"
    #include "lib/uart_drv/uart_drv.h"
    #include "lib/hal_mcu/hal_timer.h"
    
    /******************************************************************************
     * LOCAL FUNCTIONS
     */
    extern void msp_setup(void);
    int ee_printf(const char *fmt, ...);
    
    /******************************************************************************
     * GLOBALS
     */
    char u_str[UART_BUFF_SIZE];
    unsigned char txBuffer[TX_BUFF_SIZE];
    unsigned long volatile main_time_counter;
    
    /******************************************************************************
     * @fn         main
     *
     * @brief      Main GUI application level control loop is implemented in the
     *             main loop. It is a state machine that cycles thru various states
     *             during the interactive use by the operator. The presents a text
     *             based GUI, the user is then promted to type in a command with
     *             a given set of parameters. The state machine then calls a simpler
     *             parser that tries to figure out what the user wants to do.
     *
     * input parameters
     *
     * @param       void
     *
     * output parameters
     *
     * @return      void
     *
     */
    
    enum state_names {IDLE_RESET, WAIT, OPERATE};
    void main (void)
    {
    
    	int idle_counter = 0;
    	main_time_counter =0;
    	unsigned int waited = 0;
    
    	/*  Stop WDT */
    	WDTCTL = WDTPW + WDTHOLD;
    
    	/* Setup MSP specific functions, IO's, timers and WDT */
        //Comes from lib/hal_mcu/hal_mcu.c
    	msp_setup();
    
    	/* Initialize the UART port */
    	hal_uart_init();
    
    	// Setup the timer
      hal_timer_init(0x8000);
    
    	P1DIR |= BIT0 | BIT1;
    	P1OUT |= BIT0 | BIT1;
    	P3DIR |= BIT4;
    	P3SEL0 &= ~BIT4;
    	P3SEL1 &= ~BIT4;
    	//Setup SPI
    	/* Keep peripheral in reset state*/
    	UCB1CTLW1 |= UCSWRST;