diff options
author | Stanley Huang <stanleyhuangyc@gmail.com> | 2014-07-06 21:41:11 +1000 |
---|---|---|
committer | Stanley Huang <stanleyhuangyc@gmail.com> | 2014-07-06 21:41:11 +1000 |
commit | 6c94f4fcda140f3e95a4a723a222219cc83e7776 (patch) | |
tree | a24e9c442080f3f9ce9422c77d2cb8fe2f8a2f6a /nanologger | |
parent | cc29f957a1fdbd21871d0a0183ddd2246827bc00 (diff) | |
download | 2021-arduino-obd-6c94f4fcda140f3e95a4a723a222219cc83e7776.tar.gz 2021-arduino-obd-6c94f4fcda140f3e95a4a723a222219cc83e7776.tar.bz2 2021-arduino-obd-6c94f4fcda140f3e95a4a723a222219cc83e7776.zip |
Update OBD-II logger for Arduino Nano
Diffstat (limited to 'nanologger')
-rw-r--r-- | nanologger/MicroLCD.cpp | 49 | ||||
-rw-r--r-- | nanologger/MicroLCD.h | 37 | ||||
-rw-r--r-- | nanologger/nanologger.cbp | 241 | ||||
-rw-r--r-- | nanologger/nanologger.depend | 71 | ||||
-rw-r--r-- | nanologger/nanologger.ino | 24 |
5 files changed, 78 insertions, 344 deletions
diff --git a/nanologger/MicroLCD.cpp b/nanologger/MicroLCD.cpp index b4caf3c..a602b18 100644 --- a/nanologger/MicroLCD.cpp +++ b/nanologger/MicroLCD.cpp @@ -292,8 +292,6 @@ void LCD_SSD1306::setCursor(byte column, byte line) size_t LCD_SSD1306::write(uint8_t c) { - uint8_t twbrbackup = TWBR; - TWBR = 18; // upgrade to 400KHz! if (c == '\n') { setCursor(0, m_row + ((m_font == FONT_SIZE_SMALL) ? 1 : 2)); return 1; @@ -301,6 +299,10 @@ size_t LCD_SSD1306::write(uint8_t c) m_col = 0; return 1; } +#ifdef TWBR + uint8_t twbrbackup = TWBR; + TWBR = 18; // upgrade to 400KHz! +#endif #ifndef MEMORY_SAVING if (m_font == FONT_SIZE_SMALL) { #endif @@ -385,14 +387,18 @@ size_t LCD_SSD1306::write(uint8_t c) } } #endif +#ifdef TWBR TWBR = twbrbackup; +#endif return 1; } void LCD_SSD1306::writeDigit(byte n) { +#ifdef TWBR uint8_t twbrbackup = TWBR; TWBR = 18; // upgrade to 400KHz! +#endif if (m_font == FONT_SIZE_SMALL) { Wire.beginTransmission(_i2caddr); Wire.write(0x40); @@ -542,7 +548,9 @@ void LCD_SSD1306::writeDigit(byte n) } m_col += (m_flags & FLAG_PIXEL_DOUBLE_H) ? 30 : 16; } +#ifdef TWBR TWBR = twbrbackup; +#endif } void LCD_SSD1306::draw(const PROGMEM byte* buffer, byte width, byte height) @@ -551,13 +559,13 @@ void LCD_SSD1306::draw(const PROGMEM byte* buffer, byte width, byte height) ssd1306_command(SSD1306_SETHIGHCOLUMN | 0x0); // hi col = 0 ssd1306_command(SSD1306_SETSTARTLINE | 0x0); // line #0 - // save I2C bitrate - uint8_t twbrbackup = TWBR; - TWBR = 18; // upgrade to 400KHz! - const PROGMEM byte *p = buffer; height >>= 3; width >>= 3; +#ifdef TWBR + uint8_t twbrbackup = TWBR; + TWBR = 18; // upgrade to 400KHz! +#endif for (byte i = 0; i < height; i++) { // send a bunch of data in one xmission ssd1306_command(0xB0 + i + m_row);//set page address @@ -573,8 +581,10 @@ void LCD_SSD1306::draw(const PROGMEM byte* buffer, byte width, byte height) Wire.endTransmission(); } } - TWBR = twbrbackup; m_col += width; +#ifdef TWBR + TWBR = twbrbackup; +#endif } void LCD_SSD1306::clearLine(byte line) @@ -583,9 +593,10 @@ void LCD_SSD1306::clearLine(byte line) ssd1306_command(SSD1306_SETHIGHCOLUMN | 0x0); // hi col = 0 ssd1306_command(SSD1306_SETSTARTLINE | 0x0); // line #0 - // save I2C bitrate +#ifdef TWBR uint8_t twbrbackup = TWBR; TWBR = 18; // upgrade to 400KHz! +#endif // send a bunch of data in one xmission ssd1306_command(0xB0 + line);//set page address @@ -600,8 +611,9 @@ void LCD_SSD1306::clearLine(byte line) } Wire.endTransmission(); } - +#ifdef TWBR TWBR = twbrbackup; +#endif } void LCD_SSD1306::clear(byte x, byte y, byte width, byte height) @@ -610,13 +622,13 @@ void LCD_SSD1306::clear(byte x, byte y, byte width, byte height) ssd1306_command(SSD1306_SETHIGHCOLUMN | 0x0); // hi col = 0 ssd1306_command(SSD1306_SETSTARTLINE | 0x0); // line #0 - // save I2C bitrate - uint8_t twbrbackup = TWBR; - TWBR = 18; // upgrade to 400KHz! - height >>= 3; width >>= 3; y >>= 3; +#ifdef TWBR + uint8_t twbrbackup = TWBR; + TWBR = 18; // upgrade to 400KHz! +#endif for (byte i = 0; i < height; i++) { // send a bunch of data in one xmission ssd1306_command(0xB0 + i + y);//set page address @@ -632,7 +644,14 @@ void LCD_SSD1306::clear(byte x, byte y, byte width, byte height) Wire.endTransmission(); } } - - setCursor(0, 0); +#ifdef TWBR TWBR = twbrbackup; +#endif + setCursor(0, 0); +} + +void LCD_SSD1306::setContrast(byte Contrast) +{ + ssd1306_command(SSD1306_SETCONTRAST); + ssd1306_command(Contrast); } diff --git a/nanologger/MicroLCD.h b/nanologger/MicroLCD.h index e421505..51781ab 100644 --- a/nanologger/MicroLCD.h +++ b/nanologger/MicroLCD.h @@ -1,13 +1,14 @@ /************************************************************************* -* Arduino Text Display Library for Multiple LCDs +* Arduino Text & Bitmap Display Library for multiple models of monochrome LCD display * Distributed under GPL v2.0 -* Copyright (c) 2013 Stanley Huang <stanleyhuangyc@live.com> +* Copyright (c) 2013-2014 Stanley Huang <stanleyhuangyc@gmail.com> * All rights reserved. +* For more information, please visit http://arduinodev.com *************************************************************************/ -#if !defined(__AVR_ATmega2560__) && !defined(__AVR_ATmega1280__) && !defined(__AVR_ATmega644P__) +#include <Arduino.h> + //#define MEMORY_SAVING -#endif typedef enum { FONT_SIZE_SMALL = 0, @@ -32,10 +33,10 @@ class LCD_Common { public: LCD_Common():m_font(FONT_SIZE_SMALL),m_flags(0) {} - void setFont(FONT_SIZE size) { m_font = size; } + void setFontSize(FONT_SIZE size) { m_font = size; } void setFlags(byte flags) { m_flags = flags; } virtual void backlight(bool on) {} - virtual void draw(const PROGMEM byte* buffer, byte x, byte y, byte width, byte height) {} + virtual void draw(const PROGMEM byte* buffer, byte width, byte height) {} void printInt(uint16_t value, int8_t padding = -1); void printLong(uint32_t value, int8_t padding = -1); protected: @@ -62,6 +63,7 @@ class LCD_SSD1306 : public LCD_Common, public SSD1306, public Print { public: void setCursor(byte column, byte line); + void setContrast(byte Contrast); void draw(const PROGMEM byte* buffer, byte width, byte height); size_t write(uint8_t c); void clear(byte x = 0, byte y = 0, byte width = 128, byte height = 64); @@ -92,3 +94,26 @@ private: byte m_col; byte m_row; }; + +#include "PCD8544.h" + +class LCD_PCD8544 : public LCD_Common, public PCD8544 +{ +public: + byte getLines() { return 6; } + byte getCols() { return 14; } + void backlight(bool on) + { + pinMode(7, OUTPUT); + digitalWrite(7, on ? HIGH : LOW); + } + void clearLine(byte line) + { + setCursor(0, line); + for (byte i = 14; i > 0; i--) write(' '); + } + void draw(const PROGMEM byte* buffer, byte width, byte height); +private: + void writeDigit(byte n); +}; + diff --git a/nanologger/nanologger.cbp b/nanologger/nanologger.cbp index c45b7ad..6024094 100644 --- a/nanologger/nanologger.cbp +++ b/nanologger/nanologger.cbp @@ -98,42 +98,6 @@ <Variable name="UPLOAD_PORT" value="" /> </Environment> </Target> - <Target title="Arduino Esplora"> - <Option output="bin/Release/obdlogger_${BOARD_ID}.elf" prefix_auto="1" extension_auto="0" /> - <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="-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)bin/lib_${BOARD_ID}_${MCU_CLOCK}.a"' /> - <Add option='"$(PROJECT_DIR)bin/core_${BOARD_ID}_${MCU_CLOCK}.a"' /> - </Linker> - <ExtraCommands> - <Add before='$(TARGET_COMPILER_DIR)ArduinoUploader "$(PROJECT_DIR)." $(BOARD_ID) - $(MCU_CLOCK) 0 "$(PROJECT_DIR)bin/lib_${BOARD_ID}_${MCU_CLOCK}.a" "$(PROJECT_DIR)bin/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="bin/Release/obdlogger_${BOARD_ID}.elf" prefix_auto="1" extension_auto="0" /> <Option type="1" /> @@ -204,40 +168,6 @@ <Variable name="UPLOAD_PORT" value="" /> </Environment> </Target> - <Target title="Arduino Duemilanove (168)"> - <Option output="bin/Release/obdlogger_${BOARD_ID}.elf" prefix_auto="1" extension_auto="0" /> - <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="-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)bin/lib_${BOARD_ID}_${MCU_CLOCK}.a"' /> - <Add option='"$(PROJECT_DIR)bin/core_${BOARD_ID}_${MCU_CLOCK}.a"' /> - </Linker> - <ExtraCommands> - <Add before='$(TARGET_COMPILER_DIR)ArduinoUploader "$(PROJECT_DIR)." $(BOARD_ID) - $(MCU_CLOCK) 0 "$(PROJECT_DIR)bin/lib_${BOARD_ID}_${MCU_CLOCK}.a" "$(PROJECT_DIR)bin/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="bin/Release/obdlogger_${BOARD_ID}.elf" prefix_auto="1" extension_auto="0" /> <Option type="1" /> @@ -272,40 +202,6 @@ <Variable name="UPLOAD_PORT" value="" /> </Environment> </Target> - <Target title="Arduino Nano (168)"> - <Option output="bin/Release/obdlogger_${BOARD_ID}.elf" prefix_auto="1" extension_auto="0" /> - <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="-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)bin/lib_${BOARD_ID}_${MCU_CLOCK}.a"' /> - <Add option='"$(PROJECT_DIR)bin/core_${BOARD_ID}_${MCU_CLOCK}.a"' /> - </Linker> - <ExtraCommands> - <Add before='$(TARGET_COMPILER_DIR)ArduinoUploader "$(PROJECT_DIR)." $(BOARD_ID) - $(MCU_CLOCK) 0 "$(PROJECT_DIR)bin/lib_${BOARD_ID}_${MCU_CLOCK}.a" "$(PROJECT_DIR)bin/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="bin/Release/obdlogger_${BOARD_ID}.elf" prefix_auto="1" extension_auto="0" /> <Option type="1" /> @@ -340,40 +236,6 @@ <Variable name="UPLOAD_PORT" value="" /> </Environment> </Target> - <Target title="Arduino Mini (168)"> - <Option output="bin/Release/obdlogger_${BOARD_ID}.elf" prefix_auto="1" extension_auto="0" /> - <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="-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)bin/lib_${BOARD_ID}_${MCU_CLOCK}.a"' /> - <Add option='"$(PROJECT_DIR)bin/core_${BOARD_ID}_${MCU_CLOCK}.a"' /> - </Linker> - <ExtraCommands> - <Add before='$(TARGET_COMPILER_DIR)ArduinoUploader "$(PROJECT_DIR)." $(BOARD_ID) - $(MCU_CLOCK) 0 "$(PROJECT_DIR)bin/lib_${BOARD_ID}_${MCU_CLOCK}.a" "$(PROJECT_DIR)bin/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="bin/Release/obdlogger_${BOARD_ID}.elf" prefix_auto="1" extension_auto="0" /> <Option type="1" /> @@ -408,40 +270,6 @@ <Variable name="UPLOAD_PORT" value="" /> </Environment> </Target> - <Target title="Arduino Pro Mini (168)"> - <Option output="bin/Release/obdlogger_${BOARD_ID}.elf" prefix_auto="1" extension_auto="0" /> - <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="-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)bin/lib_${BOARD_ID}_${MCU_CLOCK}.a"' /> - <Add option='"$(PROJECT_DIR)bin/core_${BOARD_ID}_${MCU_CLOCK}.a"' /> - </Linker> - <ExtraCommands> - <Add before='$(TARGET_COMPILER_DIR)ArduinoUploader "$(PROJECT_DIR)." $(BOARD_ID) - $(MCU_CLOCK) 0 "$(PROJECT_DIR)bin/lib_${BOARD_ID}_${MCU_CLOCK}.a" "$(PROJECT_DIR)bin/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="bin/Release/obdlogger_${BOARD_ID}.elf" prefix_auto="1" extension_auto="0" /> <Option type="1" /> @@ -510,74 +338,6 @@ <Variable name="UPLOAD_PORT" value="" /> </Environment> </Target> - <Target title="Arduino Mega 8"> - <Option output="bin/Release/obdlogger_${BOARD_ID}.elf" prefix_auto="1" extension_auto="0" /> - <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="-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)bin/lib_${BOARD_ID}_${MCU_CLOCK}.a"' /> - <Add option='"$(PROJECT_DIR)bin/core_${BOARD_ID}_${MCU_CLOCK}.a"' /> - </Linker> - <ExtraCommands> - <Add before='$(TARGET_COMPILER_DIR)ArduinoUploader "$(PROJECT_DIR)." $(BOARD_ID) - $(MCU_CLOCK) 0 "$(PROJECT_DIR)bin/lib_${BOARD_ID}_${MCU_CLOCK}.a" "$(PROJECT_DIR)bin/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="bin/Release/obdlogger_${BOARD_ID}.elf" prefix_auto="1" extension_auto="0" /> - <Option type="1" /> - <Option compiler="avrgcc" /> - <Compiler> - <Add option="-O3" /> - <Add option="-x c++" /> - <Add option="-mmcu=$(MCU)" /> - <Add option="-DF_CPU=16000000L" /> - <Add option="-D__AVR_ATmega644P__" /> - <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)bin/lib_${BOARD_ID}_${MCU_CLOCK}.a"' /> - <Add option='"$(PROJECT_DIR)bin/core_${BOARD_ID}_${MCU_CLOCK}.a"' /> - </Linker> - <ExtraCommands> - <Add before='$(TARGET_COMPILER_DIR)ArduinoUploader "$(PROJECT_DIR)." $(BOARD_ID) - $(MCU_CLOCK) 0 "$(PROJECT_DIR)bin/lib_${BOARD_ID}_${MCU_CLOCK}.a" "$(PROJECT_DIR)bin/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="." /> @@ -595,6 +355,7 @@ <Extensions> <code_completion /> <debugger /> + <envvars /> </Extensions> </Project> </CodeBlocks_project_file> diff --git a/nanologger/nanologger.depend b/nanologger/nanologger.depend deleted file mode 100644 index 6f4664c..0000000 --- a/nanologger/nanologger.depend +++ /dev/null @@ -1,71 +0,0 @@ -# depslib dependency file v1.0 -1394256987 source:e:\arduino\arduinoobd\nanologger\microlcd.cpp - <Arduino.h> - <Wire.h> - "MicroLCD.h" - -1371033101 d:\apps\codeblocks\arduino\hardware\arduino\cores\arduino\arduino.h - <stdlib.h> - <string.h> - <math.h> - <avr/pgmspace.h> - <avr/io.h> - <avr/interrupt.h> - "binary.h" - "WCharacter.h" - "WString.h" - "HardwareSerial.h" - "pins_arduino.h" - -1362986950 d:\apps\codeblocks\arduino\hardware\arduino\cores\arduino\binary.h - -1362986950 d:\apps\codeblocks\arduino\hardware\arduino\cores\arduino\wcharacter.h - <ctype.h> - -1371033133 d:\apps\codeblocks\arduino\hardware\arduino\cores\arduino\wstring.h - <stdlib.h> - <string.h> - <ctype.h> - <avr/pgmspace.h> - -1362986950 d:\apps\codeblocks\arduino\hardware\arduino\cores\arduino\hardwareserial.h - <inttypes.h> - "Stream.h" - "USBAPI.h" - -1371032829 d:\apps\codeblocks\arduino\hardware\arduino\cores\arduino\stream.h - <inttypes.h> - "Print.h" - -1362986950 d:\apps\codeblocks\arduino\hardware\arduino\cores\arduino\print.h - <inttypes.h> - <stdio.h> - "WString.h" - "Printable.h" - -1362986950 d:\apps\codeblocks\arduino\hardware\arduino\cores\arduino\printable.h - <new.h> - -1362986950 d:\apps\codeblocks\arduino\hardware\arduino\cores\arduino\new.h - <stdlib.h> - -1362986950 d:\apps\codeblocks\arduino\hardware\arduino\cores\arduino\usbapi.h - -1362986950 d:\apps\codeblocks\arduino\hardware\arduino\variants\eightanaloginputs\pins_arduino.h - "../standard/pins_arduino.h" - -1362986950 d:\apps\codeblocks\arduino\hardware\arduino\variants\standard\pins_arduino.h - <avr/pgmspace.h> - -1394121163 e:\arduino\arduinoobd\nanologger\microlcd.h - "SSD1306.h" - -1371132197 e:\arduino\arduinoobd\nanologger\ssd1306.h - "Arduino.h" - "WProgram.h" - -1394121227 source:e:\arduino\arduinoobd\nanologger\sh1106.cpp - <Arduino.h> - <Wire.h> - "MicroLCD.h" - diff --git a/nanologger/nanologger.ino b/nanologger/nanologger.ino index 10c1b5e..cc03a53 100644 --- a/nanologger/nanologger.ino +++ b/nanologger/nanologger.ino @@ -72,7 +72,7 @@ public: #if ENABLE_DATA_LOG uint16_t index = openFile(); - lcd.setFont(FONT_SIZE_SMALL); + lcd.setFontSize(FONT_SIZE_SMALL); lcd.setCursor(86, 0); if (index) { lcd.write('['); @@ -120,7 +120,7 @@ public: // display distance travelled (GPS) char buf[10]; sprintf(buf, "%4ukm", (uint16_t)(distance / 1000)); - lcd.setFont(FONT_SIZE_SMALL); + lcd.setFontSize(FONT_SIZE_SMALL); lcd.setCursor(92, 6); lcd.print(buf); @@ -138,7 +138,7 @@ public: // display logged data size char buf[7]; sprintf(buf, "%4uKB", (int)(dataSize >> 10)); - lcd.setFont(FONT_SIZE_SMALL); + lcd.setFontSize(FONT_SIZE_SMALL); lcd.setCursor(92, 7); lcd.print(buf); } @@ -246,7 +246,7 @@ private: closeFile(); #endif lcd.clear(); - lcd.setFont(FONT_SIZE_MEDIUM); + lcd.setFontSize(FONT_SIZE_MEDIUM); lcd.print("Reconnecting"); startTime = millis(); state &= ~(STATE_OBD_READY | STATE_ACC_READY); @@ -277,7 +277,7 @@ private: // screen layout related stuff void showStates() { - lcd.setFont(FONT_SIZE_MEDIUM); + lcd.setFontSize(FONT_SIZE_MEDIUM); lcd.setCursor(0, 4); lcd.print("OBD "); showTickCross(state & STATE_OBD_READY); @@ -291,26 +291,26 @@ private: switch (pid) { case PID_RPM: lcd.setCursor(64, 0); - lcd.setFont(FONT_SIZE_XLARGE); + lcd.setFontSize(FONT_SIZE_XLARGE); lcd.printInt((unsigned int)value % 10000, 4); break; case PID_SPEED: if (lastSpeed != value) { lcd.setCursor(0, 0); - lcd.setFont(FONT_SIZE_XLARGE); + lcd.setFontSize(FONT_SIZE_XLARGE); lcd.printInt((unsigned int)value % 1000, 3); lastSpeed = value; } break; case PID_THROTTLE: lcd.setCursor(24, 5); - lcd.setFont(FONT_SIZE_SMALL); + lcd.setFontSize(FONT_SIZE_SMALL); lcd.printInt(value % 100, 3); break; case PID_INTAKE_TEMP: if (value < 1000) { lcd.setCursor(102, 5); - lcd.setFont(FONT_SIZE_SMALL); + lcd.setFontSize(FONT_SIZE_SMALL); lcd.printInt(value, 3); } break; @@ -349,7 +349,7 @@ private: { lcd.clear(); lcd.backlight(true); - lcd.setFont(FONT_SIZE_SMALL); + lcd.setFontSize(FONT_SIZE_SMALL); lcd.setCursor(24, 3); lcd.print("km/h"); lcd.setCursor(110, 3); @@ -366,14 +366,14 @@ static COBDLogger logger; void setup() { lcd.begin(); - lcd.setFont(FONT_SIZE_MEDIUM); + lcd.setFontSize(FONT_SIZE_MEDIUM); lcd.println("NanoLogger"); logger.begin(); logger.initSender(); #if ENABLE_DATA_LOG - lcd.setFont(FONT_SIZE_MEDIUM); + lcd.setFontSize(FONT_SIZE_MEDIUM); lcd.setCursor(0, 2); logger.checkSD(); #endif |