From 7851656847738192e0e12cfe77861ba58d98cf6f Mon Sep 17 00:00:00 2001 From: Selene ToyKeeper Date: Fri, 6 Sep 2019 04:38:00 -0600 Subject: added button LED support to D4v2 (in a way which doesn't break backward compatibility... ... but it really needs some refactoring to reduce code duplication) --- hwdef-Emisar_D4v2.h | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'hwdef-Emisar_D4v2.h') diff --git a/hwdef-Emisar_D4v2.h b/hwdef-Emisar_D4v2.h index 0460fad..addf429 100644 --- a/hwdef-Emisar_D4v2.h +++ b/hwdef-Emisar_D4v2.h @@ -9,7 +9,7 @@ * 3 PA4 green aux LED * 4 PA3 blue aux LED * 5 PA2 e-switch - * 6 PA1 (none) + * 6 PA1 button LED * 7 PA0 (none) * 8 GND GND * 9 VCC VCC @@ -65,17 +65,23 @@ #define AUXLED_RGB_DDR DDRA // DDRA or DDRB or DDRC #define AUXLED_RGB_PUE PUEA // PUEA or PUEB or PUEC +#define BUTTON_LED_PIN PA1 // pin 6 +#define BUTTON_LED_PORT PORTA // for all "PA" pins +#define BUTTON_LED_DDR DDRA // for all "PA" pins +#define BUTTON_LED_PUE PUEA // for all "PA" pins + // with so many pins, doing this all with #ifdefs gets awkward... // ... so just hardcode it in each hwdef file instead inline void hwdef_setup() { // enable output ports // 7135 DDRB = (1 << PWM1_PIN); - // FET, aux R/G/B + // FET, aux R/G/B, button LED DDRA = (1 << PWM2_PIN) | (1 << AUXLED_R_PIN) | (1 << AUXLED_G_PIN) | (1 << AUXLED_B_PIN) + | (1 << BUTTON_LED_PIN) ; // configure PWM -- cgit v1.2.3 From 9c0d1832464e4ee7ee8c4c63092ac4337347483b Mon Sep 17 00:00:00 2001 From: Selene ToyKeeper Date: Wed, 29 Jan 2020 05:08:14 -0700 Subject: rewrote ADC code to use a continuous lowpass system on all measurements, to eliminate noise and maybe increase precision (thermal code still needs to be rewritten though) --- hwdef-Emisar_D4v2.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'hwdef-Emisar_D4v2.h') diff --git a/hwdef-Emisar_D4v2.h b/hwdef-Emisar_D4v2.h index addf429..60f3fae 100644 --- a/hwdef-Emisar_D4v2.h +++ b/hwdef-Emisar_D4v2.h @@ -48,7 +48,7 @@ #define PWM2_LVL OCR1B // OCR1B is the output compare register for PB1 -#define ADC_PRSCL 0x06 // clk/64 +#define ADC_PRSCL 0x07 // clk/128 // average drop across diode on this hardware #ifndef VOLTAGE_FUDGE_FACTOR -- cgit v1.2.3 From f61beefe38f5118dc816d5ba28d7e41001cfe703 Mon Sep 17 00:00:00 2001 From: Selene ToyKeeper Date: Thu, 30 Jan 2020 01:18:56 -0700 Subject: switched to a pseudo-rolling-average method to reduce noise, set prescaler back to 64 --- hwdef-Emisar_D4v2.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'hwdef-Emisar_D4v2.h') diff --git a/hwdef-Emisar_D4v2.h b/hwdef-Emisar_D4v2.h index 60f3fae..addf429 100644 --- a/hwdef-Emisar_D4v2.h +++ b/hwdef-Emisar_D4v2.h @@ -48,7 +48,7 @@ #define PWM2_LVL OCR1B // OCR1B is the output compare register for PB1 -#define ADC_PRSCL 0x07 // clk/128 +#define ADC_PRSCL 0x06 // clk/64 // average drop across diode on this hardware #ifndef VOLTAGE_FUDGE_FACTOR -- cgit v1.2.3 From 51aae811654a3b73fa10ab449e22a11c858aa2d1 Mon Sep 17 00:00:00 2001 From: Selene ToyKeeper Date: Fri, 13 Mar 2020 18:04:43 -0600 Subject: went back to slower clk/128 ADC timing --- hwdef-Emisar_D4v2.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'hwdef-Emisar_D4v2.h') diff --git a/hwdef-Emisar_D4v2.h b/hwdef-Emisar_D4v2.h index addf429..60f3fae 100644 --- a/hwdef-Emisar_D4v2.h +++ b/hwdef-Emisar_D4v2.h @@ -48,7 +48,7 @@ #define PWM2_LVL OCR1B // OCR1B is the output compare register for PB1 -#define ADC_PRSCL 0x06 // clk/64 +#define ADC_PRSCL 0x07 // clk/128 // average drop across diode on this hardware #ifndef VOLTAGE_FUDGE_FACTOR -- cgit v1.2.3 From 635d013abd690315e4e57caf1f47f1f06b6eba58 Mon Sep 17 00:00:00 2001 From: Selene ToyKeeper Date: Wed, 29 Apr 2020 01:40:25 -0600 Subject: removed unused TEMP_CHANNEL thing from FSM-related code --- hwdef-Emisar_D4v2.h | 2 -- 1 file changed, 2 deletions(-) (limited to 'hwdef-Emisar_D4v2.h') diff --git a/hwdef-Emisar_D4v2.h b/hwdef-Emisar_D4v2.h index 60f3fae..fc95e22 100644 --- a/hwdef-Emisar_D4v2.h +++ b/hwdef-Emisar_D4v2.h @@ -55,8 +55,6 @@ #define VOLTAGE_FUDGE_FACTOR 4 // add 0.20V (measured 0.22V) #endif -#define TEMP_CHANNEL 0b00001111 - // this light has aux LEDs under the optic #define AUXLED_R_PIN PA5 // pin 2 #define AUXLED_G_PIN PA4 // pin 3 -- cgit v1.2.3