diff --git a/DSTAT/src/config/conf_usb.h b/DSTAT/src/config/conf_usb.h index 3c72de14fe3a2083ff4d0cdab5241d495ee48834..1d927a071b56cd5c589bc18180abd5d70bdf9f81 100644 --- a/DSTAT/src/config/conf_usb.h +++ b/DSTAT/src/config/conf_usb.h @@ -146,7 +146,7 @@ //#define UDI_CDC_LOW_RATE //! Default configuration of communication port -#define UDI_CDC_DEFAULT_RATE 1024000 +#define UDI_CDC_DEFAULT_RATE 115200 #define UDI_CDC_DEFAULT_STOPBITS CDC_STOP_BITS_1 #define UDI_CDC_DEFAULT_PARITY CDC_PAR_NONE #define UDI_CDC_DEFAULT_DATABITS 8 diff --git a/DSTAT/src/main.c b/DSTAT/src/main.c index af0043a933d575ae8d2cbc493c55f60d948847df..e3f633c44c7c91c6abe74e982465cfb3d4731b99 100644 --- a/DSTAT/src/main.c +++ b/DSTAT/src/main.c @@ -23,8 +23,8 @@ int8_t command_handler(char command){ * @param command Command character input. */ - int16_t pcv1, pcv2; - uint16_t pct1, pct2; + static int16_t pcv1, pcv2; + static uint16_t pct1, pct2; switch (command){ case 'A': //ADS Buffer/rate/PGA values from ads1255.h @@ -150,21 +150,23 @@ int main(void){ ads1255_wakeup(); ads1255_rdatac(); ads1255_standby(); + + ads1255_setup(ADS_BUFF_ON,ADS_DR_60,ADS_PGA_2); + + autogain_enable = 0; + g_gain = POT_GAIN_30k; + pot_set_gain(); + - //Wait for application connection - Get 'c', reply 'K', get 'k' +// Wait for application connection - Get 'c', reply 'K', get 'k' while(1){ while(getchar() != 'c'); putchar('#'); - if (getchar() == 'k') - break; + while(getchar() != 'k'); printf("\n\r"); - } - - ads1255_setup(ADS_BUFF_ON,ADS_DR_60,ADS_PGA_2); - - autogain_enable = 0; - g_gain = POT_GAIN_30k; - pot_set_gain(); + break; + } + program_loop: while(getchar() != '!');