kubi48 / TransistorTester-source

Sources of the Transistor Tester project
182 stars 48 forks source link

Porting ComponentTester-1.47m firmware to LCR-T5 required changing contrast resistor ratio from 6.5 to 4.5 in ST7565R.c #3

Open ejouellette opened 2 years ago

ejouellette commented 2 years ago

Hi,

I was able to configure ComponentTester-1.47m firmware to work properly on a LCR-T5 meter, based on the STRIP_GRID_BOARD = 5 LCD port mapping found in Karl-Heinz firmware. In order for the LCD contrast to work properly within the LCD_CONTRAST range of 1-63, a minor edit to ST7565R.c was required:

The lines:
/ set contrast: resistor ratio 6.5 / LCD_Cmd(CMD_V0_RATIO | FLAG_RATIO_65);

should be changed to: / set contrast: resistor ratio 4.5 / LCD_Cmd(CMD_V0_RATIO | FLAG_RATIO_45);

I've also included the other modified config files: Makefile, config.h, and config_328.h.

Hope this helps!

ejouellette commented 2 years ago

config.h contents:

/* **** *

/ source management /

define CONFIG_H

/*

/* ****

/*

//#define HW_ENCODER

/*

//#define ENCODER_PULSES 4

/*

//#define ENCODER_STEPS 24

/*

//#define HW_INCDEC_KEYS

/*

define HW_REF25

/*

define UREF_25 2495

/*

//#define HW_DISCHARGE_RELAY

/*

//#define HW_ZENER

/*

define ZENER_DIVIDER_CUSTOM

define ZENER_R1 100000

define ZENER_R2 12000

/*

//#define ZENER_UNSWITCHED

/*

//#define HW_PROBE_ZENER

define ZENER_VOLTAGE_MIN 10 / min. voltage in mV /

define ZENER_VOLTAGE_MAX 20000 / max. voltage in mV /

/*

//#define HW_FIXED_SIGNAL_OUTPUT

/*

//#define HW_FREQ_COUNTER_BASIC

/*

//#define HW_FREQ_COUNTER_EXT

define FREQ_COUNTER_PRESCALER 16 / 16:1 /

//#define FREQ_COUNTER_PRESCALER 32 / 32:1 /

/*

//#define HW_RING_TESTER

define RING_TESTER_PIN / dedicated pin /

//#define RING_TESTER_PROBES / probes /

/*

//#define HW_EVENT_COUNTER

/*

//#define EVENT_COUNTER_TRIGGER_OUT

/*

//#define HW_IR_RECEIVER

/*

//#define HW_ADJUST_CAP

/*

//#define HW_LC_METER

/*

define LC_METER_C_REF 10000

/*

//#define LC_METER_SHOW_FREQ

/*

//#define HW_CAP_RELAY

/*

//#define HW_LOGIC_PROBE

define LOGIC_PROBE_R1 10000

define LOGIC_PROBE_R2 3300

/*

//#define HW_BUZZER

/*

//#define HW_MAX6675

/*

//#define HW_MAX31855

/* ****

/*

define SW_PWM_SIMPLE

/*

//#define SW_PWM_PLUS

/*

define PWM_SHOW_DURATION

/*

define SW_INDUCTOR

/*

define SW_ESR

//#define SW_OLD_ESR

/*

define SW_ESR_TOOL

/*

//#define SW_ENCODER

/*

//#define SW_SQUAREWAVE

/*

//#define SW_IR_RECEIVER

/*

//#define SW_IR_DISABLE_RESISTOR

/*

//#define SW_IR_RX_EXTRA

/*

//#define SW_IR_TRANSMITTER

/*

//#define SW_IR_TX_ALTDELAY

/*

//#define SW_IR_TX_EXTRA

/*

define SW_OPTO_COUPLER

/*

define SW_UJT

/*

define SW_SCHOTTKY_BJT

/*

//#define SW_SERVO

/*

define SW_DS18B20

/*

//#define ONEWIRE_READ_ROM

/*

define SW_ONEWIRE_SCAN

/*

define SW_CAP_LEAKAGE

/*

//#define SW_REVERSE_HFE

/*

define SW_HFE_CURRENT

/*

define SW_MONITOR_R / just R /

//#define SW_MONITOR_C / just C plus ESR /

define SW_MONITOR_L / just L /

define SW_MONITOR_RCL / R plus L, or C plus ESR /

//#define SW_MONITOR_RL / R plus L /

/*

define SW_MONITOR_HOLD_ESR / auto-hold ESR (C monitor) /

define SW_MONITOR_HOLD_L / auto-hold L (L monitor) /

/*

//#define SW_DHTXX

/*

//#define SW_R_E24_5_T / E24 5% tolerance, text / //#define SW_R_E24_5_CC / E24 5% tolerance, color-code / //#define SW_R_E24_1_T / E24 1% tolerance, text / //#define SW_R_E24_1_CC / E24 1% tolerance, color-code /

define SW_R_E96_T / E96 1% tolerance, text /

//#define SW_R_E96_CC / E96 1% tolerance, color-code / //#define SW_R_E96_EIA96 / E96 1% tolerance, EIA-96 code /

/*

//#define SW_C_E6_T / E6 20% tolerance, text /

define SW_C_E12_T / E12 10% tolerance, text /

/*

//#define SW_L_E6_T / E6 20% tolerance, text /

define SW_L_E12_T / E12 10% tolerance, text /

/*

//#define SW_CONTINUITY_CHECK

/* ****

/*

//#define NO_HFE_C_RL

/* ****

/*

ifndef OSC_STARTUP

define OSC_STARTUP 16384

endif

/* ****

/*

define UI_ENGLISH

//#define UI_CZECH //#define UI_CZECH_2 //#define UI_DANISH //#define UI_GERMAN //#define UI_ITALIAN //#define UI_POLISH //#define UI_POLISH_2 //#define UI_ROMANIAN //#define UI_RUSSIAN //#define UI_RUSSIAN_2 //#define UI_SPANISH

/*

//#define UI_COMMA

/*

//#define UI_FAHRENHEIT

/*

define UI_HEX_UPPERCASE

/*

//#define UI_AUTOHOLD

/*

//#define UI_SHORT_CIRCUIT_MENU

/*

//#define UI_KEY_HINTS

/*

//#define UI_CHOOSE_PROFILE

/*

//#define UI_THREE_PROFILES

/*

//#define UI_SERIAL_COPY

/*

//#define UI_SERIAL_COMMANDS

/*

define CYCLE_DELAY 3000

/*

define CYCLE_MAX 5

/*

//#define POWER_OFF_TIMEOUT 60

/*

define SW_SYMBOLS

/*

define UI_PINOUT_ALT

/*

define UI_QUESTION_MARK

/*

define UI_ZENER_DIODE

/*

//#define UI_QUARTZ_CRYSTAL

/*

//#define UI_NO_TEXTPINOUT

/*

define UI_NO_BODYDIODE_TEXTPINOUT

/*

//#define UI_PROBE_REVERSED //#define UI_PROBE_REVERSED_X

/*

//#define UI_PROBE_COLORS

/*

//#define UI_COLORED_TITLES

/*

//#define UI_COLORED_CURSOR

/*

//#define UI_MAINMENU_AUTOEXIT

/*

define SW_POWER_OFF

/*

//#define SW_FONT_TEST

/*

define SW_SYMBOL_TEST

/*

//#define UI_ROUND_DS18B20

/*

define DATA_EEPROM / store data in EEPROM /

//#define DATA_FLASH / store data in Flash /

/* ****

/*

define POWER_SWITCH_SOFT

//#define POWER_SWITCH_MANUAL

/*

//#define BAT_NONE

define BAT_DIRECT

//#define BAT_DIVIDER

/*

//#define BAT_EXT_UNMONITORED

/*

define BAT_R1 10000

define BAT_R2 3300

/*

define BAT_OFFSET 0

/*

define BAT_WEAK 3700

/*

define BAT_LOW 3300

/*

define SAVE_POWER

/* ****

/*

define UREF_VCC 5001

/*

define UREF_OFFSET 0

/*

/ Rl in Ohms /

define R_LOW 680

/ Rh in Ohms /

define R_HIGH 470000

/*

define RH_OFFSET 350

/*

define R_ZERO 20

/*

//#define R_MULTIOFFSET

/*

define C_ZERO 43

/*

//#define CAP_MULTIOFFSET

/*

define CAP_DISCHARGED 2

/*

define CAP_FACTOR_SMALL 0 / no correction /

define CAP_FACTOR_MID -40 / -4.0% /

define CAP_FACTOR_LARGE -90 / -9.0% /

/*

define ADC_SAMPLES 25

/*

//#define ADC_LARGE_BUFFER_CAP

/* ****

/*

//#define LCD_READ

/*

//#define SW_DISPLAY_ID

/*

//#define SW_DISPLAY_REG

/* ****

/ MCU clock /

define CPU_FREQ F_CPU

/*

if defined(__AVR_ATmega328__)

include "config_328.h"

/*

elif defined(AVR_ATmega324P) || defined(AVR_ATmega644) || defined(__AVR_ATmega1284__)

include "config_644.h"

/*

elif defined(AVR_ATmega640) || defined(AVR_ATmega1280) || defined(__AVR_ATmega2560__)

include "config_1280.h"

/*

else

error <<< No or wrong MCU type selected! >>>

endif

/* ****

/*

//#define I2C_BITBANG / bit-bang I2C / //#define I2C_HARDWARE / MCU's hardware TWI / //#define I2C_STANDARD_MODE / 100kHz bus speed / //#define I2C_FAST_MODE / 400kHz bus speed / //#define I2C_RW / enable I2C read support (untested) /

/*

define SPI_BITBANG / bit-bang SPI /

//#define SPI_HARDWARE / hardware SPI / //#define SPI_RW / enable SPI read support /

/*

//#define SERIAL_BITBANG / bit-bang serial / //#define SERIAL_HARDWARE / hardware serial / //#define SERIAL_RW / enable serial read support /

/*

define ONEWIRE_PROBES / via probes /

//#define ONEWIRE_IO_PIN / via dedicated I/O pin /

/* ****

/*

if CPU_FREQ == 20000000

/ 20MHz MCU clock /

define ADC_FREQ 156250

else

/ all other MCU clocks /

define ADC_FREQ 125000

endif

/*

/ 1MHz/250kHz /

if CPU_FREQ / ADC_FREQ == 4

define ADC_CLOCK_DIV (1 << ADPS1)

endif

/ 1MHz/125kHz 2MHz/250kHz /

if CPU_FREQ / ADC_FREQ == 8

define ADC_CLOCK_DIV (1 << ADPS1) | (1 << ADPS0)

endif

/ 2MHz/125kHz 4MHz/250kHz /

if CPU_FREQ / ADC_FREQ == 16

define ADC_CLOCK_DIV (1 << ADPS2)

endif

/ 4MHz/125kHz 8MHz/250kHz /

if CPU_FREQ / ADC_FREQ == 32

define ADC_CLOCK_DIV (1 << ADPS2) | (1 << ADPS0)

endif

/ 8MHz/125kHz 16MHz/250kHz /

if CPU_FREQ / ADC_FREQ == 64

define ADC_CLOCK_DIV (1 << ADPS2) | (1 << ADPS1)

endif

/ 16MHz/125kHz 20MHz/156.25kHz /

if CPU_FREQ / ADC_FREQ == 128

define ADC_CLOCK_DIV (1 << ADPS2) | (1 << ADPS1) | (1 << ADPS0)

endif

/* ****

/*

define MCU_CYCLES_PER_US (CPU_FREQ / 1000000)

/*

define MCU_CYCLES_PER_ADC (CPU_FREQ / ADC_FREQ)

/*

define MCU_CYCLE_TIME (10000 / (CPU_FREQ / 1000000))

/* ****

/*

if defined (DATA_EEPROM)

/ memory type /

define MEM_TYPE EEMEM

/ read functions /

define DATA_read_byte(addr) eeprom_read_byte(addr)

define DATA_read_word(addr) eeprom_read_word(addr)

elif defined (DATA_FLASH)

/ memory type /

define MEM_TYPE PROGMEM

/ read functions /

define DATA_read_byte(addr) pgm_read_byte(addr)

define DATA_read_word(addr) pgm_read_word(addr)

endif

/*

/ power switch: prefer soft-latching type /

ifdef POWER_SWITCH_SOFT

ifdef POWER_SWITCH_MANUAL

#undef POWER_SWITCH_MANUAL

endif

endif

/ additional keys / / rotary encoder, increase/decrease push buttons or touch screen /

if defined (HW_ENCODER) || defined (HW_INCDEC_KEYS) | defined (HW_TOUCH)

define HW_KEYS

endif

/ options which require additional keys /

ifndef HW_KEYS

/ key hints /

ifdef UI_KEY_HINTS

#undef UI_KEY_HINTS

endif

/ PWM+ /

ifdef SW_PWM_PLUS

#undef SW_PWM_PLUS
#define SW_PWM_SIMPLE   

endif

/ squarewave generator /

ifdef SW_SQUAREWAVE

#undef SW_SQUAREWAVE

endif

/ Servo Check /

ifdef SW_SERVO

#undef SW_SERVO

endif

/ event counter /

ifdef HW_EVENT_COUNTER

#undef HW_EVENT_COUNTER

endif

/ IR Sender /

ifdef SW_IR_TRANSMITTER

#undef SW_IR_TRANSMITTER

endif

/ logic probe /

ifdef HW_LOGIC_PROBE

#undef HW_LOGIC_PROBE

endif

endif

/ options which require inductance measurement /

ifndef SW_INDUCTOR

/ L monitor /

ifdef SW_MONITOR_L

#undef SW_MONITOR_L

endif

/ RCL Monitor /

ifdef SW_MONITOR_RCL

#undef SW_MONITOR_RCL

endif

/ RL Monitor /

ifdef SW_MONITOR_RL

#undef SW_MONITOR_RL

endif

endif

/ options which require ESR measurement /

if ! defined (SW_ESR) && ! defined (SW_OLD_ESR)

/ ESR tool /

ifdef SW_ESR_TOOL

#undef SW_ESR_TOOL

endif

endif

/ options which require a buzzer /

if ! defined (HW_BUZZER)

/ continuity check /

ifdef SW_CONTINUITY_CHECK

#undef SW_CONTINUITY_CHECK

endif

endif

/ options which require a MCU clock >= 8MHz /

if CPU_FREQ < 8000000

/ ESR measurement /

ifdef SW_ESR

#undef SW_ESR

endif

/ old ESR measurement /

ifdef SW_OLD_ESR

#undef SW_OLD_ESR

endif

endif

/ SPI: either bit-bang or hardware /

if defined (SPI_BITBANG) && defined (SPI_HARDWARE)

error <<< Select either bitbang or hardware SPI! >>>

endif

/ SPI: common switch /

if defined (SPI_BITBANG) || defined (SPI_HARDWARE)

define HW_SPI

endif

/ 9-Bit SPI requires bit-bang mode /

ifdef SPI_9

ifndef SPI_BITBANG

#error <<< 9-Bit SPI requires bit-bang mode! >>>

endif

endif

/ options which require SPI /

ifndef HW_SPI

/ SPI read support /

ifdef SPI_RW

#undef SPI_RW

endif

endif

/ options which require SPI read support /

ifndef SPI_RW

/ MAX6675 /

ifdef HW_MAX6675

#undef HW_MAX6675

endif

/ MAX31855 /

ifdef HW_MAX31855

#undef HW_MAX31855

endif

endif

/ I2C: either bit-bang or hardware /

if defined (I2C_BITBANG) && defined (I2C_HARDWARE)

error <<< Select either bitbang or hardware I2C! >>>

endif

/ I2C: common switch /

if defined (I2C_BITBANG) || defined (I2C_HARDWARE)

define HW_I2C

endif

/ TTL serial: either bit-bang or hardware /

if defined (SERIAL_BITBANG) && defined (SERIAL_HARDWARE)

error <<< Select either bitbang or hardware serial interface! >>>

endif

/ TTL serial: common switch /

if defined (SERIAL_BITBANG) || defined (SERIAL_HARDWARE)

define HW_SERIAL

endif

/ VT100 display driver disables other options for serial interface /

ifdef LCD_VT100

ifdef UI_SERIAL_COPY

#undef UI_SERIAL_COPY

endif

ifdef UI_SERIAL_COMMANDS

#undef UI_SERIAL_COMMANDS

endif

endif

/ options which require TTL serial /

ifndef HW_SERIAL

/ VT100 display /

ifdef LCD_VT100

#undef LCD_VT100

endif

/ serial copy /

ifdef UI_SERIAL_COPY

#undef UI_SERIAL_COPY

endif

/ remote commands /

ifdef UI_SERIAL_COMMANDS

#undef UI_SERIAL_COMMANDS

endif

endif

/ options which require TTL serial RW /

ifndef SERIAL_RW

ifdef UI_SERIAL_COMMANDS

#undef UI_SERIAL_COMMANDS

endif

endif

/ OneWire /

if defined (ONEWIRE_PROBES) && defined (ONEWIRE_IO_PIN)

error <<< Select either probes or dedicated IO pin for Onewire! >>>

endif

/ options which require OneWire /

if ! defined (ONEWIRE_PROBES) && ! defined (ONEWIRE_IO_PIN)

/ DS18B20 /

ifdef SW_DS18B20

#undef SW_DS18B20

endif

/ OneWire scan /

ifdef SW_ONEWIRE_SCAN

#undef SW_ONEWIRE_SCAN

endif

endif

/ touchscreen /

ifdef TOUCH_PORT

define HW_TOUCH

endif

/ LCD module /

ifdef LCD_CONTRAST

define SW_CONTRAST

else

define LCD_CONTRAST 0

endif

/ options which require a color display /

ifndef LCD_COLOR

/ color coding for probes /

ifdef UI_PROBE_COLORS

#undef UI_PROBE_COLORS

endif

/ colored titles /

ifdef UI_COLORED_TITLES

#undef UI_COLORED_TITLES

endif

/ colored cursor and key hints /

ifdef UI_COLORED_CURSOR

#undef UI_COLORED_CURSOR

endif

endif

/ options which require a color graphics display /

if ! defined (LCD_COLOR) || ! defined (LCD_GRAPHIC)

/ resistor color-codes /

ifdef SW_R_E24_5_CC

#undef SW_R_E24_5_CC

endif

ifdef SW_R_E24_1_CC

#undef SW_R_E24_1_CC

endif

ifdef SW_R_E96_CC

#undef SW_R_E96_CC

endif

endif

/ additional font characters with reversed colors /

if defined (UI_PROBE_REVERSED) || defined (UI_PROBE_REVERSED_X)

ifndef FONT_EXTRA

#define FONT_EXTRA

endif

ifndef FONT_INVERSE

#define FONT_INVERSE

endif

endif

/ component symbols for fancy pinout /

if defined (SYMBOLS_24X24_H) || defined (SYMBOLS_24X24_OLD_H) || defined (SYMBOLS_24X24_ALT1_H) || defined (SYMBOLS_24X24_ALT2_H)

define SYMBOLS_SELECTED

endif

if defined (SYMBOLS_24X24_HF) || defined (SYMBOLS_24X24_OLD_HF) || defined (SYMBOLS_24X24_ALT1_HF) || defined (SYMBOLS_24X24_ALT2_HF)

define SYMBOLS_SELECTED

endif

if defined (SYMBOLS_24X24_VFP) || defined (SYMBOLS_24X24_OLD_VFP) || defined (SYMBOLS_24X24_ALT1_VFP) || defined (SYMBOLS_24X24_ALT2_VFP)

define SYMBOLS_SELECTED

endif

if defined (SYMBOLS_24X24_VP_F) || defined (SYMBOLS_24X24_OLD_VP_F) || defined (SYMBOLS_24X24_ALT1_VP_F) || defined (SYMBOLS_24X24_ALT2_VP_F)

define SYMBOLS_SELECTED

endif

if defined (SYMBOLS_30X32_HF) || defined (SYMBOLS_30X32_OLD_HF) || defined (SYMBOLS_30X32_ALT1_HF) || defined (SYMBOLS_30X32_ALT2_HF)

define SYMBOLS_SELECTED

endif

if defined (SYMBOLS_32X32_HF) || defined (SYMBOLS_32X32_OLD_HF) || defined (SYMBOLS_32X32_ALT1_HF) || defined (SYMBOLS_32X32_ALT2_HF)

define SYMBOLS_SELECTED

endif

if defined (SYMBOLS_32X39_HF)

define SYMBOLS_SELECTED

endif

/ fancy pinout requires graphic display and symbol set /

ifdef SW_SYMBOLS

/ graphic display /

ifndef LCD_GRAPHIC

#undef SW_SYMBOLS

endif

/ symbol set /

ifndef SYMBOLS_SELECTED

#undef SW_SYMBOLS

endif

endif

/ additional component symbols /

if defined (SW_UJT) || defined (UI_QUESTION_MARK) || defined (UI_ZENER_DIODE) || defined (UI_QUARTZ_CRYSTAL)

ifndef SYMBOLS_EXTRA

#define SYMBOLS_EXTRA

endif

endif

/ options which require component symbols / fancy pinout /

ifndef SW_SYMBOLS

/ question mark symbol /

ifdef UI_QUESTION_MARK

#undef UI_QUESTION_MARK

endif

/ Zener diode symbol /

ifdef UI_ZENER_DIODE

#undef UI_ZENER_DIODE

endif

/ quartz crystal symbol /

ifdef UI_QUARTZ_CRYSTAL

#undef UI_QUARTZ_CRYSTAL

endif

/ disabling text pinout /

ifdef UI_NO_TEXTPINOUT

#undef UI_NO_TEXTPINOUT

endif

/ test-output of component symbols /

ifdef SW_SYMBOL_TEST

#undef SW_SYMBOL_TEST

endif

endif

/ frequency counter /

if defined (HW_FREQ_COUNTER_BASIC) || defined (HW_FREQ_COUNTER_EXT)

define HW_FREQ_COUNTER

endif

/ ring tester /

if defined (HW_RING_TESTER)

/ requires pulse output /

if ! defined (RING_TESTER_PIN) && ! defined (RING_TESTER_PROBES)

#error <<< Select pulse output for ring tester! >>>

endif

/ prefer dedicated pin /

if defined (RING_TESTER_PIN) && defined (RING_TESTER_PROBES)

#undef RING_TESTER_PROBES

endif

endif

/ IR detector/decoder /

if defined (SW_IR_RECEIVER) && defined (HW_IR_RECEIVER)

error <<< Select either probes or dedicated IO pin for IR detector! >>>

endif

/ rounding for DS18B20 requires DS18B20 support /

ifdef UI_ROUND_DS18B20

ifndef SW_DS18B20

#undef UI_ROUND_DS18B20

endif

endif

/ Zener check during normal probing requires "unswitched" mode /

ifdef HW_PROBE_ZENER

ifndef ZENER_UNSWITCHED

#undef HW_PROBE_ZENER

endif

endif

/ read functions for display require bus with read support enabled /

ifdef LCD_READ

if defined (LCD_SPI) && ! defined (SPI_RW)

#undef LCD_READ

endif

if defined (LCD_I2C) && ! defined (I2C_RW)

#undef LCD_READ

endif

/ can't check parallel busses /

endif

/ display ID requires read functions for display /

ifdef SW_DISPLAY_ID

ifndef LCD_READ

#undef SW_DISPLAY_ID

endif

endif

/ output of display registers requires read functions for display and serial output /

ifdef SW_DISPLAY_REG

ifndef LCD_READ

#undef SW_DISPLAY_REG

endif

ifndef UI_SERIAL_COPY

#undef SW_DISPLAY_REG

endif

endif

/* ****

/ ProbePinout() /

if defined (SW_PWM_SIMPLE) || defined (SW_PWM_PLUS) || defined (SW_SQUAREWAVE) || defined (SW_SERVO)

ifndef FUNC_PROBE_PINOUT

#define FUNC_PROBE_PINOUT

endif

endif

if defined (SW_ESR_TOOL) || defined (SW_CONTINUITY_CHECK)

ifndef FUNC_PROBE_PINOUT

#define FUNC_PROBE_PINOUT

endif

endif

if defined (SW_MONITOR_R) || defined (SW_MONITOR_C) || defined (SW_MONITOR_L) || defined(SW_MONITOR_RCL) || defined(SW_MONITOR_RL)

ifndef FUNC_PROBE_PINOUT

#define FUNC_PROBE_PINOUT

endif

endif

if defined (HW_RING_TESTER) && defined (RING_TESTER_PROBES)

ifndef FUNC_PROBE_PINOUT

#define FUNC_PROBE_PINOUT

endif

endif

/ E6 norm values /

if defined (SW_C_E6_T) || defined (SW_L_E6_T)

define SW_E6

endif

/ E12 norm values /

if defined (SW_C_E12_T) || defined (SW_L_E12_T)

define SW_E12

endif

/ E24 norm values /

if defined (SW_R_E24_5_T) || defined (SW_R_E24_5_CC) || defined (SW_R_E24_1_T) || defined (SW_R_E24_1_CC)

define SW_E24

endif

/ E96 norm values /

if defined (SW_R_E96_T) || defined (SW_R_E96_CC) || defined (SW_R_E96_EIA96)

define SW_E96

endif

/ Show_ENormValues(), Display_EValue() /

if defined (SW_R_E24_5_T) || defined (SW_R_E24_1_T) || defined (SW_R_E96_T)

ifndef FUNC_EVALUE

#define FUNC_EVALUE

endif

ifndef SW_R_EXX

#define SW_R_EXX

endif

endif

if defined (SW_C_E6_T) || defined (SW_C_E12_T) || defined (SW_L_E6_T) || defined (SW_L_E12_T)

ifndef FUNC_EVALUE

#define FUNC_EVALUE

endif

endif

/ Show_ENormCodes(), Display_ColorCode() /

if defined (SW_R_E24_5_CC) || defined (SW_R_E24_1_CC) || defined (SW_R_E96_CC)

ifndef FUNC_COLORCODE

#define FUNC_COLORCODE

endif

ifndef SW_R_EXX

#define SW_R_EXX

endif

endif

/ Show_ENormEIA96(), Display_EIA96() /

if defined (SW_R_E96_EIA96)

ifndef FUNC_EIA96

#define FUNC_EIA96

endif

ifndef SW_R_EXX

#define SW_R_EXX

endif

endif

/ SmoothLongKeyPress() /

if defined (SW_PWM_PLUS) || defined (SW_SERVO) || defined (HW_EVENT_COUNTER) || defined (HW_LC_METER)

ifndef FUNC_SMOOTHLONGKEYPRESS

#define FUNC_SMOOTHLONGKEYPRESS

endif

endif

/ Display_FullValue() /

if defined (SW_SQUAREWAVE) || defined (SW_PWM_PLUS) || defined (HW_FREQ_COUNTER_EXT) || defined (SW_SERVO)

ifndef FUNC_DISPLAY_FULLVALUE

#define FUNC_DISPLAY_FULLVALUE

endif

endif

if defined (HW_EVENT_COUNTER) || defined (SW_DHTXX) || defined (LC_METER_SHOW_FREQ) || defined (HW_MAX6675)

ifndef FUNC_DISPLAY_FULLVALUE

#define FUNC_DISPLAY_FULLVALUE

endif

endif

if defined (FUNC_EVALUE) || defined (FUNC_COLORCODE) || defined (FUNC_EIA96)

ifndef FUNC_DISPLAY_FULLVALUE

#define FUNC_DISPLAY_FULLVALUE

endif

endif

/ Display_SignedFullValue() /

if defined (SW_DS18B20) || defined (SW_DHTXX) || defined (HW_MAX31855)

ifndef FUNC_DISPLAY_SIGNEDFULLVALUE

#define FUNC_DISPLAY_SIGNEDFULLVALUE

endif

endif

/ Display_HexByte() /

if defined (SW_IR_RECEIVER) || defined (HW_IR_RECEIVER) || defined (ONEWIRE_READ_ROM) || defined (SW_ONEWIRE_SCAN)

ifndef FUNC_DISPLAY_HEXBYTE

#define FUNC_DISPLAY_HEXBYTE

endif

endif

if defined (SW_FONT_TEST) || defined (SW_SYMBOL_TEST) || defined (SW_DISPLAY_REG)

ifndef FUNC_DISPLAY_HEXBYTE

#define FUNC_DISPLAY_HEXBYTE

endif

endif

/ Display_HexValue() /

if defined (SW_IR_TRANSMITTER) || defined (SW_DISPLAY_ID)

ifndef FUNC_DISPLAY_HEXVALUE

#define FUNC_DISPLAY_HEXVALUE

endif

endif

/ Celsius2Fahrenheit() /

ifdef UI_FAHRENHEIT

if defined (SW_DS18B20) || defined (SW_DHTXX) || defined (HW_MAX6675) || defined (HW_MAX31855)

#ifndef FUNC_CELSIUS2FAHRENHEIT
  #define FUNC_CELSIUS2FAHRENHEIT
#endif

endif

endif

/ variable Start_str /

if defined (SW_OPTO_COUPLER) || defined (SW_DS18B20) || defined (SW_ONEWIRE_SCAN) || defined (HW_EVENT_COUNTER)

ifndef VAR_START_STR

#define VAR_START_STR

endif

endif

if defined (HW_MAX6675) || defined (HW_MAX31855)

ifndef VAR_START_STR

#define VAR_START_STR

endif

endif

/* ****

ejouellette commented 2 years ago

config_328.h contents:

/* **** *

/ source management /

define CONFIG_328_H

/* ****

/*

/*

if 0

define LCD_HD44780 / display controller HD44780 /

define LCD_TEXT / character display /

define LCD_PAR_4 / 4 bit parallel interface /

/ control and data lines /

define LCD_PORT PORTD / port data register /

define LCD_DDR DDRD / port data direction register /

define LCD_DB_STD / use standard pins 0-3 for DB4-7 /

define LCD_DB4 PD0 / port pin used for DB4 /

define LCD_DB5 PD1 / port pin used for DB5 /

define LCD_DB6 PD2 / port pin used for DB6 /

define LCD_DB7 PD3 / port pin used for DB7 /

define LCD_RS PD4 / port pin used for RS /

define LCD_EN1 PD5 / port pin used for E /

/ display settings /

define LCD_CHAR_X 16 / characters per line /

define LCD_CHAR_Y 2 / number of lines /

/ HD44780 has an internal 5x7 font /

define FONT_HD44780_INT / International font (English) /

//#define FONT_HD44780_WIN1251 / Cyrillic font (European) /

endif

/*

if 0

define LCD_HD44780 / display controller HD44780 /

define LCD_TEXT / character display /

define LCD_PCF8574 / PCF8574 backpack /

define LCD_I2C_ADDR 0x3f / PCF8574's I2C address /

/ control and data lines /

define LCD_DB_STD / use standard pins 4-7 for DB4-7 /

define LCD_DB4 PCF8574_P4 / port pin used for DB4 /

define LCD_DB5 PCF8574_P5 / port pin used for DB5 /

define LCD_DB6 PCF8574_P6 / port pin used for DB6 /

define LCD_DB7 PCF8574_P7 / port pin used for DB7 /

define LCD_RS PCF8574_P0 / port pin used for RS /

define LCD_RW PCF8574_P1 / port pin used for RW /

define LCD_EN1 PCF8574_P2 / port pin used for E /

define LCD_LED PCF8574_P3 / port pin used for backlight /

/ display settings /

define LCD_CHAR_X 16 / characters per line /

define LCD_CHAR_Y 2 / number of lines /

//#define LCD_BACKLIGHT_LOW / backlight is low active / / HD44780 has an internal 5x7 font /

define FONT_HD44780_INT / International font (English) /

//#define FONT_HD44780_WIN1251 / Cyrillic font (European) / / I2C bus /

define I2C_BITBANG / bit-bang I2C /

define I2C_STANDARD_MODE / 100kHz bus speed /

define I2C_PORT PORTD / I2C port data register /

define I2C_DDR DDRD / I2C port data direction register /

define I2C_PIN PIND / I2C port input pins register /

define I2C_SDA PD0 / port pin used for SDA /

define I2C_SCL PD1 / port pin used for SCL /

endif

/*

if 0

define LCD_ILI9163 / display controller ILI9163 /

define LCD_GRAPHIC / graphic display /

define LCD_COLOR / color display /

define LCD_SPI / SPI interface /

/ control and data lines /

define LCD_PORT PORTD / port data register /

define LCD_DDR DDRD / port data direction register /

define LCD_RES PD4 / port pin used for /RESX (optional) /

define LCD_CS PD5 / port pin used for /CSX (optional) /

define LCD_DC PD3 / port pin used for D/CX /

define LCD_SCL PD2 / port pin used for SCL /

define LCD_SDA PD1 / port pin used for SDA/SDIO /

/ display settings /

define LCD_DOTS_X 128 / number of horizontal dots /

define LCD_DOTS_Y 128 / number of vertical dots /

define LCD_OFFSET_X 32 / x offset of 32 dots (160-128) /

//#define LCD_FLIP_X / enable horizontal flip /

define LCD_FLIP_Y / enable vertical flip /

define LCD_ROTATE / switch X and Y (rotate by 90°) /

define LCD_BGR / reverse red and blue color channels /

//#define LCD_LATE_ON / turn on LCD after clearing it / / font and symbols: horizonally aligned & flipped /

define FONT_8X8_HF / 8x8 font /

//#define FONT_10X16_HF / 10x16 font / //#define FONT_8X8_ISO8859_2_HF / 8x8 Central European font / //#define FONT_8X12T_ISO8859_2_HF / thin 8x12 Central European font / //#define FONT_8X16_ISO8859_2_HF / 8x16 Central European font / //#define FONT_10X16_ISO8859_2_HF / 10x16 Central European font / //#define FONT_8X16_WIN1251_HF / 8x16 cyrillic font / //#define FONT_8X16ALT_WIN1251_HF / 8x16 alternative cyrillic font /

define SYMBOLS_30X32_HF / 30x32 symbols /

//#define SYMBOLS_30X32_ALT1_HF / 30x32 alternative symbols #1 / //#define SYMBOLS_30X32_ALT2_HF / 30x32 alternative symbols #2 / //#define SYMBOLS_32X32_HF / 32x32 symbols / //#define SYMBOLS_32X32_ALT1_HF / 32x32 alternative symbols #1 / //#define SYMBOLS_32X32_ALT2_HF / 32x32 alternative symbols #2 / / SPI bus /

define SPI_BITBANG / bit-bang SPI /

define SPI_PORT LCD_PORT / SPI port data register /

define SPI_DDR LCD_DDR / SPI port data direction register /

define SPI_SCK LCD_SCL / port pin used for SCK /

define SPI_MOSI LCD_SDA / port pin used for MOSI /

endif

/*

if 0

define LCD_ILI9341 / display controller ILI9341/ILI9342 /

define LCD_GRAPHIC / graphic display /

define LCD_COLOR / color display /

define LCD_SPI / SPI interface /

/ control and data lines /

define LCD_PORT PORTD / port data register /

define LCD_DDR DDRD / port data direction register /

define LCD_RES PD4 / port pin used for /RES (optional) /

define LCD_CS PD5 / port pin used for /CS (optional) /

define LCD_DC PD3 / port pin used for D/C /

define LCD_SCK PD2 / port pin used for SCK /

define LCD_SDI PD1 / port pin used for SDI (data input) /

//#define LCD_SDO PD0 / port pin used for SDO (data output) / / display settings /

define LCD_DOTS_X 320 / number of horizontal dots /

define LCD_DOTS_Y 240 / number of vertical dots /

//#define LCD_FLIP_X / enable horizontal flip / //#define LCD_FLIP_Y / enable vertical flip / //#define LCD_ROTATE / switch X and Y (rotate by 90°) / //#define LCD_BGR / reverse red and blue color channels / //#define LCD_EXT_CMD_OFF / extended commands disabled / / font and symbols: horizontally aligned & flipped /

define FONT_16X26_HF / 16x26 font /

//#define FONT_16X26_ISO8859_2_HF / 16x26 Central European font / //#define FONT_16X26_WIN1251_HF / 16x26 cyrillic font / //#define SYMBOLS_32X32_HF / 32x32 symbols / //#define SYMBOLS_32X32_ALT1_HF / 32x32 alternative symbols #1 / //#define SYMBOLS_32X32_ALT2_HF / 32x32 alternative symbols #2 /

define SYMBOLS_32X39_HF / 32x39 symbols /

/ SPI bus /

define SPI_BITBANG / bit-bang SPI /

define SPI_PORT LCD_PORT / SPI port data register /

define SPI_DDR LCD_DDR / SPI port data direction register /

define SPI_SCK LCD_SCK / port pin used for SCK /

define SPI_MOSI LCD_SDI / port pin used for MOSI /

endif

/*

if 0

define LCD_PCD8544 / display controller PCD8544 /

define LCD_GRAPHIC / graphic display /

define LCD_SPI / SPI interface /

/ control and data lines /

define LCD_PORT PORTD / port data register /

define LCD_DDR DDRD / port data direction register /

define LCD_RES PD4 / port pin used for /RES (optional) /

define LCD_SCE PD5 / port pin used for /SCE (optional) /

define LCD_DC PD3 / port pin used for D/C /

define LCD_SCLK PD2 / port pin used for SCLK /

define LCD_SDIN PD1 / port pin used for SDIN (data input) /

/ display settings /

define LCD_DOTS_X 84 / number of horizontal dots /

define LCD_DOTS_Y 48 / number of vertical dots /

define LCD_CONTRAST 66 / default contrast (1-127) /

/ font and symbols: vertically aligned & flipped /

define FONT_6X8_VF / 6x8 font /

//#define FONT_6X8_ISO8859_2_VF / 6x8 Central Euopean font /

define SYMBOLS_24X24_VFP / 24x24 symbols /

//#define SYMBOLS_24X24_ALT1_VFP / 24x24 alternative symbols #1 / //#define SYMBOLS_24X24_ALT2_VFP / 24x24 alternative symbols #2 / //#define LCD_ROT180 / rotate output by 180° (not supported yet) / / font and symbols: vertically aligned, bank-wise grouping, hor. flipped / //#define FONT_6X8_V_F / 6x8 font / //#define FONT_6X8_ISO8859_2_V_F / 6x8 Central Euopean font / //#define SYMBOLS_24X24_VP_F / 24x24 symbols / //#define SYMBOLS_24X24_ALT1_VP_F / 24x24 alternative symbols #1 / //#define SYMBOLS_24X24_ALT2_VP_F / 24x24 alternative symbols #2 / / SPI bus /

define SPI_BITBANG / bit-bang SPI /

define SPI_PORT LCD_PORT / SPI port data register /

define SPI_DDR LCD_DDR / SPI port data direction register /

define SPI_SCK LCD_SCLK / port pin used for SCK /

define SPI_MOSI LCD_SDIN / port pin used for MOSI /

endif

/*

if 0

define LCD_PCF8814 / display controller PCF8814 /

define LCD_GRAPHIC / graphic display /

define LCD_SPI / SPI interface /

/ control and data lines /

define LCD_PORT PORTD / port data register /

define LCD_DDR DDRD / port data direction register /

define LCD_RESET PD4 / port pin used for /RES /

define LCD_CS PD5 / port pin used for /CS (optional) /

define LCD_SCLK PD2 / port pin used for SCLK /

define LCD_SDIN PD1 / port pin used for SDIN (data input) /

/ display settings /

define LCD_DOTS_X 96 / number of horizontal dots /

define LCD_DOTS_Y 65 / number of vertical dots /

//#define LCD_FLIP_Y / enable vertical flip /

define LCD_CONTRAST 5 / default contrast (0-255) /

/ font and symbols: vertically aligned & flipped, page-wise grouping /

define FONT_6X8_VF / 6x8 font /

//#define FONT_6X8_ISO8859_2_VF / 6x8 Central European font /

define SYMBOLS_24X24_VFP / 24x24 symbols /

//#define SYMBOLS_24X24_ALT1_VFP / 24x24 alternative symbols #1 / //#define SYMBOLS_24X24_ALT2_VFP / 24x24 alternative symbols #2 / / SPI bus /

define SPI_BITBANG / bit-bang SPI /

define SPI_9 / support 9 bit frames /

define SPI_PORT LCD_PORT / SPI port data register /

define SPI_DDR LCD_DDR / SPI port data direction register /

define SPI_SCK LCD_SCLK / port pin used for SCK /

define SPI_MOSI LCD_SDIN / port pin used for MOSI /

endif

/*

if 0

define LCD_SH1106 / display controller SH1106 /

define LCD_GRAPHIC / graphic display /

define LCD_SPI / SPI interface /

/ control and data lines /

define LCD_PORT PORTD / port data register /

define LCD_DDR DDRD / port data direction register /

define LCD_RESET PD4 / port pin used for /RES (optional) /

define LCD_CS PD5 / port pin used for /CS (optional) /

define LCD_A0 PD3 / port pin used for A0 /

define LCD_SCL PD2 / port pin used for SCL /

define LCD_SI PD1 / port pin used for SI (data input) /

/ display settings /

define LCD_DOTS_X 128 / number of horizontal dots /

define LCD_DOTS_Y 64 / number of vertical dots /

define LCD_OFFSET_X 2 / enable x offset of 2 or 4 dots /

define LCD_FLIP_X / enable horizontal flip /

define LCD_FLIP_Y / enable vertical flip /

define LCD_CONTRAST 127 / default contrast (0-255) /

/ font and symbols: vertically aligned & flipped, bank-wise grouping / //#define FONT_6X8_VF / 6x8 font /

define FONT_8X8_VF / 8x8 font /

//#define FONT_8X16_VFP / 8x16 font / //#define FONT_6X8_ISO8859_2_VF / 6x8 Central European font / //#define FONT_8X8_ISO8859_2_VF / 8x8 Central European font / //#define FONT_8X12T_ISO8859_2_VFP / thin 8x12 Central European font / //#define FONT_8X16_ISO8859_2_VFP / 8x16 Central European font / //#define FONT_8X8_WIN1251_VF / 8x8 cyrillic font / //#define FONT_8X8ALT_WIN1251_VF / 8x8 alternative cyrillic font / //#define FONT_8X8T_WIN1251_VF / thin 8x8 cyrillic font / //#define FONT_8X12T_WIN1251_VFP / thin 8x12 cyrillic font / //#define FONT_8X16_WIN1251_VFP / 8x16 cyrillic font /

define SYMBOLS_24X24_VFP / 24x24 symbols /

//#define SYMBOLS_24X24_ALT1_VFP / 24x24 alternative symbols #1 / //#define SYMBOLS_24X24_ALT2_VFP / 24x24 alternative symbols #2 / / SPI bus /

define SPI_BITBANG / bit-bang SPI /

define SPI_PORT LCD_PORT / SPI port data register /

define SPI_DDR LCD_DDR / SPI port data direction register /

define SPI_SCK LCD_SCL / port pin used for SCK /

define SPI_MOSI LCD_SI / port pin used for MOSI /

endif

/*

if 0

define LCD_SH1106 / display controller SH1106 /

define LCD_GRAPHIC / graphic display /

define LCD_SPI / SPI interface /

/ control and data lines /

define LCD_PORT PORTD / port data register /

define LCD_DDR DDRD / port data direction register /

define LCD_RESET PD4 / port pin used for /RES (optional) /

define LCD_CS PD5 / port pin used for /CS (optional) /

define LCD_SCL PD2 / port pin used for SCL /

define LCD_SI PD1 / port pin used for SI (data input) /

/ display settings /

define LCD_DOTS_X 128 / number of horizontal dots /

define LCD_DOTS_Y 64 / number of vertical dots /

define LCD_OFFSET_X 2 / enable x offset of 2 or 4 dots /

define LCD_FLIP_X / enable horizontal flip /

define LCD_FLIP_Y / enable vertical flip /

define LCD_CONTRAST 127 / default contrast (0-255) /

/ font and symbols: vertically aligned & flipped, bank-wise grouping /

define FONT_8X8_VF / 8x8 font /

define SYMBOLS_24X24_VFP / 24x24 symbols /

//#define SYMBOLS_24X24_ALT1_VFP / 24x24 alternative symbols #1 / //#define SYMBOLS_24X24_ALT2_VFP / 24x24 alternative symbols #2 / / SPI bus /

define SPI_BITBANG / bit-bang SPI /

define SPI_9 / support 9 bit frames /

define SPI_PORT LCD_PORT / SPI port data register /

define SPI_DDR LCD_DDR / SPI port data direction register /

define SPI_SCK LCD_SCL / port pin used for SCK /

define SPI_MOSI LCD_SI / port pin used for MOSI /

endif

/*

if 0

define LCD_SH1106 / display controller SH1106 /

define LCD_GRAPHIC / graphic display /

define LCD_I2C / I2C interface /

define LCD_I2C_ADDR 0x3c / SH1106's I2C address /

/ control lines /

define LCD_PORT PORTD / port data register /

define LCD_DDR DDRD / port data direction register /

//#define LCD_RESET PD4 / port pin used for /RES (optional) / / display settings /

define LCD_DOTS_X 128 / number of horizontal dots /

define LCD_DOTS_Y 64 / number of vertical dots /

define LCD_OFFSET_X 2 / enable x offset of 2 or 4 dots /

define LCD_FLIP_X / enable horizontal flip /

define LCD_FLIP_Y / enable vertical flip /

define LCD_CONTRAST 127 / default contrast (0-255) /

/ font and symbols: vertically aligned & flipped, bank-wise grouping /

define FONT_8X8_VF / 8x8 font /

define SYMBOLS_24X24_VFP / 24x24 symbols /

//#define SYMBOLS_24X24_ALT1_VFP / 24x24 alternative symbols #1 / //#define SYMBOLS_24X24_ALT2_VFP / 24x24 alternative symbols #2 / / I2C bus /

define I2C_BITBANG / bit-bang I2C /

define I2C_FAST_MODE / 400kHz bus speed /

define I2C_PORT PORTD / I2C port data register /

define I2C_DDR DDRD / I2C port data direction register /

define I2C_PIN PIND / I2C port input pins register /

define I2C_SDA PD0 / port pin used for SDA /

define I2C_SCL PD1 / port pin used for SCL /

endif

/*

if 0

define LCD_SSD1306 / display controller SSD1306 /

define LCD_GRAPHIC / graphic display /

define LCD_SPI / SPI interface /

/ control and data lines /

define LCD_PORT PORTD / port data register /

define LCD_DDR DDRD / port data direction register /

define LCD_RESET PD4 / port pin used for /RES (optional) /

define LCD_CS PD5 / port pin used for /CS (optional) /

define LCD_DC PD3 / port pin used for D/C /

define LCD_SCLK PD2 / port pin used for SCLK /

define LCD_SDIN PD1 / port pin used for SDIN (data input) /

/ display settings /

define LCD_DOTS_X 128 / number of horizontal dots /

define LCD_DOTS_Y 64 / number of vertical dots /

define LCD_FLIP_X / enable horizontal flip /

define LCD_FLIP_Y / enable vertical flip /

define LCD_CONTRAST 127 / default contrast (0-255) /

/ font and symbols: vertically aligned & flipped, bank-wise grouping / //#define FONT_6X8_VF / 6x8 font /

define FONT_8X8_VF / 8x8 font /

//#define FONT_8X16_VFP / 8x16 font / //#define FONT_6X8_ISO8859_2_VF / 6x8 Central European font / //#define FONT_8X8_ISO8859_2_VF / 8x8 Central European font / //#define FONT_8X12T_ISO8859_2_VFP / thin 8x12 Central European font / //#define FONT_8X16_ISO8859_2_VFP / 8x16 Central European font / //#define FONT_8X8_WIN1251_VF / 8x8 cyrillic font / //#define FONT_8X8ALT_WIN1251_VF / 8x8 alternative cyrillic font / //#define FONT_8X8T_WIN1251_VF / thin 8x8 cyrillic font / //#define FONT_8X12T_WIN1251_VFP / thin 8x12 cyrillic font / //#define FONT_8X16_WIN1251_VFP / 8x16 cyrillic font /

define SYMBOLS_24X24_VFP / 24x24 symbols /

//#define SYMBOLS_24X24_ALT1_VFP / 24x24 alternative symbols #1 / //#define SYMBOLS_24X24_ALT2_VFP / 24x24 alternative symbols #2 / / SPI bus /

define SPI_BITBANG / bit-bang SPI /

define SPI_PORT LCD_PORT / SPI port data register /

define SPI_DDR LCD_DDR / SPI port data direction register /

define SPI_SCK LCD_SCLK / port pin used for SCK /

define SPI_MOSI LCD_SDIN / port pin used for MOSI /

endif

/*

if 0

define LCD_SSD1306 / display controller SSD1306 /

define LCD_GRAPHIC / graphic display /

define LCD_SPI / SPI interface /

/ control and data lines /

define LCD_PORT PORTD / port data register /

define LCD_DDR DDRD / port data direction register /

define LCD_RESET PD4 / port pin used for /RES (optional) /

define LCD_CS PD5 / port pin used for /CS (optional) /

define LCD_SCLK PD2 / port pin used for SCLK /

define LCD_SDIN PD1 / port pin used for SDIN (data input) /

/ display settings /

define LCD_DOTS_X 128 / number of horizontal dots /

define LCD_DOTS_Y 64 / number of vertical dots /

define LCD_FLIP_X / enable horizontal flip /

define LCD_FLIP_Y / enable vertical flip /

define LCD_CONTRAST 127 / default contrast (0-255) /

/ font and symbols: vertically aligned & flipped, bank-wise grouping /

define FONT_8X8_VF / 8x8 font /

define SYMBOLS_24X24_VFP / 24x24 symbols /

//#define SYMBOLS_24X24_ALT1_VFP / 24x24 alternative symbols #1 / //#define SYMBOLS_24X24_ALT2_VFP / 24x24 alternative symbols #2 / / SPI bus /

define SPI_BITBANG / bit-bang SPI /

define SPI_9 / support 9 bit frames /

define SPI_PORT LCD_PORT / SPI port data register /

define SPI_DDR LCD_DDR / SPI port data direction register /

define SPI_SCK LCD_SCLK / port pin used for SCK /

define SPI_MOSI LCD_SDIN / port pin used for MOSI /

endif

/*

if 0

define LCD_SSD1306 / display controller SSD1306 /

define LCD_GRAPHIC / graphic display /

define LCD_I2C / I2C interface /

define LCD_I2C_ADDR 0x3c / SSD1306's I2C address /

/ control lines /

define LCD_PORT PORTD / port data register /

define LCD_DDR DDRD / port data direction register /

define LCD_RESET PD4 / port pin used for /RES (optional) /

/ display settings /

define LCD_DOTS_X 128 / number of horizontal dots /

define LCD_DOTS_Y 64 / number of vertical dots /

define LCD_FLIP_X / enable horizontal flip /

define LCD_FLIP_Y / enable vertical flip /

define LCD_CONTRAST 127 / default contrast (0-255) /

/ font and symbols: vertically aligned & flipped, bank-wise grouping /

define FONT_8X8_VF / 8x8 font /

define SYMBOLS_24X24_VFP / 24x24 symbols /

//#define SYMBOLS_24X24_ALT1_VFP / 24x24 alternative symbols #1 / //#define SYMBOLS_24X24_ALT2_VFP / 24x24 alternative symbols #2 / / I2C bus /

define I2C_BITBANG / bit-bang I2C /

define I2C_FAST_MODE / 400kHz bus speed /

define I2C_PORT PORTD / I2C port data register /

define I2C_DDR DDRD / I2C port data direction register /

define I2C_PIN PIND / I2C port input pins register /

define I2C_SDA PD0 / port pin used for SDA /

define I2C_SCL PD1 / port pin used for SCL /

endif

/*

if 0

define LCD_ST7036 / display controller ST7036 /

define LCD_TEXT / character display /

define LCD_PAR_4 / 4 bit parallel interface /

/ control and data lines /

define LCD_PORT PORTD / port data register /

define LCD_DDR DDRD / port data direction register /

//#define LCD_DB_STD / use standard pins 0-3 for DB4-7 /

define LCD_DB4 PD0 / port pin used for DB4 /

define LCD_DB5 PD1 / port pin used for DB5 /

define LCD_DB6 PD2 / port pin used for DB6 /

define LCD_DB7 PD3 / port pin used for DB7 /

define LCD_RS PD4 / port pin used for RS /

define LCD_EN PD5 / port pin used for E /

//#define LCD_RW ??? / port pin used for R/W (optional) / //#define LCD_RESET ??? / port pin used for XRESET (optional) / / display settings /

define LCD_CHAR_X 16 / characters per line /

define LCD_CHAR_Y 3 / number of lines /

define LCD_EXTENDED_CMD / extended instruction set (EXT pin high) /

define LCD_CONTRAST 32 / default contrast (0-63) /

/ ST7036 has internal 5x8 font /

define FONT_ST7036 / 5x8 font /

endif

/*

if 0

define LCD_ST7036 / display controller ST7036 /

define LCD_TEXT / character display /

define LCD_SPI / SPI interface /

/ control and data lines /

define LCD_PORT PORTD / port data register /

define LCD_DDR DDRD / port data direction register /

define LCD_RESET PD4 / port pin used for XRESET (optional) /

define LCD_CS PD5 / port pin used for CSB (optional) /

define LCD_RS PD3 / port pin used for RS /

define LCD_SCL PD2 / port pin used for SCL /

define LCD_SI PD1 / port pin used for SI (data input) /

/ display settings /

define LCD_CHAR_X 16 / characters per line /

define LCD_CHAR_Y 3 / number of lines /

define LCD_EXTENDED_CMD / extended instruction set (EXT pin high) /

define LCD_CONTRAST 32 / default contrast (0-63) /

/ ST7036 has internal 5x8 font /

define FONT_ST7036 / 5x8 font /

/ SPI bus /

define SPI_BITBANG / bit-bang SPI /

define SPI_PORT LCD_PORT / SPI port data register /

define SPI_DDR LCD_DDR / SPI port data direction register /

define SPI_SCK LCD_SCL / port pin used for SCK /

define SPI_MOSI LCD_SI / port pin used for MOSI /

endif

/*

if 1

define LCD_ST7565R / display controller ST7565R /

define LCD_GRAPHIC / graphic display /

define LCD_SPI / SPI interface /

/ control and data lines /

define LCD_PORT PORTD / port data register /

define LCD_DDR DDRD / port data direction register /

define LCD_RESET PD2 / port pin used for /RES (optional) /

define LCD_CS PD5 / port pin used for /CS1 (optional) /

define LCD_A0 PD1 / port pin used for A0 /

define LCD_SCL PD3 / port pin used for SCL /

define LCD_SI PD4 / port pin used for SI (data input) /

/ display settings /

define LCD_DOTS_X 128 / number of horizontal dots /

define LCD_DOTS_Y 64 / number of vertical dots /

//#define LCD_OFFSET_X / enable x offset of 4 dots / //#define LCD_FLIP_X / enable horizontal flip /

define LCD_FLIP_Y / enable vertical flip /

define LCD_START_Y 0 / start line (0-63) /

define LCD_CONTRAST 25 / default contrast 22 (0-63) /

/ font and symbols: vertically aligned & flipped, bank-wise grouping / //#define FONT_6X8_VF / 6x8 font /

define FONT_8X8_VF / 8x8 font /

//#define FONT_8X16_VFP / 8x16 font / //#define FONT_6X8_ISO8859_2_VF / 6x8 Central European font / //#define FONT_8X8_ISO8859_2_VF / 8x8 Central European font / //#define FONT_8X12T_ISO8859_2_VFP / thin 8x12 Central European font / //#define FONT_8X16_ISO8859_2_VFP / 8x16 Central European font / //#define FONT_8X8_WIN1251_VF / 8x8 cyrillic font / //#define FONT_8X8ALT_WIN1251_VF / 8x8 alternative cyrillic font / //#define FONT_8X8T_WIN1251_VF / thin 8x8 cyrillic font / //#define FONT_8X12T_WIN1251_VFP / thin 8x12 cyrillic font / //#define FONT_8X16_WIN1251_VFP / 8x16 cyrillic font /

define SYMBOLS_24X24_VFP / 24x24 symbols /

//#define SYMBOLS_24X24_ALT1_VFP / 24x24 alternative symbols #1 / //#define SYMBOLS_24X24_ALT2_VFP / 24x24 alternative symbols #2 / / SPI bus /

define SPI_BITBANG / bit-bang SPI /

define SPI_PORT LCD_PORT / SPI port data register /

define SPI_DDR LCD_DDR / SPI port data direction register /

define SPI_SCK LCD_SCL / port pin used for SCK /

define SPI_MOSI LCD_SI / port pin used for MOSI /

endif

/*

if 0

define LCD_ST7735 / display controller ST7735 /

define LCD_GRAPHIC / graphic display /

define LCD_COLOR / color display /

define LCD_SPI / SPI interface /

/ control and data lines /

define LCD_PORT PORTD / port data register /

define LCD_DDR DDRD / port data direction register /

define LCD_RES PD4 / port pin used for /RESX (optional) /

define LCD_CS PD5 / port pin used for /CSX (optional) /

define LCD_DC PD3 / port pin used for D/CX /

define LCD_SCL PD2 / port pin used for SCL /

define LCD_SDA PD1 / port pin used for SDA /

/ display settings /

define LCD_DOTS_X 128 / number of horizontal dots /

define LCD_DOTS_Y 160 / number of vertical dots /

//#define LCD_OFFSET_X 4 / enable x offset of 2 or 4 dots / //#define LCD_OFFSET_Y 2 / enable y offset of 1 or 2 dots / //#define LCD_FLIP_X / enable horizontal flip /

define LCD_FLIP_Y / enable vertical flip /

define LCD_ROTATE / switch X and Y (rotate by 90°) /

//#define LCD_BGR / reverse red and blue color channels / //#define LCD_LATE_ON / turn on LCD after clearing it / / font and symbols: horizontally aligned & flipped /

define FONT_10X16_HF / 10x16 font /

//#define FONT_6X8_ISO8859_2_HF / 6x8 Central European font / //#define FONT_8X8_ISO8859_2_HF / 8x8 Central European font / //#define FONT_8X12T_ISO8859_2_HF / thin 8x12 Central European font / //#define FONT_8X16_ISO8859_2_HF / 8x16 Central European font / //#define FONT_10X16_ISO8859_2_HF / 10x16 Central European font / //#define FONT_8X16_WIN1251_HF / 8x16 cyrillic font / //#define FONT_8X16ALT_WIN1251_HF / 8x16 alternative cyrillic font /

define SYMBOLS_30X32_HF / 30x32 symbols /

//#define SYMBOLS_30X32_ALT1_HF / 30x32 alternative symbols #1 / //#define SYMBOLS_30X32_ALT2_HF / 30x32 alternative symbols #2 / //#define SYMBOLS_32X32_HF / 32x32 symbols / //#define SYMBOLS_32X32_ALT1_HF / 32x32 alternative symbols #1 / //#define SYMBOLS_32X32_ALT2_HF / 32x32 alternative symbols #2 / / SPI bus /

define SPI_BITBANG / bit-bang SPI /

define SPI_PORT LCD_PORT / SPI port data register /

define SPI_DDR LCD_DDR / SPI port data direction register /

define SPI_SCK LCD_SCL / port pin used for SCK /

define SPI_MOSI LCD_SDA / port pin used for MOSI /

endif

/*

if 0

define LCD_ST7920 / display controller ST7920 /

define LCD_GRAPHIC / graphic display /

define LCD_SPI / SPI interface /

/ control and data lines /

define LCD_PORT PORTD / port data register /

define LCD_DDR DDRD / port data direction register /

define LCD_RESET PD4 / port pin used for /RESET (optional) /

define LCD_CS PD5 / port pin used for CS (optional) /

define LCD_SCLK PD2 / port pin used for SCLK /

define LCD_SID PD1 / port pin used for SID (data input) /

/ display settings /

define LCD_DOTS_X 128 / number of horizontal dots /

define LCD_DOTS_Y 64 / number of vertical dots /

/ font and symbols: horizonally aligned /

define FONT_8X8_H / 8x8 font /

//#define FONT_8X8_ISO8859_2_H / 8x8 Central European font /

define SYMBOLS_24X24_H / 24x24 symbols /

//#define SYMBOLS_24X24_ALT1_H / alternative 24x24 symbols #1 / //#define SYMBOLS_24X24_ALT2_H / alternative 24x24 symbols #2 / //#define LCD_ROT180 / rotate output by 180° / / font and symbols: horizonally aligned & flipped / //#define FONT_8X8_HF / 8x8 font / //#define FONT_8X8_ISO8859_2_HF / 8x8 Central European font / //#define SYMBOLS_24X24_HF / 24x24 symbols / //#define SYMBOLS_24X24_ALT1_HF / alternative 24x24 symbols #1 / //#define SYMBOLS_24X24_ALT2_HF / alternative 24x24 symbols #2 / / SPI bus /

define SPI_BITBANG / bit-bang SPI /

define SPI_PORT LCD_PORT / SPI port data register /

define SPI_DDR LCD_DDR / SPI port data direction register /

define SPI_SCK LCD_SCLK / port pin used for SCK /

define SPI_MOSI LCD_SID / port pin used for MOSI /

endif

/*

if 0

define LCD_ST7920 / display controller ST7920 /

define LCD_GRAPHIC / graphic display /

define LCD_PAR_4 / 4 bit parallel interface /

/ control and data lines /

define LCD_PORT PORTD / port data register /

define LCD_DDR DDRD / port data direction register /

define LCD_DB_STD / use standard pins 0-3 for DB4-7 /

define LCD_DB4 PD0 / port pin used for DB4 /

define LCD_DB5 PD1 / port pin used for DB5 /

define LCD_DB6 PD2 / port pin used for DB6 /

define LCD_DB7 PD3 / port pin used for DB7 /

define LCD_RS PD4 / port pin used for RS /

define LCD_EN PD5 / port pin used for E /

//#define LCD_RW PD? / port pin used for RW (optional) / //#define LCD_RESET PD? / port pin used for /RESET (optional) / / display settings /

define LCD_DOTS_X 128 / number of horizontal dots /

define LCD_DOTS_Y 64 / number of vertical dots /

/ font and symbols: horizonally aligned /

define FONT_8X8_H / 8x8 font /

define SYMBOLS_24X24_H / 24x24 symbols /

//#define SYMBOLS_24X24_ALT1_H / alternative 24x24 symbols #1 / //#define SYMBOLS_24X24_ALT2_H / alternative 24x24 symbols #2 / //#define LCD_ROT180 / rotate output by 180° / / font and symbols: horizonally aligned & flipped / //#define FONT_8X8_HF / 8x8 font / //#define SYMBOLS_24X24_HF / 24x24 symbols / //#define SYMBOLS_24X24_ALT1_HF / alternative 24x24 symbols #1 / //#define SYMBOLS_24X24_ALT2_HF / alternative 24x24 symbols #2 /

endif

/*

if 0

define LCD_STE2007 / display controller STE2007 /

define LCD_GRAPHIC / graphic display /

define LCD_SPI / SPI interface /

/ control and data lines /

define LCD_PORT PORTD / port data register /

define LCD_DDR DDRD / port data direction register /

define LCD_RESET PD4 / port pin used for /RES (optional) /

define LCD_CS PD5 / port pin used for /CS (optional) /

define LCD_SCLK PD2 / port pin used for SCLK /

define LCD_SDIN PD1 / port pin used for SDIN (data input) /

/ display settings /

define LCD_DOTS_X 96 / number of horizontal dots /

define LCD_DOTS_Y 68 / number of vertical dots /

//#define LCD_FLIP_X / enable horizontal flip / //#define LCD_FLIP_Y / enable vertical flip /

define LCD_CONTRAST 16 / default contrast (0-31) /

/ font and symbols: vertically aligned & flipped /

define FONT_6X8_VF / 6x8 font /

//#define FONT_6X8_ISO8859_2_VF / 6x8 Central European font /

define SYMBOLS_24X24_VFP / 24x24 symbols /

//#define SYMBOLS_24X24_ALT1_VFP / 24x24 alternative symbols #1 / //#define SYMBOLS_24X24_ALT2_VFP / 24x24 alternative symbols #2 / / SPI bus /

define SPI_BITBANG / bit-bang SPI /

define SPI_9 / support 9 bit frames /

define SPI_PORT LCD_PORT / SPI port data register /

define SPI_DDR LCD_DDR / SPI port data direction register /

define SPI_SCK LCD_SCLK / port pin used for SCK /

define SPI_MOSI LCD_SDIN / port pin used for MOSI /

endif

/*

if 0

define LCD_VT100 / pseudo display VT100 /

define LCD_TEXT / character display /

define LCD_COLOR / color display /

define LCD_CHAR_X 40 / characters per line /

define LCD_CHAR_Y 24 / number of lines /

define SERIAL_BITBANG / bit-bang serial /

//#define SERIAL_HARDWARE / hardware serial /

endif

/*

if !defined(LCD_TEXT) && !defined(LCD_GRAPHIC)

error <<< No LCD module specified! >>>

endif

/* ****

/*

define ADC_PORT PORTC / port data register /

define ADC_DDR DDRC / port data direction register /

define ADC_PIN PINC / port input pins register /

define TP1 PC0 / test pin / probe #1 /

define TP2 PC1 / test pin / probe #2 /

define TP3 PC2 / test pin / probe #3 /

define TP_ZENER PC3 / test pin for for Zener check (10:1 voltage divider) /

define TP_REF PC4 / test pin for 2.5V reference and relay /

define TP_BAT PC5 / test pin for battery (4:1 voltage divider) /

define TP_LOGIC PC3 / test pin for Logic Probe (4:1 voltage divider) /

/*

define R_PORT PORTB / port data register /

define R_DDR DDRB / port data direction register /

define R_RL_1 PB0 / Rl (680R) for test pin #1 /

define R_RH_1 PB1 / Rh (470k) for test pin #1 /

define R_RL_2 PB2 / Rl (680R) for test pin #2 /

define R_RH_2 PB3 / Rh (470k) for test pin #2 /

define R_RL_3 PB4 / Rl (680R) for test pin #3 /

define R_RH_3 PB5 / Rh (470k) for test pin #3 /

/*

define SIGNAL_PORT PORTB / port data register /

define SIGNAL_DDR DDRB / port data direction register /

define SIGNAL_OUT PB2 / MCU's OC1B pin /

/*

define POWER_PORT PORTD / port data register /

define POWER_DDR DDRD / port data direction register /

define POWER_CTRL PD6 / control pin (1: on / 0: off) /

/*

define BUTTON_PORT PORTD / port data register /

define BUTTON_DDR DDRD / port data direction register /

define BUTTON_PIN PIND / port input pins register /

define TEST_BUTTON PD7 / test/start push button (low active) /

/*

define ENCODER_PORT PORTD / port data register /

define ENCODER_DDR DDRD / port data direction register /

define ENCODER_PIN PIND / port input pins register /

define ENCODER_A PD3 / rotary encoder A signal /

define ENCODER_B PD2 / rotary encoder B signal /

/*

define KEY_PORT PORTD / port data register /

define KEY_DDR DDRD / port data direction register /

define KEY_PIN PIND / port input pins register /

define KEY_INC PD2 / increase push button (low active) /

define KEY_DEC PD3 / decrease push button (low active) /

/*

define COUNTER_PORT PORTD / port data register /

define COUNTER_DDR DDRD / port data direction register /

define COUNTER_IN PD4 / signal input T0 /

/*

define RINGTESTER_PORT PORTD / port data register /

define RINGTESTER_DDR DDRD / port data direction register /

define RINGTESTER_OUT PD5 / pulse output /

/*

define IR_PORT PORTD / port data register /

define IR_DDR DDRD / port data direction register /

define IR_PIN PIND / port input pins register /

define IR_DATA PD5 / data signal /

/*

/ for bit-bang and hardware SPI /

ifndef SPI_PORT

define SPI_PORT PORTB / port data register /

define SPI_DDR DDRB / port data direction register /

define SPI_PIN PINB / port input pins register /

define SPI_SCK PB5 / pin for SCK /

define SPI_MOSI PB3 / pin for MOSI /

define SPI_MISO PB4 / pin for MISO /

define SPI_SS PB2 / pin for /SS /

endif

/*

/ for bit-bang I2C /

ifndef I2C_PORT

define I2C_PORT PORTC / port data register /

define I2C_DDR DDRC / port data direction register /

define I2C_PIN PINC / port input pins register /

define I2C_SDA PC4 / pin for SDA /

define I2C_SCL PC5 / pin for SCL /

endif

/*

/ for hardware RS232 /

define SERIAL_USART 0 / use USART0 /

/ for bit-bang RS232 /

define SERIAL_PORT PORTD / port data register /

define SERIAL_DDR DDRD / port data direction register /

define SERIAL_PIN PIND / port input pins register /

define SERIAL_TX PD1 / pin for Tx (transmit) /

define SERIAL_RX PD0 / pin for Rx (receive) /

define SERIAL_PCINT 16 / PCINT# for Rx pin /

/*

define ONEWIRE_PORT PORTD / port data register /

define ONEWIRE_DDR DDRD / port data direction register /

define ONEWIRE_PIN PIND / port input pins register /

define ONEWIRE_DQ PD5 / DQ (data line) /

/*

define BUZZER_PORT PORTD / port data register /

define BUZZER_DDR DDRD / port data direction register /

define BUZZER_CTRL PD5 / control pin (low: off / high: on) /

/*

define MAX6675_PORT PORTD / port data register /

define MAX6675_DDR DDRD / port data direction register /

define MAX6675_CS PD5 / port pin used for /CS /

/*

define MAX31855_PORT PORTD / port data register /

define MAX31855_DDR DDRD / port data direction register /

define MAX31855_CS PD5 / port pin used for /CS /

/* ****

/ ADC reference selection: AVcc /

define ADC_REF_VCC (1 << REFS0)

/ ADC reference selection: internal 1.1V bandgap /

define ADC_REF_BANDGAP ((1 << REFS1) | (1 << REFS0))

/ ADC reference selection: filter mask for register bits /

define ADC_REF_MASK ((1 << REFS1) | (1 << REFS0))

/ ADC MUX channel: internal 1.1V bandgap reference /

define ADC_CHAN_BANDGAP 0x0e / 1110 /

/ ADC MUX channel: filter mask for register bits /

define ADC_CHAN_MASK 0b00001111 / MUX0-3 /

/* ****

/*

if defined(__AVR_ATmega328__)

/ estimated internal resistance of port to GND (in 0.1 Ohms) /

define R_MCU_LOW 200

/ estimated internal resistance of port to VCC (in 0.1 Ohms) /

define R_MCU_HIGH 220

/ voltage offset of MCU's analog comparator (in mV): -50 up to 50 /

define COMPARATOR_OFFSET 0

/ this MCU has 32kB Flash, 1kB EEPROM and 2kB RAM (enable extra features) /

define RES_FLASH 32

define RES_EEPROM 1

define RES_RAM 2

/*

else

error <<< No or wrong MCU type selected! >>>

endif

/* ****

ejouellette commented 2 years ago

Makefile contents:

#

Makefile

#

(c) 2012-2021 by Markus Reschke

based on code from Markus Frejek and Karl-Heinz Kübbeler

#

PROJECT = ComponentTester

#

MCU settings

- Edit to match your setup!

#

avr-gcc: MCU model

- ATmega 328/328P : atmega328

- ATmega 328PB : atmega328pb

- ATmega 324P/324PA : atmega324p

- ATmega 640 : atmega640

- ATmega 644/644P/644PA : atmega644

- ATmega 1280 : atmega1280

- ATmega 1284/1284P : atmega1284

- ATmega 2560 : atmega2560

MCU = atmega328

MCU freqency:

- 1MHz : 1

- 8MHz : 8

- 16MHz : 16

- 20MHz : 20

FREQ = 8

oscillator type

- internal RC oscillator : RC

- external full swing crystal : Crystal

- external low power crystal : LowPower

OSCILLATOR = Crystal

oscillator start-up cycles

- Crystal and LowPower could also be 1024 or 256 based on fuse settings

ifeq (${OSCILLATOR},RC) OSC_STARTUP = 6 endif ifeq (${OSCILLATOR},Crystal) OSC_STARTUP = 16384 endif ifeq (${OSCILLATOR},LowPower) OSC_STARTUP = 16384 endif

#

avrdude settings

- Edit to match your setup!

#

avrdude: part number of MCU

- ATmega 328 : m328

- ATmega 328P : m328p

- ATmega 328PB : m328pb

- ATmega 324P : m324p

- ATmega 324PA : m324pa

- ATmega 640 : m640

- ATmega 644 : m644

- ATmega 644P : m644p

- ATmega 644PA : m644p

- ATmega 1280 : m1280

- ATmega 1284 : m1284

- ATmega 1284P : m1284p

- ATmega 2560 : m2560

PARTNO = m328p

avrdude: ISP programmer, port and options

Arduino as ISP

PROGRAMMER = stk500v1

PORT = /dev/ttyACM0

OPTIONS = -b 19200

Bus Pirate

PROGRAMMER = buspirate

PORT = /dev/bus_pirate

OPTIONS = -B 10.0

Diamex ALL-AVR/AVR-Prog

PROGRAMMER = avrispmkII

PORT = usb

OPTIONS = -B 1.0

Pololu USB AVR Programmer

PROGRAMMER = stk500v2

PORT = /dev/ttyACM0

OPTIONS = -B 1.0

USBasp

PROGRAMMER = usbasp PORT = usb

OPTIONS = -B 20.0

OPTIONS =

USBtinyISP

PROGRAMMER = usbtiny

PORT = usb

OPTIONS = -B 5.0

Arduino Uno bootloader via serial/USB

PROGRAMMER = arduino

PORT = /dev/ttyACM0

OPTIONS = -D -b 115200

Arduino Mega2560 bootloader via serial/USB

PROGRAMMER = wiring

PORT = /dev/ttyACM0

OPTIONS = -D -b 115200

#

global settings

#

project name

NAME = ComponentTester

name and version based on directory name

DIST = $(notdir ${CURDIR})

compiler flags

CC = avr-gcc CPP = avr-g++ CFLAGS = -mmcu=${MCU} -Wall -I. -Ibitmaps CFLAGS += -DF_CPU=${FREQ}000000UL CFLAGS += -DOSC_STARTUP=${OSC_STARTUP} CFLAGS += -gdwarf-2 -std=gnu99 -Os -mcall-prologues CFLAGS += -funsigned-char -funsigned-bitfields -fpack-struct -fshort-enums

CFLAGS += -flto

CFLAGS += -MD -MP -MT $(*F).o -MF dep/$(@F).d

linker flags

LDFLAGS = -mmcu=${MCU} -Wl,-Map=${NAME}.map

hex file flags

HEX_FLASH_FLAGS = -R .eeprom -R .fuse -R .lock -R .signature HEX_EEPROM_FLAGS = -j .eeprom HEX_EEPROM_FLAGS += --set-section-flags=.eeprom="alloc,load" HEX_EEPROM_FLAGS += --change-section-lma .eeprom=0 --no-change-warnings

header files

HEADERS = config.h config_328.h config_644.h config1280.h HEADERS += colors.h common.h functions.h variables.h $(wildcard var*.h) HEADERS += OneWire.h ADS7843.h HEADERS += HD44780.h ILI9163.h ILI9341.h ILI9481.h ILI9486.h ILI9488.h HEADERS += PCD8544.h PCF8814.h SH1106.h SSD1306.h HEADERS += ST7036.h ST7565R.h ST7735.h ST7920.h STE2007.h

objects

OBJECTS_C = main.o user.o pause.o adjust.o ADC.o probes.o display.o OBJECTS_C += resistor.o cap.o semi.o inductor.o OBJECTS_C += tools_misc.o tools_signal.o tools_LC_Meter.o OBJECTS_C += SPI.o I2C.o serial.o commands.o OneWire.o OBJECTS_C += IR_RX.o IR_TX.o DHTxx.o ADS7843.o MAX6675.o MAX31855.o OBJECTS_C += HD44780.o ILI9163.o ILI9341.o ILI9481.o ILI9486.o ILI9488.o OBJECTS_C += PCD8544.o PCF8814.o SH1106.o SSD1306.o OBJECTS_C += ST7036.o ST7565R.o ST7735.o Semi_ST7735.o ST7920.o OBJECTS_C += STE2007.o VT100.o RD_Display.o OBJECTS_S = wait.o OBJECTS = ${OBJECTS_C} ${OBJECTS_S}

#

build

#

.PHONY: all size all: ${NAME} ${NAME}.hex ${NAME}.eep ${NAME}.lss size

#

link

#

link firmware

$(NAME): ${OBJECTS} ${CC} ${LDFLAGS} ${OBJECTS} ${LIBDIRS} ${LIBS} -o ${NAME}

create hex file of firmware

%.hex: ${NAME} avr-objcopy -O ihex ${HEX_FLASH_FLAGS} $< $@

create hex file of EEPROM data

%.eep: ${NAME} -avr-objcopy ${HEX_EEPROM_FLAGS} -O ihex $< $@ || exit 0

create dump of firmware

%.lss: ${NAME} avr-objdump -h -S $< > $@

output firmware size and other info

size: ${NAME} @echo @avr-size -C --mcu=${MCU} $<

#

compile source files

#

rule for all c-files

${OBJECTS_C}: %.o: %.c ${HEADERS} ${MAKEFILE_LIST} ${CC} ${CFLAGS} -c ${@:.o=.c}

rule for all S-files

${OBJECTS_S}: %.o: %.S ${HEADERS} ${MAKEFILE_LIST} ${CC} ${CFLAGS} -c ${@:.o=.S}

external dependencies

-include $(shell mkdir dep 2>/dev/null) $(wildcard dep/*)

#

program MCU

#

program firmware and EEPROM data

.PHONY: upload upload: ${NAME} ${NAME}.hex ${NAME}.eep ${NAME}.lss size avrdude -c ${PROGRAMMER} -P ${PORT} -p ${PARTNO} ${OPTIONS} \ -U flash:w:./${NAME}.hex:a -U eeprom:w:./${NAME}.eep:a

program firmware only

.PHONY: prog_fw prog_fw: ${NAME} ${NAME}.hex ${NAME}.lss size avrdude -c ${PROGRAMMER} -P ${PORT} -p ${PARTNO} ${OPTIONS} \ -U flash:w:./${NAME}.hex:a

program EEPROM data only

.PHONY: prog_ee prog_ee: ${NAME} ${NAME}.eep ${NAME}.lss size avrdude -c ${PROGRAMMER} -P ${PORT} -p ${PARTNO} ${OPTIONS} \ -U eeprom:w:./${NAME}.eep:a

#

misc

#

create distribution package

.PHONY: dist clean dist: clean cd ..; tar -czf ${DIST}/${DIST}.tgz \ ${DIST}/.h ${DIST}/.c ${DIST}/.S ${DIST}/bitmaps/.h \ ${DIST}/Makefile ${DIST}/README ${DIST}/CHANGES \ ${DIST}/README.de ${DIST}/CHANGES.de ${DIST}/Clones \ ${DIST}/*.pdf ${DIST}/dep

clean up

clean: -rm -rf ${OBJECTS} ${NAME} dep/ .tgz -rm -rf ${NAME}.hex ${NAME}.eep ${NAME}.lss ${NAME}.map

#

MCU fuses

#

ATmega 328/328P

ifeq (${MCU},atmega328) FAMILY = atmega328_324_640 endif

ATmega 328PB

ifeq (${MCU},atmega328pb) FAMILY = atmega328pb endif

ATmega 324P/324PA

ifeq (${MCU},atmega324p) FAMILY = atmega328_324_640 endif

ATmega 640

ifeq (${MCU},atmega640) FAMILY = atmega328_324_640 endif

ATmega 644/644P/644PA

ifeq (${MCU},atmega644) FAMILY = atmega328_324_640 endif

ATmega 1280

ifeq (${MCU},atmega1280) FAMILY = atmega328_324_640 endif

ATmega 1284/1284P

ifeq (${MCU},atmega1284) FAMILY = atmega328_324_640 endif

ATmega 2560

ifeq (${MCU},atmega2560) FAMILY = atmega328_324_640 endif

ATmega 328/324/640/644/1280/1284/2560

ifeq (${FAMILY},atmega328_324_640)

high byte: use default settings, disable JTAG

HFUSE = -U hfuse:w:0xd9:m

extended byte: BOD level 4.3V

EFUSE = -U efuse:w:0xfc:m

low byte: clock settings

ifeq (${FREQ},1)

internal RC oscillator (8MHz) and /1 clock divider

LFUSE_RC = -U lfuse:w:0x62:m
# external 8MHz full swing crystal and /8 clock divider
LFUSE_CRYSTAL = -U lfuse:w:0x77:m
# external 8MHz low power crystal and /8 clock divider
LFUSE_LOWPOWER = -U lfuse:w:0x7f:m

endif ifeq (${FREQ},8)

internal RC oscillator (8MHz) and /1 clock divider

LFUSE_RC = -U lfuse:w:0xe2:m
# external 8MHz full swing crystal and /1 clock divider
LFUSE_CRYSTAL = -U lfuse:w:0xf7:m
# external 8MHz low power crystal and /1 clock divider
LFUSE_LOWPOWER = -U lfuse:w:0xff:m

endif ifeq (${FREQ},16)

internal RC oscillator (8MHz) not possible

LFUSE_RC =
# external 16MHz full swing crystal and /1 clock divider
LFUSE_CRYSTAL = -U lfuse:w:0xf7:m
# external 16MHz low power crystal and /1 clock divider
LFUSE_LOWPOWER = -U lfuse:w:0xff:m

endif ifeq (${FREQ},20)

internal RC oscillator (8MHz) not possible

LFUSE_RC =
# external 20MHz full swing crystal and /1 clock divider
LFUSE_CRYSTAL = -U lfuse:w:0xf7:m
# external 20MHz low power crystal and /1 clock divider
LFUSE_LOWPOWER = -U lfuse:w:0xff:m

endif endif

ATmega 328PB

ifeq (${FAMILY},atmega328pb)

high byte: use default settings

HFUSE = -U hfuse:w:0xd9:m

extended byte: BOD level 4.3V, CFD disabled

EFUSE = -U efuse:w:0xf4:m

low byte: clock settings

ifeq (${FREQ},8)

internal RC oscillator (8MHz) and /1 clock divider

LFUSE_RC = -U lfuse:w:0xe2:m
# full swing crystal not supported, use low power crystal
LFUSE_CRYSTAL = -U lfuse:w:0xff:m
# external 8MHz low power crystal and /1 clock divider
LFUSE_LOWPOWER = -U lfuse:w:0xff:m

endif ifeq (${FREQ},16)

internal RC oscillator (8MHz) not possible

LFUSE_RC =
# full swing crystal not supported, use low power crystal
LFUSE_CRYSTAL = -U lfuse:w:0xff:m
# external 16MHz low power crystal and /1 clock divider
LFUSE_LOWPOWER = -U lfuse:w:0xff:m

endif endif

select low byte

ifeq (${OSCILLATOR},RC) LFUSE = ${LFUSE_RC} endif ifeq (${OSCILLATOR},Crystal) LFUSE = ${LFUSE_CRYSTAL} endif ifeq (${OSCILLATOR},LowPower) LFUSE = ${LFUSE_LOWPOWER} endif

check fuses

FUSES = ifneq ($(strip ${LFUSE}),) ifneq ($(strip ${HFUSE}),) FUSES = ${LFUSE} ${HFUSE} ${EFUSE} endif endif

set fuses

.PHONY: fuses fuses: ifeq ($(strip ${FUSES}),) @echo Invalid fuse settings! else avrdude -c ${PROGRAMMER} -P ${PORT} -p ${PARTNO} ${OPTIONS} ${FUSES} endif