Browse Source

Initial commit

master
BinHong Lee 7 years ago
commit
2460e65f3c
9 changed files with 1239 additions and 0 deletions
  1. +1
    -0
      .gitignore
  2. +196
    -0
      Makefile
  3. BIN
      Project.elf
  4. +60
    -0
      Project.hex
  5. +554
    -0
      Project.map
  6. +137
    -0
      USART.c
  7. +45
    -0
      USART.h
  8. +91
    -0
      pinDefines.h
  9. +155
    -0
      sunlightAlarmClock.c

+ 1
- 0
.gitignore View File

@@ -0,0 +1 @@
*.o

+ 196
- 0
Makefile View File

@@ -0,0 +1,196 @@

##########------------------------------------------------------##########
########## Project-specific Details ##########
########## Check these every time you start a new project ##########
##########------------------------------------------------------##########

MCU = atmega168
F_CPU = 1000000UL
BAUD = 9600UL
## Also try BAUD = 19200 or 38400 if you're feeling lucky.

## A directory for common include files and the simple USART library.
## If you move either the current folder or the Library folder, you'll
## need to change this path to match.
LIBDIR = ../../AVR-Programming-Library

##########------------------------------------------------------##########
########## Programmer Defaults ##########
########## Set up once, then forget about it ##########
########## (Can override. See bottom of file.) ##########
##########------------------------------------------------------##########

PROGRAMMER_TYPE = usbtiny
# extra arguments to avrdude: baud rate, chip type, -F flag, etc.
PROGRAMMER_ARGS =

##########------------------------------------------------------##########
########## Program Locations ##########
########## Won't need to change if they're in your PATH ##########
##########------------------------------------------------------##########

CC = avr-gcc
OBJCOPY = avr-objcopy
OBJDUMP = avr-objdump
AVRSIZE = avr-size
AVRDUDE = avrdude

##########------------------------------------------------------##########
########## Makefile Magic! ##########
########## Summary: ##########
########## We want a .hex file ##########
########## Compile source files into .elf ##########
########## Convert .elf file into .hex ##########
########## You shouldn't need to edit below. ##########
##########------------------------------------------------------##########

## The name of your project (without the .c)
# TARGET = blinkLED
## Or name it automatically after the enclosing directory
TARGET = $(lastword $(subst /, ,$(CURDIR)))

# Object files: will find all .c/.h files in current directory
# and in LIBDIR. If you have any other (sub-)directories with code,
# you can add them in to SOURCES below in the wildcard statement.
SOURCES=$(wildcard *.c $(LIBDIR)/*.c)
OBJECTS=$(SOURCES:.c=.o)
HEADERS=$(SOURCES:.c=.h)

## Compilation options, type man avr-gcc if you're curious.
CPPFLAGS = -DF_CPU=$(F_CPU) -DBAUD=$(BAUD) -I. -I$(LIBDIR)
CFLAGS = -Os -g -std=gnu99 -Wall
## Use short (8-bit) data types
CFLAGS += -funsigned-char -funsigned-bitfields -fpack-struct -fshort-enums
## Splits up object files per function
CFLAGS += -ffunction-sections -fdata-sections
LDFLAGS = -Wl,-Map,$(TARGET).map
## Optional, but often ends up with smaller code
LDFLAGS += -Wl,--gc-sections
## Relax shrinks code even more, but makes disassembly messy
## LDFLAGS += -Wl,--relax
## LDFLAGS += -Wl,-u,vfprintf -lprintf_flt -lm ## for floating-point printf
## LDFLAGS += -Wl,-u,vfprintf -lprintf_min ## for smaller printf
TARGET_ARCH = -mmcu=$(MCU)

## Explicit pattern rules:
## To make .o files from .c files
%.o: %.c $(HEADERS) Makefile
$(CC) $(CFLAGS) $(CPPFLAGS) $(TARGET_ARCH) -c -o $@ $<;

$(TARGET).elf: $(OBJECTS)
$(CC) $(LDFLAGS) $(TARGET_ARCH) $^ $(LDLIBS) -o $@

%.hex: %.elf
$(OBJCOPY) -j .text -j .data -O ihex $< $@

%.eeprom: %.elf
$(OBJCOPY) -j .eeprom --change-section-lma .eeprom=0 -O ihex $< $@

%.lst: %.elf
$(OBJDUMP) -S $< > $@

## These targets don't have files named after them
.PHONY: all disassemble disasm eeprom size clean squeaky_clean flash fuses

all: $(TARGET).hex

debug:
@echo
@echo "Source files:" $(SOURCES)
@echo "MCU, F_CPU, BAUD:" $(MCU), $(F_CPU), $(BAUD)
@echo

# Optionally create listing file from .elf
# This creates approximate assembly-language equivalent of your code.
# Useful for debugging time-sensitive bits,
# or making sure the compiler does what you want.
disassemble: $(TARGET).lst

disasm: disassemble

# Optionally show how big the resulting program is
size: $(TARGET).elf
$(AVRSIZE) -C --mcu=$(MCU) $(TARGET).elf

clean:
rm -f $(TARGET).elf $(TARGET).hex $(TARGET).obj \
$(TARGET).o $(TARGET).d $(TARGET).eep $(TARGET).lst \
$(TARGET).lss $(TARGET).sym $(TARGET).map $(TARGET)~ \
$(TARGET).eeprom

squeaky_clean:
rm -f *.elf *.hex *.obj *.o *.d *.eep *.lst *.lss *.sym *.map *~ *.eeprom

##########------------------------------------------------------##########
########## Programmer-specific details ##########
########## Flashing code to AVR using avrdude ##########
##########------------------------------------------------------##########

flash: $(TARGET).hex
$(AVRDUDE) -c $(PROGRAMMER_TYPE) -p $(MCU) $(PROGRAMMER_ARGS) -U flash:w:$<

## An alias
program: flash

flash_eeprom: $(TARGET).eeprom
$(AVRDUDE) -c $(PROGRAMMER_TYPE) -p $(MCU) $(PROGRAMMER_ARGS) -U eeprom:w:$<

avrdude_terminal:
$(AVRDUDE) -c $(PROGRAMMER_TYPE) -p $(MCU) $(PROGRAMMER_ARGS) -nt

## If you've got multiple programmers that you use,
## you can define them here so that it's easy to switch.
## To invoke, use something like `make flash_arduinoISP`
flash_usbtiny: PROGRAMMER_TYPE = usbtiny
flash_usbtiny: PROGRAMMER_ARGS = # USBTiny works with no further arguments
flash_usbtiny: flash

flash_usbasp: PROGRAMMER_TYPE = usbasp
flash_usbasp: PROGRAMMER_ARGS = # USBasp works with no further arguments
flash_usbasp: flash

flash_arduinoISP: PROGRAMMER_TYPE = avrisp
flash_arduinoISP: PROGRAMMER_ARGS = -b 19200 -P /dev/ttyACM0
## (for windows) flash_arduinoISP: PROGRAMMER_ARGS = -b 19200 -P com5
flash_arduinoISP: flash

flash_109: PROGRAMMER_TYPE = avr109
flash_109: PROGRAMMER_ARGS = -b 9600 -P /dev/ttyUSB0
flash_109: flash

##########------------------------------------------------------##########
########## Fuse settings and suitable defaults ##########
##########------------------------------------------------------##########

## Mega 48, 88, 168, 328 default values
LFUSE = 0x62
HFUSE = 0xdf
EFUSE = 0x00

## Generic
FUSE_STRING = -U lfuse:w:$(LFUSE):m -U hfuse:w:$(HFUSE):m -U efuse:w:$(EFUSE):m

fuses:
$(AVRDUDE) -c $(PROGRAMMER_TYPE) -p $(MCU) \
$(PROGRAMMER_ARGS) $(FUSE_STRING)
show_fuses:
$(AVRDUDE) -c $(PROGRAMMER_TYPE) -p $(MCU) $(PROGRAMMER_ARGS) -nv

## Called with no extra definitions, sets to defaults
set_default_fuses: FUSE_STRING = -U lfuse:w:$(LFUSE):m -U hfuse:w:$(HFUSE):m -U efuse:w:$(EFUSE):m
set_default_fuses: fuses

## Set the fuse byte for full-speed mode
## Note: can also be set in firmware for modern chips
set_fast_fuse: LFUSE = 0xE2
set_fast_fuse: FUSE_STRING = -U lfuse:w:$(LFUSE):m
set_fast_fuse: fuses

## Set the EESAVE fuse byte to preserve EEPROM across flashes
set_eeprom_save_fuse: HFUSE = 0xD7
set_eeprom_save_fuse: FUSE_STRING = -U hfuse:w:$(HFUSE):m
set_eeprom_save_fuse: fuses

## Clear the EESAVE fuse byte
clear_eeprom_save_fuse: FUSE_STRING = -U hfuse:w:$(HFUSE):m
clear_eeprom_save_fuse: fuses

BIN
Project.elf View File


+ 60
- 0
Project.hex View File

@@ -0,0 +1,60 @@
:100000000C9434000C9451000C9451000C94510049
:100010000C9451000C94A8000C9451000C945100C5
:100020000C9451000C9451000C9451000C9451000C
:100030000C9451000C9451000C9451000C945100FC
:100040000C9451000C9451000C9451000C945100EC
:100050000C9451000C9451000C9451000C945100DC
:100060000C9451000C94510011241FBECFEFD4E02A
:10007000DEBFCDBF11E0A0E0B1E0E0EEF2E002C0F3
:1000800005900D92AC3CB107D9F721E0ACECB1E0A2
:1000900001C01D92A13DB207E1F70E9417010C9427
:1000A0006E010C9400001092C5008CE08093C40097
:1000B000E0ECF0E080818260808388E18093C10081
:1000C00086E08093C20008959091C00095FFFCCF18
:1000D0008093C60008958091C00087FFFCCF809177
:1000E000C60008950F931F93CF938C01C0E0F801D1
:1000F000EC0FF11D8081811104C0CF911F910F91F0
:1001000008950E946400CF5FF2CF0F931F93CF93A7
:10011000DF93C0E3D0E310E30E946B00082F0E943E
:1001200064000D3089F4105380ED8C0F94E6199F14
:10013000800D1124D0539AE0D99F800D1124DF91B6
:10014000CF911F910F9108951D2FDC2FC02FE4CF69
:100150001F920F920FB60F9211242F933F934F933C
:100160005F936F937F938F939F93AF93BF93EF931F
:10017000FF93289B24C0289810920101109200013F
:1001800080E090E02091CE013091CF01821793075B
:100190000CF11092CD011092CC01DA9AFF91EF91FF
:1001A000BF91AF919F918F917F916F915F914F918F
:1001B0003F912F910F900FBE0F901F90189581E0E7
:1001C00090E0909301018093000182E091E00E9411
:1001D0007200D6CFE3ECF9E03197F1F700C00000F0
:1001E0000196D0CF81E291E00E9472000E948500CA
:1001F0008093D0010E946B008091D00181508630A5
:1002000088F708958AE591E00E9472000E948500B7
:1002100090E09093CF018093CE010E946B0080917B
:10022000CE019091CF01893C910560F708958091AE
:100230007C00806480937C0080917A00846080934D
:100240007A0080917A00806880937A0080916800BB
:1002500084608093680080916D00846080936D005D
:1002600085B7806185BF78940E9453008EE991E044
:100270000E947200209A0E94F2000E940201C1E0D6
:10028000D0E0809100019091010118161906CCF779
:1002900080917A00806480937A0080917A0086FD54
:1002A000FCCF8091780090917900880F892F881F6A
:1002B000990B91959091D001981718F78091CC01E6
:1002C0009091CD01892BE9F6289A80EC91E00E946B
:1002D0007200D093CD01C093CC01D3CFF894FFCF5F
:1002E0000100596F7527726520616C6C207365740D
:1002F00021204F666620746F20736C656570210A3B
:1003000000576861742073656E73697469766974E7
:100310007920646F20796F752077616E742069741D
:1003200020746F2062653F20285363616C65206FE5
:10033000662031202D2036290A00486F77206C6F07
:100340006E6720646F20796F752077616E742074FA
:1003500068652064656C617920746F2062653F2058
:100360002831203D2031306D732C205363616C6542
:10037000206F662030202D20323030290A002D2DAC
:100380002D2D2053756E7269736520416C61726DFD
:1003900020436C6F636B202D2D2D2D2D2D0D0A000C
:0C03A00057414B455550212121210A00F6
:00000001FF

+ 554
- 0
Project.map View File

@@ -0,0 +1,554 @@
Archive member included to satisfy reference by file (symbol)

/usr/local/lib/gcc/avr/6.2.0/avr5/libgcc.a(_udivmodqi4.o)
USART.o (__udivmodqi4)
/usr/local/lib/gcc/avr/6.2.0/avr5/libgcc.a(_udivmodhi4.o)
USART.o (__udivmodhi4)
/usr/local/lib/gcc/avr/6.2.0/avr5/libgcc.a(_exit.o)
/usr/local/lib/gcc/avr/6.2.0/../../../../avr/lib/avr5/crtatmega168.o (exit)
/usr/local/lib/gcc/avr/6.2.0/avr5/libgcc.a(_copy_data.o)
sunlightAlarmClock.o (__do_copy_data)
/usr/local/lib/gcc/avr/6.2.0/avr5/libgcc.a(_clear_bss.o)
sunlightAlarmClock.o (__do_clear_bss)

Allocating common symbols
Common symbol size file

delay 0x2 sunlightAlarmClock.o
sensitivity 0x1 sunlightAlarmClock.o

Discarded input sections

.data 0x0000000000000000 0x0 /usr/local/lib/gcc/avr/6.2.0/../../../../avr/lib/avr5/crtatmega168.o
.bss 0x0000000000000000 0x0 /usr/local/lib/gcc/avr/6.2.0/../../../../avr/lib/avr5/crtatmega168.o
.text 0x0000000000000000 0x0 USART.o
.data 0x0000000000000000 0x0 USART.o
.bss 0x0000000000000000 0x0 USART.o
.text.readString
0x0000000000000000 0x58 USART.o
.text.printByte
0x0000000000000000 0x32 USART.o
.text.printWord
0x0000000000000000 0x76 USART.o
.text.printBinaryByte
0x0000000000000000 0x44 USART.o
.text.nibbleToHexCharacter
0x0000000000000000 0xc USART.o
.text.printHexByte
0x0000000000000000 0x1e USART.o
.text 0x0000000000000000 0x0 sunlightAlarmClock.o
.data 0x0000000000000000 0x0 sunlightAlarmClock.o
.bss 0x0000000000000000 0x0 sunlightAlarmClock.o
.text 0x0000000000000000 0x0 /usr/local/lib/gcc/avr/6.2.0/avr5/libgcc.a(_udivmodqi4.o)
.data 0x0000000000000000 0x0 /usr/local/lib/gcc/avr/6.2.0/avr5/libgcc.a(_udivmodqi4.o)
.bss 0x0000000000000000 0x0 /usr/local/lib/gcc/avr/6.2.0/avr5/libgcc.a(_udivmodqi4.o)
.stab 0x0000000000000000 0xe4 /usr/local/lib/gcc/avr/6.2.0/avr5/libgcc.a(_udivmodqi4.o)
0xf0 (size before relaxing)
.text.libgcc.mul
0x0000000000000000 0x0 /usr/local/lib/gcc/avr/6.2.0/avr5/libgcc.a(_udivmodqi4.o)
.text.libgcc.div
0x0000000000000000 0x18 /usr/local/lib/gcc/avr/6.2.0/avr5/libgcc.a(_udivmodqi4.o)
.text.libgcc 0x0000000000000000 0x0 /usr/local/lib/gcc/avr/6.2.0/avr5/libgcc.a(_udivmodqi4.o)
.text.libgcc.prologue
0x0000000000000000 0x0 /usr/local/lib/gcc/avr/6.2.0/avr5/libgcc.a(_udivmodqi4.o)
.text.libgcc.builtins
0x0000000000000000 0x0 /usr/local/lib/gcc/avr/6.2.0/avr5/libgcc.a(_udivmodqi4.o)
.text.libgcc.fmul
0x0000000000000000 0x0 /usr/local/lib/gcc/avr/6.2.0/avr5/libgcc.a(_udivmodqi4.o)
.text.libgcc.fixed
0x0000000000000000 0x0 /usr/local/lib/gcc/avr/6.2.0/avr5/libgcc.a(_udivmodqi4.o)
.text 0x0000000000000000 0x0 /usr/local/lib/gcc/avr/6.2.0/avr5/libgcc.a(_udivmodhi4.o)
.data 0x0000000000000000 0x0 /usr/local/lib/gcc/avr/6.2.0/avr5/libgcc.a(_udivmodhi4.o)
.bss 0x0000000000000000 0x0 /usr/local/lib/gcc/avr/6.2.0/avr5/libgcc.a(_udivmodhi4.o)
.stab 0x0000000000000000 0x15c /usr/local/lib/gcc/avr/6.2.0/avr5/libgcc.a(_udivmodhi4.o)
0x168 (size before relaxing)
.text.libgcc.mul
0x0000000000000000 0x0 /usr/local/lib/gcc/avr/6.2.0/avr5/libgcc.a(_udivmodhi4.o)
.text.libgcc.div
0x0000000000000000 0x28 /usr/local/lib/gcc/avr/6.2.0/avr5/libgcc.a(_udivmodhi4.o)
.text.libgcc 0x0000000000000000 0x0 /usr/local/lib/gcc/avr/6.2.0/avr5/libgcc.a(_udivmodhi4.o)
.text.libgcc.prologue
0x0000000000000000 0x0 /usr/local/lib/gcc/avr/6.2.0/avr5/libgcc.a(_udivmodhi4.o)
.text.libgcc.builtins
0x0000000000000000 0x0 /usr/local/lib/gcc/avr/6.2.0/avr5/libgcc.a(_udivmodhi4.o)
.text.libgcc.fmul
0x0000000000000000 0x0 /usr/local/lib/gcc/avr/6.2.0/avr5/libgcc.a(_udivmodhi4.o)
.text.libgcc.fixed
0x0000000000000000 0x0 /usr/local/lib/gcc/avr/6.2.0/avr5/libgcc.a(_udivmodhi4.o)
.text 0x0000000000000000 0x0 /usr/local/lib/gcc/avr/6.2.0/avr5/libgcc.a(_exit.o)
.data 0x0000000000000000 0x0 /usr/local/lib/gcc/avr/6.2.0/avr5/libgcc.a(_exit.o)
.bss 0x0000000000000000 0x0 /usr/local/lib/gcc/avr/6.2.0/avr5/libgcc.a(_exit.o)
.text.libgcc.mul
0x0000000000000000 0x0 /usr/local/lib/gcc/avr/6.2.0/avr5/libgcc.a(_exit.o)
.text.libgcc.div
0x0000000000000000 0x0 /usr/local/lib/gcc/avr/6.2.0/avr5/libgcc.a(_exit.o)
.text.libgcc 0x0000000000000000 0x0 /usr/local/lib/gcc/avr/6.2.0/avr5/libgcc.a(_exit.o)
.text.libgcc.prologue
0x0000000000000000 0x0 /usr/local/lib/gcc/avr/6.2.0/avr5/libgcc.a(_exit.o)
.text.libgcc.builtins
0x0000000000000000 0x0 /usr/local/lib/gcc/avr/6.2.0/avr5/libgcc.a(_exit.o)
.text.libgcc.fmul
0x0000000000000000 0x0 /usr/local/lib/gcc/avr/6.2.0/avr5/libgcc.a(_exit.o)
.text.libgcc.fixed
0x0000000000000000 0x0 /usr/local/lib/gcc/avr/6.2.0/avr5/libgcc.a(_exit.o)
.text 0x0000000000000000 0x0 /usr/local/lib/gcc/avr/6.2.0/avr5/libgcc.a(_copy_data.o)
.data 0x0000000000000000 0x0 /usr/local/lib/gcc/avr/6.2.0/avr5/libgcc.a(_copy_data.o)
.bss 0x0000000000000000 0x0 /usr/local/lib/gcc/avr/6.2.0/avr5/libgcc.a(_copy_data.o)
.text.libgcc.mul
0x0000000000000000 0x0 /usr/local/lib/gcc/avr/6.2.0/avr5/libgcc.a(_copy_data.o)
.text.libgcc.div
0x0000000000000000 0x0 /usr/local/lib/gcc/avr/6.2.0/avr5/libgcc.a(_copy_data.o)
.text.libgcc 0x0000000000000000 0x0 /usr/local/lib/gcc/avr/6.2.0/avr5/libgcc.a(_copy_data.o)
.text.libgcc.prologue
0x0000000000000000 0x0 /usr/local/lib/gcc/avr/6.2.0/avr5/libgcc.a(_copy_data.o)
.text.libgcc.builtins
0x0000000000000000 0x0 /usr/local/lib/gcc/avr/6.2.0/avr5/libgcc.a(_copy_data.o)
.text.libgcc.fmul
0x0000000000000000 0x0 /usr/local/lib/gcc/avr/6.2.0/avr5/libgcc.a(_copy_data.o)
.text.libgcc.fixed
0x0000000000000000 0x0 /usr/local/lib/gcc/avr/6.2.0/avr5/libgcc.a(_copy_data.o)
.text 0x0000000000000000 0x0 /usr/local/lib/gcc/avr/6.2.0/avr5/libgcc.a(_clear_bss.o)
.data 0x0000000000000000 0x0 /usr/local/lib/gcc/avr/6.2.0/avr5/libgcc.a(_clear_bss.o)
.bss 0x0000000000000000 0x0 /usr/local/lib/gcc/avr/6.2.0/avr5/libgcc.a(_clear_bss.o)
.text.libgcc.mul
0x0000000000000000 0x0 /usr/local/lib/gcc/avr/6.2.0/avr5/libgcc.a(_clear_bss.o)
.text.libgcc.div
0x0000000000000000 0x0 /usr/local/lib/gcc/avr/6.2.0/avr5/libgcc.a(_clear_bss.o)
.text.libgcc 0x0000000000000000 0x0 /usr/local/lib/gcc/avr/6.2.0/avr5/libgcc.a(_clear_bss.o)
.text.libgcc.prologue
0x0000000000000000 0x0 /usr/local/lib/gcc/avr/6.2.0/avr5/libgcc.a(_clear_bss.o)
.text.libgcc.builtins
0x0000000000000000 0x0 /usr/local/lib/gcc/avr/6.2.0/avr5/libgcc.a(_clear_bss.o)
.text.libgcc.fmul
0x0000000000000000 0x0 /usr/local/lib/gcc/avr/6.2.0/avr5/libgcc.a(_clear_bss.o)
.text.libgcc.fixed
0x0000000000000000 0x0 /usr/local/lib/gcc/avr/6.2.0/avr5/libgcc.a(_clear_bss.o)

Memory Configuration

Name Origin Length Attributes
text 0x0000000000000000 0x0000000000020000 xr
data 0x0000000000800060 0x000000000000ffa0 rw !x
eeprom 0x0000000000810000 0x0000000000010000 rw !x
fuse 0x0000000000820000 0x0000000000000400 rw !x
lock 0x0000000000830000 0x0000000000000400 rw !x
signature 0x0000000000840000 0x0000000000000400 rw !x
user_signatures 0x0000000000850000 0x0000000000000400 rw !x
*default* 0x0000000000000000 0xffffffffffffffff

Linker script and memory map

Address of section .data set to 0x800100
LOAD /usr/local/lib/gcc/avr/6.2.0/../../../../avr/lib/avr5/crtatmega168.o
LOAD USART.o
LOAD sunlightAlarmClock.o
START GROUP
LOAD /usr/local/lib/gcc/avr/6.2.0/avr5/libgcc.a
LOAD /usr/local/lib/gcc/avr/6.2.0/../../../../avr/lib/avr5/libm.a
LOAD /usr/local/lib/gcc/avr/6.2.0/../../../../avr/lib/avr5/libc.a
LOAD /usr/local/lib/gcc/avr/6.2.0/../../../../avr/lib/avr5/libatmega168.a
END GROUP
0x0000000000020000 __TEXT_REGION_LENGTH__ = DEFINED (__TEXT_REGION_LENGTH__)?__TEXT_REGION_LENGTH__:0x20000
0x000000000000ffa0 __DATA_REGION_LENGTH__ = DEFINED (__DATA_REGION_LENGTH__)?__DATA_REGION_LENGTH__:0xffa0
0x0000000000010000 __EEPROM_REGION_LENGTH__ = DEFINED (__EEPROM_REGION_LENGTH__)?__EEPROM_REGION_LENGTH__:0x10000
0x0000000000000400 __FUSE_REGION_LENGTH__ = DEFINED (__FUSE_REGION_LENGTH__)?__FUSE_REGION_LENGTH__:0x400
0x0000000000000400 __LOCK_REGION_LENGTH__ = DEFINED (__LOCK_REGION_LENGTH__)?__LOCK_REGION_LENGTH__:0x400
0x0000000000000400 __SIGNATURE_REGION_LENGTH__ = DEFINED (__SIGNATURE_REGION_LENGTH__)?__SIGNATURE_REGION_LENGTH__:0x400
0x0000000000000400 __USER_SIGNATURE_REGION_LENGTH__ = DEFINED (__USER_SIGNATURE_REGION_LENGTH__)?__USER_SIGNATURE_REGION_LENGTH__:0x400

.hash
*(.hash)

.dynsym
*(.dynsym)

.dynstr
*(.dynstr)

.gnu.version
*(.gnu.version)

.gnu.version_d
*(.gnu.version_d)

.gnu.version_r
*(.gnu.version_r)

.rel.init
*(.rel.init)

.rela.init
*(.rela.init)

.rel.text
*(.rel.text)
*(.rel.text.*)
*(.rel.gnu.linkonce.t*)

.rela.text
*(.rela.text)
*(.rela.text.*)
*(.rela.gnu.linkonce.t*)

.rel.fini
*(.rel.fini)

.rela.fini
*(.rela.fini)

.rel.rodata
*(.rel.rodata)
*(.rel.rodata.*)
*(.rel.gnu.linkonce.r*)

.rela.rodata
*(.rela.rodata)
*(.rela.rodata.*)
*(.rela.gnu.linkonce.r*)

.rel.data
*(.rel.data)
*(.rel.data.*)
*(.rel.gnu.linkonce.d*)

.rela.data
*(.rela.data)
*(.rela.data.*)
*(.rela.gnu.linkonce.d*)

.rel.ctors
*(.rel.ctors)

.rela.ctors
*(.rela.ctors)

.rel.dtors
*(.rel.dtors)

.rela.dtors
*(.rela.dtors)

.rel.got
*(.rel.got)

.rela.got
*(.rela.got)

.rel.bss
*(.rel.bss)

.rela.bss
*(.rela.bss)

.rel.plt
*(.rel.plt)

.rela.plt
*(.rela.plt)

.text 0x0000000000000000 0x2e0
*(.vectors)
.vectors 0x0000000000000000 0x68 /usr/local/lib/gcc/avr/6.2.0/../../../../avr/lib/avr5/crtatmega168.o
0x0000000000000000 __vectors
0x0000000000000000 __vector_default
*(.vectors)
*(.progmem.gcc*)
0x0000000000000068 . = ALIGN (0x2)
0x0000000000000068 __trampolines_start = .
*(.trampolines)
.trampolines 0x0000000000000068 0x0 linker stubs
*(.trampolines*)
0x0000000000000068 __trampolines_end = .
*libprintf_flt.a:*(.progmem.data)
*libc.a:*(.progmem.data)
*(.progmem*)
0x0000000000000068 . = ALIGN (0x2)
*(.jumptables)
*(.jumptables*)
*(.lowtext)
*(.lowtext*)
0x0000000000000068 __ctors_start = .
*(.ctors)
0x0000000000000068 __ctors_end = .
0x0000000000000068 __dtors_start = .
*(.dtors)
0x0000000000000068 __dtors_end = .
SORT(*)(.ctors)
SORT(*)(.dtors)
*(.init0)
.init0 0x0000000000000068 0x0 /usr/local/lib/gcc/avr/6.2.0/../../../../avr/lib/avr5/crtatmega168.o
0x0000000000000068 __init
*(.init0)
*(.init1)
*(.init1)
*(.init2)
.init2 0x0000000000000068 0xc /usr/local/lib/gcc/avr/6.2.0/../../../../avr/lib/avr5/crtatmega168.o
*(.init2)
*(.init3)
*(.init3)
*(.init4)
.init4 0x0000000000000074 0x16 /usr/local/lib/gcc/avr/6.2.0/avr5/libgcc.a(_copy_data.o)
0x0000000000000074 __do_copy_data
.init4 0x000000000000008a 0x10 /usr/local/lib/gcc/avr/6.2.0/avr5/libgcc.a(_clear_bss.o)
0x000000000000008a __do_clear_bss
*(.init4)
*(.init5)
*(.init5)
*(.init6)
*(.init6)
*(.init7)
*(.init7)
*(.init8)
*(.init8)
*(.init9)
.init9 0x000000000000009a 0x8 /usr/local/lib/gcc/avr/6.2.0/../../../../avr/lib/avr5/crtatmega168.o
*(.init9)
*(.text)
.text 0x00000000000000a2 0x4 /usr/local/lib/gcc/avr/6.2.0/../../../../avr/lib/avr5/crtatmega168.o
0x00000000000000a2 __vector_20
0x00000000000000a2 __vector_1
0x00000000000000a2 __vector_24
0x00000000000000a2 __vector_12
0x00000000000000a2 __bad_interrupt
0x00000000000000a2 __vector_6
0x00000000000000a2 __vector_3
0x00000000000000a2 __vector_23
0x00000000000000a2 __vector_25
0x00000000000000a2 __vector_11
0x00000000000000a2 __vector_13
0x00000000000000a2 __vector_17
0x00000000000000a2 __vector_19
0x00000000000000a2 __vector_7
0x00000000000000a2 __vector_4
0x00000000000000a2 __vector_9
0x00000000000000a2 __vector_2
0x00000000000000a2 __vector_21
0x00000000000000a2 __vector_15
0x00000000000000a2 __vector_8
0x00000000000000a2 __vector_14
0x00000000000000a2 __vector_10
0x00000000000000a2 __vector_16
0x00000000000000a2 __vector_18
0x00000000000000a2 __vector_22
0x00000000000000a6 . = ALIGN (0x2)
*(.text.*)
.text.initUSART
0x00000000000000a6 0x22 USART.o
0x00000000000000a6 initUSART
.text.transmitByte
0x00000000000000c8 0xe USART.o
0x00000000000000c8 transmitByte
.text.receiveByte
0x00000000000000d6 0xe USART.o
0x00000000000000d6 receiveByte
.text.printString
0x00000000000000e4 0x26 USART.o
0x00000000000000e4 printString
.text.getNumber
0x000000000000010a 0x46 USART.o
0x000000000000010a getNumber
.text.__vector_5
0x0000000000000150 0x94 sunlightAlarmClock.o
0x0000000000000150 __vector_5
.text.setSensitivity
0x00000000000001e4 0x20 sunlightAlarmClock.o
0x00000000000001e4 setSensitivity
.text.setDelay
0x0000000000000204 0x2a sunlightAlarmClock.o
0x0000000000000204 setDelay
.text.startup.main
0x000000000000022e 0xae sunlightAlarmClock.o
0x000000000000022e main
0x00000000000002dc . = ALIGN (0x2)
*(.fini9)
.fini9 0x00000000000002dc 0x0 /usr/local/lib/gcc/avr/6.2.0/avr5/libgcc.a(_exit.o)
0x00000000000002dc exit
0x00000000000002dc _exit
*(.fini9)
*(.fini8)
*(.fini8)
*(.fini7)
*(.fini7)
*(.fini6)
*(.fini6)
*(.fini5)
*(.fini5)
*(.fini4)
*(.fini4)
*(.fini3)
*(.fini3)
*(.fini2)
*(.fini2)
*(.fini1)
*(.fini1)
*(.fini0)
.fini0 0x00000000000002dc 0x4 /usr/local/lib/gcc/avr/6.2.0/avr5/libgcc.a(_exit.o)
*(.fini0)
0x00000000000002e0 _etext = .

.data 0x0000000000800100 0xcc load address 0x00000000000002e0
0x0000000000800100 PROVIDE (__data_start, .)
*(.data)
*(.data*)
.data.enabled 0x0000000000800100 0x2 sunlightAlarmClock.o
0x0000000000800100 enabled
*(.rodata)
*(.rodata*)
.rodata.__vector_5.str1.1
0x0000000000800102 0x1f sunlightAlarmClock.o
.rodata.setSensitivity.str1.1
0x0000000000800121 0x39 sunlightAlarmClock.o
.rodata.setDelay.str1.1
0x000000000080015a 0x44 sunlightAlarmClock.o
.rodata.main.str1.1
0x000000000080019e 0x2e sunlightAlarmClock.o
*(.gnu.linkonce.d*)
0x00000000008001cc . = ALIGN (0x2)
0x00000000008001cc _edata = .
0x00000000008001cc PROVIDE (__data_end, .)

.bss 0x00000000008001cc 0x5
0x00000000008001cc PROVIDE (__bss_start, .)
*(.bss)
*(.bss*)
.bss.printed 0x00000000008001cc 0x2 sunlightAlarmClock.o
0x00000000008001cc printed
*(COMMON)
COMMON 0x00000000008001ce 0x3 sunlightAlarmClock.o
0x00000000008001ce delay
0x00000000008001d0 sensitivity
0x00000000008001d1 PROVIDE (__bss_end, .)
0x00000000000002e0 __data_load_start = LOADADDR (.data)
0x00000000000003ac __data_load_end = (__data_load_start + SIZEOF (.data))

.noinit 0x00000000008001d1 0x0
[!provide] PROVIDE (__noinit_start, .)
*(.noinit*)
[!provide] PROVIDE (__noinit_end, .)
0x00000000008001d1 _end = .
[!provide] PROVIDE (__heap_start, .)

.eeprom 0x0000000000810000 0x0
*(.eeprom*)
0x0000000000810000 __eeprom_end = .

.fuse
*(.fuse)
*(.lfuse)
*(.hfuse)
*(.efuse)

.lock
*(.lock*)

.signature
*(.signature*)

.stab 0x0000000000000000 0xfcc
*(.stab)
.stab 0x0000000000000000 0x750 USART.o
0xa98 (size before relaxing)
.stab 0x0000000000000750 0x684 sunlightAlarmClock.o
0x84c (size before relaxing)
.stab 0x0000000000000dd4 0x6c /usr/local/lib/gcc/avr/6.2.0/avr5/libgcc.a(_exit.o)
0x78 (size before relaxing)
.stab 0x0000000000000e40 0xd8 /usr/local/lib/gcc/avr/6.2.0/avr5/libgcc.a(_copy_data.o)
0xe4 (size before relaxing)
.stab 0x0000000000000f18 0xb4 /usr/local/lib/gcc/avr/6.2.0/avr5/libgcc.a(_clear_bss.o)
0xc0 (size before relaxing)

.stabstr 0x0000000000000000 0x113c
*(.stabstr)
.stabstr 0x0000000000000000 0x113c USART.o

.stab.excl
*(.stab.excl)

.stab.exclstr
*(.stab.exclstr)

.stab.index
*(.stab.index)

.stab.indexstr
*(.stab.indexstr)

.comment 0x0000000000000000 0x11
*(.comment)
.comment 0x0000000000000000 0x11 USART.o
0x12 (size before relaxing)
.comment 0x0000000000000011 0x12 sunlightAlarmClock.o

.note.gnu.avr.deviceinfo
0x0000000000000000 0x3c
.note.gnu.avr.deviceinfo
0x0000000000000000 0x3c /usr/local/lib/gcc/avr/6.2.0/../../../../avr/lib/avr5/crtatmega168.o

.note.gnu.build-id
*(.note.gnu.build-id)

.debug
*(.debug)

.line
*(.line)

.debug_srcinfo
*(.debug_srcinfo)

.debug_sfnames
*(.debug_sfnames)

.debug_aranges
*(.debug_aranges)

.debug_pubnames
*(.debug_pubnames)

.debug_info 0x0000000000000000 0x5f4
*(.debug_info .gnu.linkonce.wi.*)
.debug_info 0x0000000000000000 0x5f4 /usr/local/lib/gcc/avr/6.2.0/../../../../avr/lib/avr5/crtatmega168.o

.debug_abbrev 0x0000000000000000 0x5a2
*(.debug_abbrev)
.debug_abbrev 0x0000000000000000 0x5a2 /usr/local/lib/gcc/avr/6.2.0/../../../../avr/lib/avr5/crtatmega168.o

.debug_line 0x0000000000000000 0x1d
*(.debug_line .debug_line.* .debug_line_end)
.debug_line 0x0000000000000000 0x1d /usr/local/lib/gcc/avr/6.2.0/../../../../avr/lib/avr5/crtatmega168.o

.debug_frame
*(.debug_frame)

.debug_str 0x0000000000000000 0x208
*(.debug_str)
.debug_str 0x0000000000000000 0x208 /usr/local/lib/gcc/avr/6.2.0/../../../../avr/lib/avr5/crtatmega168.o

.debug_loc
*(.debug_loc)

.debug_macinfo
*(.debug_macinfo)

.debug_weaknames
*(.debug_weaknames)

.debug_funcnames
*(.debug_funcnames)

.debug_typenames
*(.debug_typenames)

.debug_varnames
*(.debug_varnames)

.debug_pubtypes
*(.debug_pubtypes)

.debug_ranges
*(.debug_ranges)

.debug_macro
*(.debug_macro)
OUTPUT(Project.elf elf32-avr)
LOAD linker stubs

+ 137
- 0
USART.c View File

@@ -0,0 +1,137 @@

/*
Quick and dirty functions that make serial communications work.

Note that receiveByte() blocks -- it sits and waits _forever_ for
a byte to come in. If you're doing anything that's more interesting,
you'll want to implement this with interrupts.

initUSART requires BAUDRATE to be defined in order to calculate
the bit-rate multiplier. 9600 is a reasonable default.

May not work with some of the older chips:
Tiny2313, Mega8, Mega16, Mega32 have different pin macros
If you're using these chips, see (e.g.) iom8.h for how it's done.
These old chips don't specify UDR0 vs UDR1.
Correspondingly, the macros will just be defined as UDR.
*/

#include <avr/io.h>
#include "USART.h"
#include <util/setbaud.h>

void initUSART(void) { /* requires BAUD */
UBRR0H = UBRRH_VALUE; /* defined in setbaud.h */
UBRR0L = UBRRL_VALUE;
#if USE_2X
UCSR0A |= (1 << U2X0);
#else
UCSR0A &= ~(1 << U2X0);
#endif
/* Enable USART transmitter/receiver */
UCSR0B = (1 << TXEN0) | (1 << RXEN0);
UCSR0C = (1 << UCSZ01) | (1 << UCSZ00); /* 8 data bits, 1 stop bit */
}


void transmitByte(uint8_t data) {
/* Wait for empty transmit buffer */
loop_until_bit_is_set(UCSR0A, UDRE0);
UDR0 = data; /* send data */
}

uint8_t receiveByte(void) {
loop_until_bit_is_set(UCSR0A, RXC0); /* Wait for incoming data */
return UDR0; /* return register value */
}


/* Here are a bunch of useful printing commands */

void printString(const char myString[]) {
uint8_t i = 0;
while (myString[i]) {
transmitByte(myString[i]);
i++;
}
}

void readString(char myString[], uint8_t maxLength) {
char response;
uint8_t i;
i = 0;
while (i < (maxLength - 1)) { /* prevent over-runs */
response = receiveByte();
transmitByte(response); /* echo */
if (response == '\r') { /* enter marks the end */
break;
}
else {
myString[i] = response; /* add in a letter */
i++;
}
}
myString[i] = 0; /* terminal NULL character */
}

void printByte(uint8_t byte) {
/* Converts a byte to a string of decimal text, sends it */
transmitByte('0' + (byte / 100)); /* Hundreds */
transmitByte('0' + ((byte / 10) % 10)); /* Tens */
transmitByte('0' + (byte % 10)); /* Ones */
}

void printWord(uint16_t word) {
transmitByte('0' + (word / 10000)); /* Ten-thousands */
transmitByte('0' + ((word / 1000) % 10)); /* Thousands */
transmitByte('0' + ((word / 100) % 10)); /* Hundreds */
transmitByte('0' + ((word / 10) % 10)); /* Tens */
transmitByte('0' + (word % 10)); /* Ones */
}

void printBinaryByte(uint8_t byte) {
/* Prints out a byte as a series of 1's and 0's */
uint8_t bit;
for (bit = 7; bit < 255; bit--) {
if (bit_is_set(byte, bit))
transmitByte('1');
else
transmitByte('0');
}
}

char nibbleToHexCharacter(uint8_t nibble) {
/* Converts 4 bits into hexadecimal */
if (nibble < 10) {
return ('0' + nibble);
}
else {
return ('A' + nibble - 10);
}
}

void printHexByte(uint8_t byte) {
/* Prints a byte as its hexadecimal equivalent */
uint8_t nibble;
nibble = (byte & 0b11110000) >> 4;
transmitByte(nibbleToHexCharacter(nibble));
nibble = byte & 0b00001111;
transmitByte(nibbleToHexCharacter(nibble));
}

uint8_t getNumber(void) {
// Gets a numerical 0-255 from the serial port.
// Converts from string to number.
char hundreds = '0';
char tens = '0';
char ones = '0';
char thisChar = '0';
do { /* shift over */
hundreds = tens;
tens = ones;
ones = thisChar;
thisChar = receiveByte(); /* get a new character */
transmitByte(thisChar); /* echo */
} while (thisChar != '\r'); /* until type return */
return (100 * (hundreds - '0') + 10 * (tens - '0') + ones - '0');
}

+ 45
- 0
USART.h View File

@@ -0,0 +1,45 @@
/* Functions to initialize, send, receive over USART

initUSART requires BAUD to be defined in order to calculate
the bit-rate multiplier.
*/

#ifndef BAUD /* if not defined in Makefile... */
#define BAUD 9600 /* set a safe default baud rate */
#endif

/* These are defined for convenience */
#define USART_HAS_DATA bit_is_set(UCSR0A, RXC0)
#define USART_READY bit_is_set(UCSR0A, UDRE0)

/* Takes the defined BAUD and F_CPU,
calculates the bit-clock multiplier,
and configures the hardware USART */
void initUSART(void);

/* Blocking transmit and receive functions.
When you call receiveByte() your program will hang until
data comes through. We'll improve on this later. */
void transmitByte(uint8_t data);
uint8_t receiveByte(void);

void printString(const char myString[]);
/* Utility function to transmit an entire string from RAM */
void readString(char myString[], uint8_t maxLength);
/* Define a string variable, pass it to this function
The string will contain whatever you typed over serial */

void printByte(uint8_t byte);
/* Prints a byte out as its 3-digit ascii equivalent */
void printWord(uint16_t word);
/* Prints a word (16-bits) out as its 5-digit ascii equivalent */

void printBinaryByte(uint8_t byte);
/* Prints a byte out in 1s and 0s */
char nibbleToHex(uint8_t nibble);
char nibbleToHexCharacter(uint8_t nibble);
void printHexByte(uint8_t byte);
/* Prints a byte out in hexadecimal */
uint8_t getNumber(void);
/* takes in up to three ascii digits,
converts them to a byte when press enter */

+ 91
- 0
pinDefines.h View File

@@ -0,0 +1,91 @@
// ---------------
// Pin Defines
// ---------------

#define LED_PORT PORTB
#define LED_PIN PINB
#define LED_DDR DDRB

#define LED0 PB0
#define LED1 PB1
#define LED2 PB2
#define LED3 PB3
#define LED4 PB4
#define LED5 PB5
#define LED6 PB6
#define LED7 PB7

#define BUTTON_PORT PORTD
#define BUTTON_PIN PIND
#define BUTTON_DDR DDRD

#define BUTTON PD2
#define BUTTON2 PD3
#define BUTTON3 PD4

#define SPEAKER PD6 /* OC0A */
#define SPEAKER_PORT PORTD
#define SPEAKER_PIN PIND
#define SPEAKER_DDR DDRD

#define ANTENNA PD5 /* OC0B */
#define ANTENNA_PORT PORTD
#define ANTENNA_PIN PIND
#define ANTENNA_DDR DDRD

#define MODULATION PD3 /* OC2B */
#define MODULATION_PORT PORTD
#define MODULATION_PIN PIND
#define MODULATION_DDR DDRD

#define LIGHT_SENSOR PC0 /* ADC0 */
#define LIGHT_SENSOR_PORT PORTC
#define LIGHT_SENSOR_PIN PINC
#define LIGHT_SENSOR_DDR DDRC

#define CAP_SENSOR PC1 /* ADC1 */
#define CAP_SENSOR_PORT PORTC
#define CAP_SENSOR_PIN PINC
#define CAP_SENSOR_DDR DDRC

#define PIEZO PC2 /* ADC2 */
#define PIEZO_PORT PORTC
#define PIEZO_PIN PINC
#define PIEZO_DDR DDRC

#define POT PC3 /* ADC3 */
#define POT_PORT PORTC
#define POT_PIN PINC
#define POT_DDR DDRC

// SPI and I2C serial mode defines

#define SPI_SS PB2
#define SPI_SS_PORT PORTB
#define SPI_SS_PIN PINB
#define SPI_SS_DDR DDRB

#define SPI_MOSI PB3
#define SPI_MOSI_PORT PORTB
#define SPI_MOSI_PIN PINB
#define SPI_MOSI_DDR DDRB

#define SPI_MISO PB4
#define SPI_MISO_PORT PORTB
#define SPI_MISO_PIN PINB
#define SPI_MISO_DDR DDRB

#define SPI_SCK PB5
#define SPI_SCK_PORT PORTB
#define SPI_SCK_PIN PINB
#define SPI_SCK_DDR DDRB

#define I2C_SDA PC4
#define I2C_SDA_PORT PORTC
#define I2C_SDA_PIN PINC
#define I2C_SDA_DDR DDRC

#define I2C_SCL PC5
#define I2C_SCL_PORT PORTC
#define I2C_SCL_PIN PINC
#define I2C_SCL_DDR DDRC

+ 155
- 0
sunlightAlarmClock.c View File

@@ -0,0 +1,155 @@
/* Sunrise Alarm Clock */

//Including required libraries
#include <avr/io.h>
#include <util/delay.h>
#include <avr/interrupt.h>
#include "USART.h"
#include "pinDefines.h"

//Defining buzzer related ports
#define ABuzz PB0
#define ABuzz_DDR DDRB
#define ABuzz_PORT PORTB

//Defining bit changer for buzzer
#define setBit(sfr, bit) (_SFR_BYTE(sfr) |= (1 << bit))
#define clearBit(sfr, bit) (_SFR_BYTE(sfr) &= ~(1 << bit))
#define toggleBit(sfr, bit) (_SFR_BYTE(sfr) ^= (1 << bit))

//Declaring and initializing global variables
volatile int enabled = 1;
int printed = 0;
uint8_t sensitivity;
int delay;

void setSensitivity();
void setDelay();

//Button interrupt
ISR(PCINT2_vect)
{
//Check if it the alarm is on
if (bit_is_set(ABuzz_PORT, ABuzz))
{
//Turn the buzzer off
clearBit(ABuzz_PORT, ABuzz);
//Stop the loop
enabled = 0;
}
else
{
/* I found this to be too annoying personally so I decided to comment it out

//Ask user if to reset sensitivity
printString("Would you like to reset the sensor's sensitivity? (Yes = 1)\n");
uint8_t toReset = getNumber();
receiveByte();
if (toReset == 1) { setSensitivity(); }

//Ask user if to reset delay
printString("Would you like to reset the interrupt's delay? (Yes = 1)\n");
toReset = getNumber();
receiveByte();
if (toReset == 1) { setDelay(); }
*/

//Set and print success message
enabled = 1;
printString("You're all set! Off to sleep!\n");
}

/* Attempted to use delay to skip the second interrupt input but it didn't
work as I hoped. So I decided to embrace it as a feature instead.
*/

//Delay between interrupts to turn off alarm
for(int i = 0; i < delay; i++)
{
_delay_ms(10);
}

//Reset the sensor to run again
printed = 0;

PCIFR |= (1 << PCIF2);
}

int main(void)
{
//Setting up for light sensor
ADMUX |= (1 << REFS0);
ADCSRA |= (1 << ADPS2);
ADCSRA |= (1 << ADEN);

//Setting up the button interrupt
PCICR |= (1 << PCIE2);
PCMSK2 |= (1 << PD2);
MCUCR |= (1 << PUD);
sei();

//Initializing USART
initUSART();

//Print title to string
printString("---- Sunrise Alarm Clock ------\r\n");

//Declaring variables
uint16_t adcValue;
uint8_t brightness;

//Initialize buzzer
setBit(ABuzz_DDR, ABuzz);
setSensitivity();
setDelay();

//Main Loop
while (1)
{
if (enabled > 0)
{
//Start ADC conversion
ADCSRA |= (1 << ADSC);
//Wait for the conversion to complete
loop_until_bit_is_clear(ADCSRA, ADSC);
//Get the ADC value
adcValue = ADC;
//Map it into a scale of 7
brightness = (adcValue >> 7);

//Check if the light is brighter than the selected sensitivity
if (brightness > sensitivity)
{
if (printed == 0)
{
setBit(ABuzz_PORT, ABuzz);
printString("WAKEUP!!!!\n");
printed = 1;
}
}
}
}
return 0;
}

void setSensitivity()
{
do
{
//Get sensitivity input from user
printString("What sensitivity do you want it to be? (Scale of 1 - 6)\n");
sensitivity = getNumber();
receiveByte();
} while (sensitivity > 6 || sensitivity < 1);
}

void setDelay()
{
do
{
//Get delay input from user
printString("How long do you want the delay to be? (1 = 10ms, Scale of 0 - 200)\n");
delay = getNumber();
receiveByte();
} while (delay > 200 || delay < 0);
}

Loading…
Cancel
Save