diff options
Diffstat (limited to 'samples')
-rw-r--r-- | samples/obdtest/obdtest.cbp | 663 | ||||
-rw-r--r-- | samples/test_obd_i2c/test_obd_i2c.ino | 147 | ||||
-rw-r--r-- | samples/test_obd_uart/test_obd_uart.ino (renamed from samples/obdtest/obdtest.ino) | 0 |
3 files changed, 147 insertions, 663 deletions
diff --git a/samples/obdtest/obdtest.cbp b/samples/obdtest/obdtest.cbp deleted file mode 100644 index e7eee55..0000000 --- a/samples/obdtest/obdtest.cbp +++ /dev/null @@ -1,663 +0,0 @@ -<?xml version="1.0" encoding="UTF-8" standalone="yes" ?> -<CodeBlocks_project_file> - <FileVersion major="1" minor="6" /> - <Project> - <Option title="obdtest" /> - <Option pch_mode="2" /> - <Option compiler="gcc" /> - <Build> - <Target title="Simulator - Debug"> - <Option output="build/obdtest_sim.exe" prefix_auto="1" extension_auto="0" /> - <Option object_output="obj/Debug/" /> - <Option type="1" /> - <Option compiler="GCC" /> - <Compiler> - <Add option="-g" /> - <Add option="-DF_CPU=16000000L" /> - <Add option="-DARDUSIM" /> - <Add option="-D__AVR_ATmega2560__" /> - <Add option="-x c++" /> - <Add directory="$(ARDUINO_DIR)/arduino/cores" /> - <Add directory="$(ARDUINO_DIR)/arduino/variants/standard" /> - <Add directory="$(ARDUINO_DIR)/include" /> - </Compiler> - <Linker> - <Add option="-lardusim" /> - </Linker> - <Environment> - <Variable name="ARDUINO_DIR" value="$(APP_PATH)\ardusim" /> - </Environment> - </Target> - <Target title="Simulator - Release"> - <Option output="build/obdtest_sim.exe" prefix_auto="1" extension_auto="0" /> - <Option object_output="obj/Release/" /> - <Option type="1" /> - <Option compiler="GCC" /> - <Compiler> - <Add option="-O2" /> - <Add option="-DF_CPU=16000000L" /> - <Add option="-DARDUSIM" /> - <Add option="-D__AVR_ATmega2560__" /> - <Add option="-x c++" /> - <Add directory="$(ARDUINO_DIR)/arduino/cores" /> - <Add directory="$(ARDUINO_DIR)/arduino/variants/standard" /> - <Add directory="$(ARDUINO_DIR)/include" /> - </Compiler> - <Linker> - <Add option="-s" /> - <Add option="-lardusim" /> - </Linker> - <Environment> - <Variable name="ARDUINO_DIR" value="$(APP_PATH)\ardusim" /> - </Environment> - </Target> - <Target title="Arduino Uno"> - <Option output="build/obdtest_${BOARD_ID}.elf" prefix_auto="1" extension_auto="0" /> - <Option object_output="build" /> - <Option type="1" /> - <Option compiler="avrgcc" /> - <Compiler> - <Add option="-x c++" /> - <Add option="-mmcu=$(MCU)" /> - <Add option="-DF_CPU=16000000L" /> - <Add option="-D__AVR_ATmega328P__" /> - <Add option="-O2" /> - <Add option="-Os" /> - <Add directory="$(ARDUINO_DIR)/hardware/arduino/cores/arduino" /> - <Add directory="$(ARDUINO_DIR)/libraries" /> - <Add directory="$(ARDUINO_DIR)/hardware/arduino/variants/standard" /> - </Compiler> - <Linker> - <Add option="-mmcu=$(MCU)" /> - <Add option='"$(PROJECT_DIR)${TARGET_OUTPUT_DIR}/lib_${BOARD_ID}_${MCU_CLOCK}.a"' /> - <Add option='"$(PROJECT_DIR)${TARGET_OUTPUT_DIR}/core_${BOARD_ID}_${MCU_CLOCK}.a"' /> - <Add option="-s" /> - </Linker> - <ExtraCommands> - <Add before='$(TARGET_COMPILER_DIR)ArduinoUploader "$(PROJECT_DIR)." $(BOARD_ID) - $(MCU_CLOCK) 0 "$(PROJECT_DIR)${TARGET_OUTPUT_DIR}/lib_${BOARD_ID}_${MCU_CLOCK}.a" "$(PROJECT_DIR)${TARGET_OUTPUT_DIR}/core_${BOARD_ID}_${MCU_CLOCK}.a"' /> - <Add after='avr-objcopy -O ihex -R .eeprom -R .eesafe "$(TARGET_OUTPUT_FILE)" "$(TARGET_OUTPUT_FILE).hex"' /> - <Add after='avr-objcopy --no-change-warnings -j .eeprom --change-section-lma .eeprom=0 -O ihex "$(TARGET_OUTPUT_FILE)" "$(TARGET_OUTPUT_FILE).eep.hex"' /> - <Add after='avr-size --mcu=$(MCU) --format=avr "$(TARGET_OUTPUT_FILE)"' /> - </ExtraCommands> - <Environment> - <Variable name="BOARD" value="Arduino Uno" /> - <Variable name="BOARD_ID" value="uno" /> - <Variable name="MCU" value="atmega328p" /> - <Variable name="MCU_CLOCK" value="16" /> - <Variable name="UPLOAD_BAUDRATE" value="115200" /> - <Variable name="UPLOAD_PORT" value="" /> - </Environment> - </Target> - <Target title="Arduino Leonardo"> - <Option output="build/obdtest_${BOARD_ID}.elf" prefix_auto="1" extension_auto="0" /> - <Option object_output="build" /> - <Option type="1" /> - <Option compiler="avrgcc" /> - <Compiler> - <Add option="-x c++" /> - <Add option="-mmcu=$(MCU)" /> - <Add option="-DF_CPU=16000000L" /> - <Add option="-D__AVR_ATmega32U4__" /> - <Add option="-DUSB_VID=0x2341" /> - <Add option="-DUSB_PID=0x8036" /> - <Add option="-O2" /> - <Add option="-Os" /> - <Add directory="$(ARDUINO_DIR)/hardware/arduino/cores/arduino" /> - <Add directory="$(ARDUINO_DIR)/libraries" /> - <Add directory="$(ARDUINO_DIR)/hardware/arduino/variants/leonardo" /> - </Compiler> - <Linker> - <Add option="-mmcu=$(MCU)" /> - <Add option='"$(PROJECT_DIR)${TARGET_OUTPUT_DIR}/lib_${BOARD_ID}_${MCU_CLOCK}.a"' /> - <Add option='"$(PROJECT_DIR)${TARGET_OUTPUT_DIR}/core_${BOARD_ID}_${MCU_CLOCK}.a"' /> - <Add option="-s" /> - </Linker> - <ExtraCommands> - <Add before='$(TARGET_COMPILER_DIR)ArduinoUploader "$(PROJECT_DIR)." $(BOARD_ID) - $(MCU_CLOCK) 0 "$(PROJECT_DIR)${TARGET_OUTPUT_DIR}/lib_${BOARD_ID}_${MCU_CLOCK}.a" "$(PROJECT_DIR)${TARGET_OUTPUT_DIR}/core_${BOARD_ID}_${MCU_CLOCK}.a"' /> - <Add after='avr-objcopy -O ihex -R .eeprom -R .eesafe "$(TARGET_OUTPUT_FILE)" "$(TARGET_OUTPUT_FILE).hex"' /> - <Add after='avr-objcopy --no-change-warnings -j .eeprom --change-section-lma .eeprom=0 -O ihex "$(TARGET_OUTPUT_FILE)" "$(TARGET_OUTPUT_FILE).eep.hex"' /> - <Add after='avr-size --mcu=$(MCU) --format=avr "$(TARGET_OUTPUT_FILE)"' /> - </ExtraCommands> - <Environment> - <Variable name="BOARD" value="Arduino Leonardo" /> - <Variable name="BOARD_ID" value="leonardo" /> - <Variable name="MCU" value="atmega32u4" /> - <Variable name="MCU_CLOCK" value="16" /> - <Variable name="UPLOAD_BAUDRATE" value="57600" /> - <Variable name="UPLOAD_PORT" value="" /> - </Environment> - </Target> - <Target title="Arduino Esplora"> - <Option output="build/obdtest_${BOARD_ID}.elf" prefix_auto="1" extension_auto="0" /> - <Option object_output="build" /> - <Option type="1" /> - <Option compiler="avrgcc" /> - <Compiler> - <Add option="-x c++" /> - <Add option="-mmcu=$(MCU)" /> - <Add option="-DF_CPU=16000000L" /> - <Add option="-D__AVR_ATmega32U4__" /> - <Add option="-DUSB_VID=0x2341" /> - <Add option="-DUSB_PID=0x8037" /> - <Add option="-O2" /> - <Add option="-Os" /> - <Add directory="$(ARDUINO_DIR)/hardware/arduino/cores/arduino" /> - <Add directory="$(ARDUINO_DIR)/libraries" /> - <Add directory="$(ARDUINO_DIR)/hardware/arduino/variants/leonardo" /> - </Compiler> - <Linker> - <Add option="-mmcu=$(MCU)" /> - <Add option='"$(PROJECT_DIR)${TARGET_OUTPUT_DIR}/lib_${BOARD_ID}_${MCU_CLOCK}.a"' /> - <Add option='"$(PROJECT_DIR)${TARGET_OUTPUT_DIR}/core_${BOARD_ID}_${MCU_CLOCK}.a"' /> - <Add option="-s" /> - </Linker> - <ExtraCommands> - <Add before='$(TARGET_COMPILER_DIR)ArduinoUploader "$(PROJECT_DIR)." $(BOARD_ID) - $(MCU_CLOCK) 0 "$(PROJECT_DIR)${TARGET_OUTPUT_DIR}/lib_${BOARD_ID}_${MCU_CLOCK}.a" "$(PROJECT_DIR)${TARGET_OUTPUT_DIR}/core_${BOARD_ID}_${MCU_CLOCK}.a"' /> - <Add after='avr-objcopy -O ihex -R .eeprom -R .eesafe "$(TARGET_OUTPUT_FILE)" "$(TARGET_OUTPUT_FILE).hex"' /> - <Add after='avr-objcopy --no-change-warnings -j .eeprom --change-section-lma .eeprom=0 -O ihex "$(TARGET_OUTPUT_FILE)" "$(TARGET_OUTPUT_FILE).eep.hex"' /> - <Add after='avr-size --mcu=$(MCU) --format=avr "$(TARGET_OUTPUT_FILE)"' /> - </ExtraCommands> - <Environment> - <Variable name="BOARD" value="Arduino Esplora" /> - <Variable name="BOARD_ID" value="esplora" /> - <Variable name="MCU" value="atmega32u4" /> - <Variable name="MCU_CLOCK" value="16" /> - <Variable name="UPLOAD_BAUDRATE" value="57600" /> - <Variable name="UPLOAD_PORT" value="" /> - </Environment> - </Target> - <Target title="Arduino Micro"> - <Option output="build/obdtest_${BOARD_ID}.elf" prefix_auto="1" extension_auto="0" /> - <Option object_output="build" /> - <Option type="1" /> - <Option compiler="avrgcc" /> - <Compiler> - <Add option="-x c++" /> - <Add option="-mmcu=$(MCU)" /> - <Add option="-DF_CPU=16000000L" /> - <Add option="-D__AVR_ATmega32U4__" /> - <Add option="-DUSB_VID=0x2341" /> - <Add option="-DUSB_PID=0x803C" /> - <Add option="-O2" /> - <Add option="-Os" /> - <Add directory="$(ARDUINO_DIR)/hardware/arduino/cores/arduino" /> - <Add directory="$(ARDUINO_DIR)/libraries" /> - <Add directory="$(ARDUINO_DIR)/hardware/arduino/variants/micro" /> - </Compiler> - <Linker> - <Add option="-mmcu=$(MCU)" /> - <Add option='"$(PROJECT_DIR)${TARGET_OUTPUT_DIR}/lib_${BOARD_ID}_${MCU_CLOCK}.a"' /> - <Add option='"$(PROJECT_DIR)${TARGET_OUTPUT_DIR}/core_${BOARD_ID}_${MCU_CLOCK}.a"' /> - <Add option="-s" /> - </Linker> - <ExtraCommands> - <Add before='$(TARGET_COMPILER_DIR)ArduinoUploader "$(PROJECT_DIR)." $(BOARD_ID) - $(MCU_CLOCK) 0 "$(PROJECT_DIR)${TARGET_OUTPUT_DIR}/lib_${BOARD_ID}_${MCU_CLOCK}.a" "$(PROJECT_DIR)${TARGET_OUTPUT_DIR}/core_${BOARD_ID}_${MCU_CLOCK}.a"' /> - <Add after='avr-objcopy -O ihex -R .eeprom -R .eesafe "$(TARGET_OUTPUT_FILE)" "$(TARGET_OUTPUT_FILE).hex"' /> - <Add after='avr-objcopy --no-change-warnings -j .eeprom --change-section-lma .eeprom=0 -O ihex "$(TARGET_OUTPUT_FILE)" "$(TARGET_OUTPUT_FILE).eep.hex"' /> - <Add after='avr-size --mcu=$(MCU) --format=avr "$(TARGET_OUTPUT_FILE)"' /> - </ExtraCommands> - <Environment> - <Variable name="BOARD" value="Arduino Micro" /> - <Variable name="BOARD_ID" value="micro" /> - <Variable name="MCU" value="atmega32u4" /> - <Variable name="MCU_CLOCK" value="16" /> - <Variable name="UPLOAD_BAUDRATE" value="57600" /> - <Variable name="UPLOAD_PORT" value="" /> - </Environment> - </Target> - <Target title="Arduino Duemilanove (328)"> - <Option output="build/obdtest_${BOARD_ID}.elf" prefix_auto="1" extension_auto="0" /> - <Option object_output="build" /> - <Option type="1" /> - <Option compiler="avrgcc" /> - <Compiler> - <Add option="-x c++" /> - <Add option="-mmcu=$(MCU)" /> - <Add option="-DF_CPU=16000000L" /> - <Add option="-D__AVR_ATmega328P__" /> - <Add option="-O2" /> - <Add option="-Os" /> - <Add directory="$(ARDUINO_DIR)/hardware/arduino/cores/arduino" /> - <Add directory="$(ARDUINO_DIR)/libraries" /> - <Add directory="$(ARDUINO_DIR)/hardware/arduino/variants/standard" /> - </Compiler> - <Linker> - <Add option="-mmcu=$(MCU)" /> - <Add option='"$(PROJECT_DIR)${TARGET_OUTPUT_DIR}/lib_${BOARD_ID}_${MCU_CLOCK}.a"' /> - <Add option='"$(PROJECT_DIR)${TARGET_OUTPUT_DIR}/core_${BOARD_ID}_${MCU_CLOCK}.a"' /> - <Add option="-s" /> - </Linker> - <ExtraCommands> - <Add before='$(TARGET_COMPILER_DIR)ArduinoUploader "$(PROJECT_DIR)." $(BOARD_ID) - $(MCU_CLOCK) 0 "$(PROJECT_DIR)${TARGET_OUTPUT_DIR}/lib_${BOARD_ID}_${MCU_CLOCK}.a" "$(PROJECT_DIR)${TARGET_OUTPUT_DIR}/core_${BOARD_ID}_${MCU_CLOCK}.a"' /> - <Add after='avr-objcopy -O ihex -R .eeprom -R .eesafe "$(TARGET_OUTPUT_FILE)" "$(TARGET_OUTPUT_FILE).hex"' /> - <Add after='avr-objcopy --no-change-warnings -j .eeprom --change-section-lma .eeprom=0 -O ihex "$(TARGET_OUTPUT_FILE)" "$(TARGET_OUTPUT_FILE).eep.hex"' /> - <Add after='avr-size --mcu=$(MCU) --format=avr "$(TARGET_OUTPUT_FILE)"' /> - </ExtraCommands> - <Environment> - <Variable name="BOARD" value="Arduino Duemilanove (328)" /> - <Variable name="BOARD_ID" value="duemilanove328" /> - <Variable name="MCU" value="atmega328p" /> - <Variable name="MCU_CLOCK" value="16" /> - <Variable name="UPLOAD_BAUDRATE" value="57600" /> - <Variable name="UPLOAD_PORT" value="" /> - </Environment> - </Target> - <Target title="Arduino Duemilanove (168)"> - <Option output="build/obdtest_${BOARD_ID}.elf" prefix_auto="1" extension_auto="0" /> - <Option object_output="build" /> - <Option type="1" /> - <Option compiler="avrgcc" /> - <Compiler> - <Add option="-x c++" /> - <Add option="-mmcu=$(MCU)" /> - <Add option="-DF_CPU=16000000L" /> - <Add option="-D__AVR_ATmega168__" /> - <Add option="-O2" /> - <Add option="-Os" /> - <Add directory="$(ARDUINO_DIR)/hardware/arduino/cores/arduino" /> - <Add directory="$(ARDUINO_DIR)/libraries" /> - <Add directory="$(ARDUINO_DIR)/hardware/arduino/variants/standard" /> - </Compiler> - <Linker> - <Add option="-mmcu=$(MCU)" /> - <Add option='"$(PROJECT_DIR)${TARGET_OUTPUT_DIR}/lib_${BOARD_ID}_${MCU_CLOCK}.a"' /> - <Add option='"$(PROJECT_DIR)${TARGET_OUTPUT_DIR}/core_${BOARD_ID}_${MCU_CLOCK}.a"' /> - <Add option="-s" /> - </Linker> - <ExtraCommands> - <Add before='$(TARGET_COMPILER_DIR)ArduinoUploader "$(PROJECT_DIR)." $(BOARD_ID) - $(MCU_CLOCK) 0 "$(PROJECT_DIR)${TARGET_OUTPUT_DIR}/lib_${BOARD_ID}_${MCU_CLOCK}.a" "$(PROJECT_DIR)${TARGET_OUTPUT_DIR}/core_${BOARD_ID}_${MCU_CLOCK}.a"' /> - <Add after='avr-objcopy -O ihex -R .eeprom -R .eesafe "$(TARGET_OUTPUT_FILE)" "$(TARGET_OUTPUT_FILE).hex"' /> - <Add after='avr-objcopy --no-change-warnings -j .eeprom --change-section-lma .eeprom=0 -O ihex "$(TARGET_OUTPUT_FILE)" "$(TARGET_OUTPUT_FILE).eep.hex"' /> - <Add after='avr-size --mcu=$(MCU) --format=avr "$(TARGET_OUTPUT_FILE)"' /> - </ExtraCommands> - <Environment> - <Variable name="BOARD" value="Arduino Duemilanove (168)" /> - <Variable name="BOARD_ID" value="duemilanove168" /> - <Variable name="MCU" value="atmega168" /> - <Variable name="MCU_CLOCK" value="16" /> - <Variable name="UPLOAD_BAUDRATE" value="19200" /> - <Variable name="UPLOAD_PORT" value="" /> - </Environment> - </Target> - <Target title="Arduino Nano (328)"> - <Option output="build/obdtest_${BOARD_ID}.elf" prefix_auto="1" extension_auto="0" /> - <Option object_output="build" /> - <Option type="1" /> - <Option compiler="avrgcc" /> - <Compiler> - <Add option="-x c++" /> - <Add option="-mmcu=$(MCU)" /> - <Add option="-DF_CPU=16000000L" /> - <Add option="-D__AVR_ATmega328P__" /> - <Add option="-O2" /> - <Add option="-Os" /> - <Add directory="$(ARDUINO_DIR)/hardware/arduino/cores/arduino" /> - <Add directory="$(ARDUINO_DIR)/libraries" /> - <Add directory="$(ARDUINO_DIR)/hardware/arduino/variants/eightanaloginputs" /> - </Compiler> - <Linker> - <Add option="-mmcu=$(MCU)" /> - <Add option='"$(PROJECT_DIR)${TARGET_OUTPUT_DIR}/lib_${BOARD_ID}_${MCU_CLOCK}.a"' /> - <Add option='"$(PROJECT_DIR)${TARGET_OUTPUT_DIR}/core_${BOARD_ID}_${MCU_CLOCK}.a"' /> - <Add option="-s" /> - </Linker> - <ExtraCommands> - <Add before='$(TARGET_COMPILER_DIR)ArduinoUploader "$(PROJECT_DIR)." $(BOARD_ID) - $(MCU_CLOCK) 0 "$(PROJECT_DIR)${TARGET_OUTPUT_DIR}/lib_${BOARD_ID}_${MCU_CLOCK}.a" "$(PROJECT_DIR)${TARGET_OUTPUT_DIR}/core_${BOARD_ID}_${MCU_CLOCK}.a"' /> - <Add after='avr-objcopy -O ihex -R .eeprom -R .eesafe "$(TARGET_OUTPUT_FILE)" "$(TARGET_OUTPUT_FILE).hex"' /> - <Add after='avr-objcopy --no-change-warnings -j .eeprom --change-section-lma .eeprom=0 -O ihex "$(TARGET_OUTPUT_FILE)" "$(TARGET_OUTPUT_FILE).eep.hex"' /> - <Add after='avr-size --mcu=$(MCU) --format=avr "$(TARGET_OUTPUT_FILE)"' /> - </ExtraCommands> - <Environment> - <Variable name="BOARD" value="Arduino Nano (328)" /> - <Variable name="BOARD_ID" value="nano328" /> - <Variable name="MCU" value="atmega328p" /> - <Variable name="MCU_CLOCK" value="16" /> - <Variable name="UPLOAD_BAUDRATE" value="57600" /> - <Variable name="UPLOAD_PORT" value="" /> - </Environment> - </Target> - <Target title="Arduino Nano (168)"> - <Option output="build/obdtest_${BOARD_ID}.elf" prefix_auto="1" extension_auto="0" /> - <Option object_output="build" /> - <Option type="1" /> - <Option compiler="avrgcc" /> - <Compiler> - <Add option="-x c++" /> - <Add option="-mmcu=$(MCU)" /> - <Add option="-DF_CPU=16000000L" /> - <Add option="-D__AVR_ATmega168__" /> - <Add option="-O2" /> - <Add option="-Os" /> - <Add directory="$(ARDUINO_DIR)/hardware/arduino/cores/arduino" /> - <Add directory="$(ARDUINO_DIR)/libraries" /> - <Add directory="$(ARDUINO_DIR)/hardware/arduino/variants/eightanaloginputs" /> - </Compiler> - <Linker> - <Add option="-mmcu=$(MCU)" /> - <Add option='"$(PROJECT_DIR)${TARGET_OUTPUT_DIR}/lib_${BOARD_ID}_${MCU_CLOCK}.a"' /> - <Add option='"$(PROJECT_DIR)${TARGET_OUTPUT_DIR}/core_${BOARD_ID}_${MCU_CLOCK}.a"' /> - <Add option="-s" /> - </Linker> - <ExtraCommands> - <Add before='$(TARGET_COMPILER_DIR)ArduinoUploader "$(PROJECT_DIR)." $(BOARD_ID) - $(MCU_CLOCK) 0 "$(PROJECT_DIR)${TARGET_OUTPUT_DIR}/lib_${BOARD_ID}_${MCU_CLOCK}.a" "$(PROJECT_DIR)${TARGET_OUTPUT_DIR}/core_${BOARD_ID}_${MCU_CLOCK}.a"' /> - <Add after='avr-objcopy -O ihex -R .eeprom -R .eesafe "$(TARGET_OUTPUT_FILE)" "$(TARGET_OUTPUT_FILE).hex"' /> - <Add after='avr-objcopy --no-change-warnings -j .eeprom --change-section-lma .eeprom=0 -O ihex "$(TARGET_OUTPUT_FILE)" "$(TARGET_OUTPUT_FILE).eep.hex"' /> - <Add after='avr-size --mcu=$(MCU) --format=avr "$(TARGET_OUTPUT_FILE)"' /> - </ExtraCommands> - <Environment> - <Variable name="BOARD" value="Arduino Nano (168)" /> - <Variable name="BOARD_ID" value="nano168" /> - <Variable name="MCU" value="atmega168" /> - <Variable name="MCU_CLOCK" value="16" /> - <Variable name="UPLOAD_BAUDRATE" value="19200" /> - <Variable name="UPLOAD_PORT" value="" /> - </Environment> - </Target> - <Target title="Arduino Mini (328)"> - <Option output="build/obdtest_${BOARD_ID}.elf" prefix_auto="1" extension_auto="0" /> - <Option object_output="build" /> - <Option type="1" /> - <Option compiler="avrgcc" /> - <Compiler> - <Add option="-x c++" /> - <Add option="-mmcu=$(MCU)" /> - <Add option="-DF_CPU=16000000L" /> - <Add option="-D__AVR_ATmega328P__" /> - <Add option="-O2" /> - <Add option="-Os" /> - <Add directory="$(ARDUINO_DIR)/hardware/arduino/cores/arduino" /> - <Add directory="$(ARDUINO_DIR)/libraries" /> - <Add directory="$(ARDUINO_DIR)/hardware/arduino/variants/eightanaloginputs" /> - </Compiler> - <Linker> - <Add option="-mmcu=$(MCU)" /> - <Add option='"$(PROJECT_DIR)${TARGET_OUTPUT_DIR}/lib_${BOARD_ID}_${MCU_CLOCK}.a"' /> - <Add option='"$(PROJECT_DIR)${TARGET_OUTPUT_DIR}/core_${BOARD_ID}_${MCU_CLOCK}.a"' /> - <Add option="-s" /> - </Linker> - <ExtraCommands> - <Add before='$(TARGET_COMPILER_DIR)ArduinoUploader "$(PROJECT_DIR)." $(BOARD_ID) - $(MCU_CLOCK) 0 "$(PROJECT_DIR)${TARGET_OUTPUT_DIR}/lib_${BOARD_ID}_${MCU_CLOCK}.a" "$(PROJECT_DIR)${TARGET_OUTPUT_DIR}/core_${BOARD_ID}_${MCU_CLOCK}.a"' /> - <Add after='avr-objcopy -O ihex -R .eeprom -R .eesafe "$(TARGET_OUTPUT_FILE)" "$(TARGET_OUTPUT_FILE).hex"' /> - <Add after='avr-objcopy --no-change-warnings -j .eeprom --change-section-lma .eeprom=0 -O ihex "$(TARGET_OUTPUT_FILE)" "$(TARGET_OUTPUT_FILE).eep.hex"' /> - <Add after='avr-size --mcu=$(MCU) --format=avr "$(TARGET_OUTPUT_FILE)"' /> - </ExtraCommands> - <Environment> - <Variable name="BOARD" value="Arduino Mini (328)" /> - <Variable name="BOARD_ID" value="mini328" /> - <Variable name="MCU" value="atmega328p" /> - <Variable name="MCU_CLOCK" value="16" /> - <Variable name="UPLOAD_BAUDRATE" value="57600" /> - <Variable name="UPLOAD_PORT" value="" /> - </Environment> - </Target> - <Target title="Arduino Mini (168)"> - <Option output="build/obdtest_${BOARD_ID}.elf" prefix_auto="1" extension_auto="0" /> - <Option object_output="build" /> - <Option type="1" /> - <Option compiler="avrgcc" /> - <Compiler> - <Add option="-x c++" /> - <Add option="-mmcu=$(MCU)" /> - <Add option="-DF_CPU=16000000L" /> - <Add option="-D__AVR_ATmega168__" /> - <Add option="-O2" /> - <Add option="-Os" /> - <Add directory="$(ARDUINO_DIR)/hardware/arduino/cores/arduino" /> - <Add directory="$(ARDUINO_DIR)/libraries" /> - <Add directory="$(ARDUINO_DIR)/hardware/arduino/variants/eightanaloginputs" /> - </Compiler> - <Linker> - <Add option="-mmcu=$(MCU)" /> - <Add option='"$(PROJECT_DIR)${TARGET_OUTPUT_DIR}/lib_${BOARD_ID}_${MCU_CLOCK}.a"' /> - <Add option='"$(PROJECT_DIR)${TARGET_OUTPUT_DIR}/core_${BOARD_ID}_${MCU_CLOCK}.a"' /> - <Add option="-s" /> - </Linker> - <ExtraCommands> - <Add before='$(TARGET_COMPILER_DIR)ArduinoUploader "$(PROJECT_DIR)." $(BOARD_ID) - $(MCU_CLOCK) 0 "$(PROJECT_DIR)${TARGET_OUTPUT_DIR}/lib_${BOARD_ID}_${MCU_CLOCK}.a" "$(PROJECT_DIR)${TARGET_OUTPUT_DIR}/core_${BOARD_ID}_${MCU_CLOCK}.a"' /> - <Add after='avr-objcopy -O ihex -R .eeprom -R .eesafe "$(TARGET_OUTPUT_FILE)" "$(TARGET_OUTPUT_FILE).hex"' /> - <Add after='avr-objcopy --no-change-warnings -j .eeprom --change-section-lma .eeprom=0 -O ihex "$(TARGET_OUTPUT_FILE)" "$(TARGET_OUTPUT_FILE).eep.hex"' /> - <Add after='avr-size --mcu=$(MCU) --format=avr "$(TARGET_OUTPUT_FILE)"' /> - </ExtraCommands> - <Environment> - <Variable name="BOARD" value="Arduino Mini (168)" /> - <Variable name="BOARD_ID" value="mini168" /> - <Variable name="MCU" value="atmega168" /> - <Variable name="MCU_CLOCK" value="16" /> - <Variable name="UPLOAD_BAUDRATE" value="19200" /> - <Variable name="UPLOAD_PORT" value="" /> - </Environment> - </Target> - <Target title="Arduino Pro Mini (328)"> - <Option output="build/obdtest_${BOARD_ID}.elf" prefix_auto="1" extension_auto="0" /> - <Option object_output="build" /> - <Option type="1" /> - <Option compiler="avrgcc" /> - <Compiler> - <Add option="-x c++" /> - <Add option="-mmcu=$(MCU)" /> - <Add option="-DF_CPU=16000000L" /> - <Add option="-D__AVR_ATmega328P__" /> - <Add option="-O2" /> - <Add option="-Os" /> - <Add directory="$(ARDUINO_DIR)/hardware/arduino/cores/arduino" /> - <Add directory="$(ARDUINO_DIR)/libraries" /> - <Add directory="$(ARDUINO_DIR)/hardware/arduino/variants/standard" /> - </Compiler> - <Linker> - <Add option="-mmcu=$(MCU)" /> - <Add option='"$(PROJECT_DIR)${TARGET_OUTPUT_DIR}/lib_${BOARD_ID}_${MCU_CLOCK}.a"' /> - <Add option='"$(PROJECT_DIR)${TARGET_OUTPUT_DIR}/core_${BOARD_ID}_${MCU_CLOCK}.a"' /> - <Add option="-s" /> - </Linker> - <ExtraCommands> - <Add before='$(TARGET_COMPILER_DIR)ArduinoUploader "$(PROJECT_DIR)." $(BOARD_ID) - $(MCU_CLOCK) 0 "$(PROJECT_DIR)${TARGET_OUTPUT_DIR}/lib_${BOARD_ID}_${MCU_CLOCK}.a" "$(PROJECT_DIR)${TARGET_OUTPUT_DIR}/core_${BOARD_ID}_${MCU_CLOCK}.a"' /> - <Add after='avr-objcopy -O ihex -R .eeprom -R .eesafe "$(TARGET_OUTPUT_FILE)" "$(TARGET_OUTPUT_FILE).hex"' /> - <Add after='avr-objcopy --no-change-warnings -j .eeprom --change-section-lma .eeprom=0 -O ihex "$(TARGET_OUTPUT_FILE)" "$(TARGET_OUTPUT_FILE).eep.hex"' /> - <Add after='avr-size --mcu=$(MCU) --format=avr "$(TARGET_OUTPUT_FILE)"' /> - </ExtraCommands> - <Environment> - <Variable name="BOARD" value="Arduino Pro Mini (328)" /> - <Variable name="BOARD_ID" value="promini328" /> - <Variable name="MCU" value="atmega328p" /> - <Variable name="MCU_CLOCK" value="16" /> - <Variable name="UPLOAD_BAUDRATE" value="57600" /> - <Variable name="UPLOAD_PORT" value="" /> - </Environment> - </Target> - <Target title="Arduino Pro Mini (168)"> - <Option output="build/obdtest_${BOARD_ID}.elf" prefix_auto="1" extension_auto="0" /> - <Option object_output="build" /> - <Option type="1" /> - <Option compiler="avrgcc" /> - <Compiler> - <Add option="-x c++" /> - <Add option="-mmcu=$(MCU)" /> - <Add option="-DF_CPU=16000000L" /> - <Add option="-D__AVR_ATmega168__" /> - <Add option="-O2" /> - <Add option="-Os" /> - <Add directory="$(ARDUINO_DIR)/hardware/arduino/cores/arduino" /> - <Add directory="$(ARDUINO_DIR)/libraries" /> - <Add directory="$(ARDUINO_DIR)/hardware/arduino/variants/standard" /> - </Compiler> - <Linker> - <Add option="-mmcu=$(MCU)" /> - <Add option='"$(PROJECT_DIR)${TARGET_OUTPUT_DIR}/lib_${BOARD_ID}_${MCU_CLOCK}.a"' /> - <Add option='"$(PROJECT_DIR)${TARGET_OUTPUT_DIR}/core_${BOARD_ID}_${MCU_CLOCK}.a"' /> - <Add option="-s" /> - </Linker> - <ExtraCommands> - <Add before='$(TARGET_COMPILER_DIR)ArduinoUploader "$(PROJECT_DIR)." $(BOARD_ID) - $(MCU_CLOCK) 0 "$(PROJECT_DIR)${TARGET_OUTPUT_DIR}/lib_${BOARD_ID}_${MCU_CLOCK}.a" "$(PROJECT_DIR)${TARGET_OUTPUT_DIR}/core_${BOARD_ID}_${MCU_CLOCK}.a"' /> - <Add after='avr-objcopy -O ihex -R .eeprom -R .eesafe "$(TARGET_OUTPUT_FILE)" "$(TARGET_OUTPUT_FILE).hex"' /> - <Add after='avr-objcopy --no-change-warnings -j .eeprom --change-section-lma .eeprom=0 -O ihex "$(TARGET_OUTPUT_FILE)" "$(TARGET_OUTPUT_FILE).eep.hex"' /> - <Add after='avr-size --mcu=$(MCU) --format=avr "$(TARGET_OUTPUT_FILE)"' /> - </ExtraCommands> - <Environment> - <Variable name="BOARD" value="Arduino Pro Mini (168)" /> - <Variable name="BOARD_ID" value="promini168" /> - <Variable name="MCU" value="atmega168" /> - <Variable name="MCU_CLOCK" value="16" /> - <Variable name="UPLOAD_BAUDRATE" value="19200" /> - <Variable name="UPLOAD_PORT" value="" /> - </Environment> - </Target> - <Target title="Arduino Mega 2560/ADK"> - <Option output="build/obdtest_${BOARD_ID}.elf" prefix_auto="1" extension_auto="0" /> - <Option object_output="build" /> - <Option type="1" /> - <Option compiler="avrgcc" /> - <Compiler> - <Add option="-x c++" /> - <Add option="-mmcu=$(MCU)" /> - <Add option="-DF_CPU=16000000L" /> - <Add option="-D__AVR_ATmega2560__" /> - <Add option="-O2" /> - <Add directory="$(ARDUINO_DIR)/hardware/arduino/cores/arduino" /> - <Add directory="$(ARDUINO_DIR)/libraries" /> - <Add directory="$(ARDUINO_DIR)/hardware/arduino/variants/mega" /> - </Compiler> - <Linker> - <Add option="-mmcu=$(MCU)" /> - <Add option='"$(PROJECT_DIR)${TARGET_OUTPUT_DIR}/lib_${BOARD_ID}_${MCU_CLOCK}.a"' /> - <Add option='"$(PROJECT_DIR)${TARGET_OUTPUT_DIR}/core_${BOARD_ID}_${MCU_CLOCK}.a"' /> - <Add option="-s" /> - </Linker> - <ExtraCommands> - <Add before='$(TARGET_COMPILER_DIR)ArduinoUploader "$(PROJECT_DIR)." $(BOARD_ID) - $(MCU_CLOCK) 0 "$(PROJECT_DIR)${TARGET_OUTPUT_DIR}/lib_${BOARD_ID}_${MCU_CLOCK}.a" "$(PROJECT_DIR)${TARGET_OUTPUT_DIR}/core_${BOARD_ID}_${MCU_CLOCK}.a"' /> - <Add after='avr-objcopy -O ihex -R .eeprom -R .eesafe "$(TARGET_OUTPUT_FILE)" "$(TARGET_OUTPUT_FILE).hex"' /> - <Add after='avr-objcopy --no-change-warnings -j .eeprom --change-section-lma .eeprom=0 -O ihex "$(TARGET_OUTPUT_FILE)" "$(TARGET_OUTPUT_FILE).eep.hex"' /> - <Add after='avr-size --mcu=$(MCU) --format=avr "$(TARGET_OUTPUT_FILE)"' /> - </ExtraCommands> - <Environment> - <Variable name="BOARD" value="Arduino Mega 2560\ADK" /> - <Variable name="BOARD_ID" value="mega2560" /> - <Variable name="MCU" value="atmega2560" /> - <Variable name="MCU_CLOCK" value="16" /> - <Variable name="UPLOAD_BAUDRATE" value="57600" /> - <Variable name="UPLOAD_PORT" value="" /> - </Environment> - </Target> - <Target title="Arduino Mega 1280"> - <Option output="build/obdtest_${BOARD_ID}.elf" prefix_auto="1" extension_auto="0" /> - <Option object_output="build" /> - <Option type="1" /> - <Option compiler="avrgcc" /> - <Compiler> - <Add option="-x c++" /> - <Add option="-mmcu=$(MCU)" /> - <Add option="-DF_CPU=16000000L" /> - <Add option="-D__AVR_ATmega1280__" /> - <Add option="-O2" /> - <Add directory="$(ARDUINO_DIR)/hardware/arduino/cores/arduino" /> - <Add directory="$(ARDUINO_DIR)/libraries" /> - <Add directory="$(ARDUINO_DIR)/hardware/arduino/variants/mega" /> - </Compiler> - <Linker> - <Add option="-mmcu=$(MCU)" /> - <Add option='"$(PROJECT_DIR)${TARGET_OUTPUT_DIR}/lib_${BOARD_ID}_${MCU_CLOCK}.a"' /> - <Add option='"$(PROJECT_DIR)${TARGET_OUTPUT_DIR}/core_${BOARD_ID}_${MCU_CLOCK}.a"' /> - <Add option="-s" /> - </Linker> - <ExtraCommands> - <Add before='$(TARGET_COMPILER_DIR)ArduinoUploader "$(PROJECT_DIR)." $(BOARD_ID) - $(MCU_CLOCK) 0 "$(PROJECT_DIR)${TARGET_OUTPUT_DIR}/lib_${BOARD_ID}_${MCU_CLOCK}.a" "$(PROJECT_DIR)${TARGET_OUTPUT_DIR}/core_${BOARD_ID}_${MCU_CLOCK}.a"' /> - <Add after='avr-objcopy -O ihex -R .eeprom -R .eesafe "$(TARGET_OUTPUT_FILE)" "$(TARGET_OUTPUT_FILE).hex"' /> - <Add after='avr-objcopy --no-change-warnings -j .eeprom --change-section-lma .eeprom=0 -O ihex "$(TARGET_OUTPUT_FILE)" "$(TARGET_OUTPUT_FILE).eep.hex"' /> - <Add after='avr-size --mcu=$(MCU) --format=avr "$(TARGET_OUTPUT_FILE)"' /> - </ExtraCommands> - <Environment> - <Variable name="BOARD" value="Arduino Mega 1280" /> - <Variable name="BOARD_ID" value="mega1280" /> - <Variable name="MCU" value="atmega1280" /> - <Variable name="MCU_CLOCK" value="16" /> - <Variable name="UPLOAD_BAUDRATE" value="57600" /> - <Variable name="UPLOAD_PORT" value="" /> - </Environment> - </Target> - <Target title="Arduino Mega 8"> - <Option output="build/obdtest_${BOARD_ID}.elf" prefix_auto="1" extension_auto="0" /> - <Option object_output="build" /> - <Option type="1" /> - <Option compiler="avrgcc" /> - <Compiler> - <Add option="-x c++" /> - <Add option="-mmcu=$(MCU)" /> - <Add option="-DF_CPU=16000000L" /> - <Add option="-D__AVR_ATmega328P__" /> - <Add option="-O2" /> - <Add option="-Os" /> - <Add directory="$(ARDUINO_DIR)/hardware/arduino/cores/arduino" /> - <Add directory="$(ARDUINO_DIR)/libraries" /> - <Add directory="$(ARDUINO_DIR)/hardware/arduino/variants/standard" /> - </Compiler> - <Linker> - <Add option="-mmcu=$(MCU)" /> - <Add option='"$(PROJECT_DIR)${TARGET_OUTPUT_DIR}/lib_${BOARD_ID}_${MCU_CLOCK}.a"' /> - <Add option='"$(PROJECT_DIR)${TARGET_OUTPUT_DIR}/core_${BOARD_ID}_${MCU_CLOCK}.a"' /> - <Add option="-s" /> - </Linker> - <ExtraCommands> - <Add before='$(TARGET_COMPILER_DIR)ArduinoUploader "$(PROJECT_DIR)." $(BOARD_ID) - $(MCU_CLOCK) 0 "$(PROJECT_DIR)${TARGET_OUTPUT_DIR}/lib_${BOARD_ID}_${MCU_CLOCK}.a" "$(PROJECT_DIR)${TARGET_OUTPUT_DIR}/core_${BOARD_ID}_${MCU_CLOCK}.a"' /> - <Add after='avr-objcopy -O ihex -R .eeprom -R .eesafe "$(TARGET_OUTPUT_FILE)" "$(TARGET_OUTPUT_FILE).hex"' /> - <Add after='avr-objcopy --no-change-warnings -j .eeprom --change-section-lma .eeprom=0 -O ihex "$(TARGET_OUTPUT_FILE)" "$(TARGET_OUTPUT_FILE).eep.hex"' /> - <Add after='avr-size --mcu=$(MCU) --format=avr "$(TARGET_OUTPUT_FILE)"' /> - </ExtraCommands> - <Environment> - <Variable name="BOARD" value="Arduino Mega 8" /> - <Variable name="BOARD_ID" value="mega8" /> - <Variable name="MCU" value="atmega8" /> - <Variable name="MCU_CLOCK" value="16" /> - <Variable name="UPLOAD_BAUDRATE" value="19200" /> - <Variable name="UPLOAD_PORT" value="" /> - </Environment> - </Target> - <Target title="Microduino Core+ (644P)"> - <Option output="build/obdtest_${BOARD_ID}.elf" prefix_auto="1" extension_auto="0" /> - <Option object_output="build" /> - <Option type="1" /> - <Option compiler="avrgcc" /> - <Compiler> - <Add option="-x c++" /> - <Add option="-mmcu=$(MCU)" /> - <Add option="-DF_CPU=16000000L" /> - <Add option="-D__AVR_ATmega644P__" /> - <Add option="-O2" /> - <Add option="-Os" /> - <Add directory="$(ARDUINO_DIR)/hardware/arduino/cores/arduino" /> - <Add directory="$(ARDUINO_DIR)/libraries" /> - <Add directory="$(ARDUINO_DIR)/hardware/arduino/variants/plus" /> - </Compiler> - <Linker> - <Add option="-mmcu=$(MCU)" /> - <Add option='"$(PROJECT_DIR)${TARGET_OUTPUT_DIR}/lib_${BOARD_ID}_${MCU_CLOCK}.a"' /> - <Add option='"$(PROJECT_DIR)${TARGET_OUTPUT_DIR}/core_${BOARD_ID}_${MCU_CLOCK}.a"' /> - <Add option="-s" /> - </Linker> - <ExtraCommands> - <Add before='$(TARGET_COMPILER_DIR)ArduinoUploader "$(PROJECT_DIR)." $(BOARD_ID) - $(MCU_CLOCK) 0 "$(PROJECT_DIR)${TARGET_OUTPUT_DIR}/lib_${BOARD_ID}_${MCU_CLOCK}.a" "$(PROJECT_DIR)${TARGET_OUTPUT_DIR}/core_${BOARD_ID}_${MCU_CLOCK}.a"' /> - <Add after='avr-objcopy -O ihex -R .eeprom -R .eesafe "$(TARGET_OUTPUT_FILE)" "$(TARGET_OUTPUT_FILE).hex"' /> - <Add after='avr-objcopy --no-change-warnings -j .eeprom --change-section-lma .eeprom=0 -O ihex "$(TARGET_OUTPUT_FILE)" "$(TARGET_OUTPUT_FILE).eep.hex"' /> - <Add after='avr-size --mcu=$(MCU) --format=avr "$(TARGET_OUTPUT_FILE)"' /> - </ExtraCommands> - <Environment> - <Variable name="BOARD" value="Microduino Core+ (644P)" /> - <Variable name="BOARD_ID" value="uduino644p" /> - <Variable name="MCU" value="atmega644p" /> - <Variable name="MCU_CLOCK" value="16" /> - <Variable name="UPLOAD_BAUDRATE" value="115200" /> - <Variable name="UPLOAD_PORT" value="" /> - </Environment> - </Target> - </Build> - <Compiler> - <Add directory="." /> - </Compiler> - <Unit filename="obdtest.ino"> - <Option compile="1" /> - <Option link="1" /> - </Unit> - <Extensions> - <code_completion /> - <debugger /> - </Extensions> - </Project> -</CodeBlocks_project_file> diff --git a/samples/test_obd_i2c/test_obd_i2c.ino b/samples/test_obd_i2c/test_obd_i2c.ino new file mode 100644 index 0000000..1e3a71d --- /dev/null +++ b/samples/test_obd_i2c/test_obd_i2c.ino @@ -0,0 +1,147 @@ +#include <Arduino.h> +#include <Wire.h> +#include <OBD.h> +#include <MPU6050.h> +#include <SPI.h> +#include <MultiLCD.h> + +LCD_ILI9341 lcd; + +#define CON lcd + +bool hasAAC = false; + +COBDI2C obd; + +bool initACC() +{ + if (MPU6050_init() != 0) + return false; + return true; + +} +void processACC() +{ + accel_t_gyro_union data; + MPU6050_readout(&data); + CON.print('['); + CON.print(millis()); + CON.print(']'); + // log x/y/z of accelerometer + CON.print(" AX="); + CON.print(data.value.x_accel); + CON.print(" AY="); + CON.print(data.value.y_accel); + CON.print(" AZ="); + CON.println(data.value.z_accel); + // log x/y/z of gyro meter + CON.print('['); + CON.print(millis()); + CON.print(']'); + CON.print(" GX="); + CON.print(data.value.x_gyro); + CON.print(" GY="); + CON.print(data.value.y_gyro); + CON.print(" GZ="); + CON.println(data.value.z_gyro); +} + +void setup() +{ + //CON.begin(38400); + lcd.begin(); + + CON.println("OBD TESTER"); + + obd.begin(); + + hasAAC = initACC(); + if (hasAAC) + CON.println("MPU6050 detected"); + + for (;;) { + CON.println("Connecting..."); + if (obd.init()) break; + delay(1000); + } + CON.println("Connected"); + + obd.gpsStart(38400); + + //obd.btInit(9600); +} + +byte getChecksum(char* buffer, byte len) +{ + uint8_t checksum = 0; + for (byte i = 0; i < len; i++) { + checksum ^= buffer[i]; + } + return checksum; +} + +typedef struct { + uint32_t time; + uint16_t pid; + uint8_t flags; + uint8_t checksum; + float value; +} LOG_DATA; + +void sendData(uint16_t pid, int value) +{ + LOG_DATA ld = {millis(), pid, 1, 0, value}; + ld.checksum = getChecksum((char*)&ld, sizeof(LOG_DATA)); + obd.btSend((byte*)&ld, sizeof(LOG_DATA)); +} + +void loop() +{ + int value; + + lcd.setCursor(0, 8); + + CON.print('['); + CON.print(millis()); + CON.print(']'); + if (obd.read(PID_RPM, value, false)) { + //sendData(0x100 | PID_RPM, value); + CON.print(" RPM:"); + CON.print(value); + } + if (obd.read(PID_SPEED, value, false)) { + //sendData(0x100 | PID_SPEED, value); + CON.print(" SPD:"); + CON.print(value); + } + if (obd.read(PID_THROTTLE, value, false)) { + //sendData(0x100 | PID_THROTTLE, value); + CON.print(" THR:"); + CON.print(value); + } + CON.println(""); + if (hasAAC) { + processACC(); + } + //delay(500); + + GPS_DATA gpsdata; + if (obd.gpsQuery(&gpsdata)) { + CON.print('['); + CON.print(millis()); + CON.print(']'); + CON.print(" LAT:"); + CON.print(gpsdata.lat, 6); + CON.print(" LON:"); + CON.print(gpsdata.lon, 6); + CON.print(" ALT:"); + CON.print(gpsdata.alt, 1); + CON.print(" SAT:"); + CON.print(gpsdata.sat); + CON.print(" AGE:"); + CON.print(gpsdata.age); + CON.print(" TIME:"); + CON.println(gpsdata.time); + } + //delay(500); +} diff --git a/samples/obdtest/obdtest.ino b/samples/test_obd_uart/test_obd_uart.ino index ba7ad62..ba7ad62 100644 --- a/samples/obdtest/obdtest.ino +++ b/samples/test_obd_uart/test_obd_uart.ino |