Commit 27cdb574 authored by yids's avatar yids

- ifdefs for usb serial

- build hex file
parent 8cbc619b
Pipeline #46 skipped
......@@ -61,7 +61,7 @@
#include "AD8307PM.h"
#include "analog.h"
#include <math.h>
#include <avr/io.h>
EEMEM var_t E; // Variables in eeprom (user modifiable, stored)
var_t R // Variables in ram/flash rom (default)
......@@ -433,6 +433,7 @@ void maintask(void)
lcd_display_bargraph_16db();
}
#ifdef WITH_USB
if (R.USB_data && (Status & USB_AVAILABLE)) // Handle USB serial port, if enabled and available
{
// If Continuous USB Send mode is selected, then send data every 100ms to computer
......@@ -453,6 +454,7 @@ void maintask(void)
else if (R.USB_Flags & USBPLONG) usb_poll_long(); // Verbose message
}
}
#endif
}
wdt_reset(); // Whoops... must remember to reset that running watchdog
}
......@@ -539,11 +541,13 @@ int main(void)
_delay_ms(2000);
#ifdef WITH_USB
if (R.USB_data) // Enumerate USB serial port, if USB Serial Data enabled
{
usb_init(); // Initialize USB communications
Status&=~USB_AVAILABLE; // Disable USB communications until checked if actually available
}
#endif
wdt_enable(WDTO_1S); // Start the Watchdog Timer, 1 sec
......@@ -556,6 +560,7 @@ int main(void)
{
maintask(); // Do useful stuff
#ifdef WITH_USB
if (R.USB_data) // Do the below if USB Port has been enabled
{
// If USB port is available and not busy, then use it - otherwise mark it as blocked.
......@@ -571,5 +576,6 @@ int main(void)
//EXTLED_PORT &= ~EXT_G_LED; // Turn Green LED off, if previously on
}
}
#endif
}
}
......@@ -42,8 +42,10 @@
#include <util/delay.h>
#include <avr/power.h>
#include <lcd.h>
#ifdef WITH_USB
#include "usb_serial.h"
#endif
//
//-----------------------------------------------------------------------------
......@@ -76,8 +78,8 @@
#define MODE_INTRO_TIME 10 // Tenths of a second (10 equals 1s)
//-----------------------------------------------------------------------------
//USB Serial data out on or off
//#define USB_DATA FALSE // Default is USB Serial Port is disable
#define USB_DATA TRUE // Default is USB Serial Port is enabled
#define USB_DATA FALSE // Default is USB Serial Port is disable
//#define USB_DATA TRUE // Default is USB Serial Port is enabled
//-----------------------------------------------------------------------------
//Defs for default Gain Settings (dB *10)
#define GAINSET1 -400 // 40 dB Attenuator
......@@ -283,6 +285,7 @@ extern void lcd_display_bargraph_16db(void);
extern void lcd_display_mixed(void);
// PM_USB_Serial.c
#ifdef WITH_USB
extern void usb_poll_data(void); // Write data to USB virtual serial port
extern void usb_poll_inst(void); // Write data to USB virtual serial port
extern void usb_poll_pep(void); // Write data to USB virtual serial port
......@@ -292,6 +295,7 @@ extern void usb_poll_pepdb(void); // Write data to USB virtual serial port
extern void usb_poll_avgdb(void); // Write data to USB virtual serial port
extern void usb_poll_long(void); // Write data to USB virtual serial port
extern void usb_read_serial(void); // Read incoming messages from USB bus
#endif
// LCD Bargraph stuff
extern void lcdProgressBarPeak(uint16_t, uint16_t, uint16_t, uint8_t);
......
CFILES=AD8307PM.c AD8307PM_Display_Functions.c AD8307PM_LCD_bargraph_lowlevel.c AD8307PM_PushButtonMenu.c AD8307PM_Encoder.c AD8307PM_Print_Format_Functions.c AD8307PM_USBSerial.c
LIBCFILES=AVRLIB/lcd.c USB_serial/usb_serial.c
CFILES=AD8307PM.c AD8307PM_Display_Functions.c AD8307PM_LCD_bargraph_lowlevel.c AD8307PM_PushButtonMenu.c AD8307PM_Encoder.c AD8307PM_Print_Format_Functions.c
LIBCFILES=AVRLIB/lcd.c
OFILES=AD8307PM_Display_Functions.o AD8307PM_Encoder.o AD8307PM_LCD_bargraph_lowlevel.o AD8307PM.o AD8307PM_Print_Format_Functions.o AD8307PM_PushButtonMenu.o AD8307PM_USBSerial.o
CFLAGS=-Os -pedantic -std=gnu99
ELF=AD8307PM.elf
HEX=AD8307PM.hex
MCU=atmega328p
F_CPU=F_CPU=16000000UL
......@@ -10,6 +12,6 @@ AVRDUDE_PROGRAMMERID=stk200 /* Programmer ids are listed in /etc/avrdude.conf *
AVRDUDE_PORT=/dev/ttyUSB4
ad8307pm: AD8307PM.c
avr-gcc -g -I AVRLIB/ -IUSB_serial/ -mmcu=$(MCU) -D$(F_CPU) $(CFLAGS) $(CFILES) $(LIBCFILES) -o AD8307PM.elf
# avr-gcc -g -I AVRLIB/ -IUSB_serial/ -mmcu=$(MCU) -o AD8307PM.elf $(OFILES)
avr-gcc -g -I AVRLIB/ -mmcu=$(MCU) -D$(F_CPU) $(CFLAGS) $(CFILES) $(LIBCFILES) -o $(ELF)
avr-objcopy -j .text -j .data -O ihex $(ELF) $(HEX)
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment