From b86226636219bd0ab443f62975011abd4d22b36b Mon Sep 17 00:00:00 2001 From: Inamr Date: Wed, 20 Mar 2024 15:45:24 +0100 Subject: [PATCH 1/5] Sync changes and added func for both voltages --- prosjekt.X/nbproject/configurations.xml | 190 ++++++++++++++++++++++++ prosjekt.X/nbproject/project.xml | 48 +++--- prosjekt.X/voltage.c | 19 +-- prosjekt.X/voltage.h | 7 +- 4 files changed, 229 insertions(+), 35 deletions(-) diff --git a/prosjekt.X/nbproject/configurations.xml b/prosjekt.X/nbproject/configurations.xml index 6efab0a..ff5c2b4 100644 --- a/prosjekt.X/nbproject/configurations.xml +++ b/prosjekt.X/nbproject/configurations.xml @@ -1,3 +1,4 @@ +<<<<<<< Updated upstream @@ -178,3 +179,192 @@ +======= + + + + + themistor-temp.h + uart.h + voltage.h + fan_speeeed.h + + + Makefile + + + + + main.c + thermistor-temp.c + uart.c + voltage.c + fan_speeeed.c + + + + . + + Makefile + + + + localhost + AVR128DB48 + + + nEdbgTool + XC8 + 2.46 + 3 + + + + + + + + + + + + + + + false + false + + + + + + + false + false + + false + + false + false + false + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +>>>>>>> Stashed changes diff --git a/prosjekt.X/nbproject/project.xml b/prosjekt.X/nbproject/project.xml index 9d6ede3..9ac6a37 100644 --- a/prosjekt.X/nbproject/project.xml +++ b/prosjekt.X/nbproject/project.xml @@ -1,23 +1,25 @@ - - - com.microchip.mplab.nbide.embedded.makeproject - - - prosjekt - 928a6534-8606-496e-8a74-8a6544316339 - 0 - ISO-8859-1 - - - - - default - 2 - - - - false - - - - + + + com.microchip.mplab.nbide.embedded.makeproject + + + prosjekt + 928a6534-8606-496e-8a74-8a6544316339 + 0 + ISO-8859-1 + + + . + + + + default + 2 + + + + false + + + + diff --git a/prosjekt.X/voltage.c b/prosjekt.X/voltage.c index 2983dfb..3a26823 100644 --- a/prosjekt.X/voltage.c +++ b/prosjekt.X/voltage.c @@ -1,11 +1,6 @@ #include "voltage.h" #include "uart.h" -void sensor_init(void) { - /* Disable digital input buffer */ - -} - void ADC0_init(void) { /* Initializing ADC0 pin*/ PORTD.PIN6CTRL &= ~PORT_ISC_gm; @@ -32,9 +27,15 @@ uint16_t ADC0_read(void) { return ADC0.RES; } -uint16_t voltage_values(void) { - /* Gets values */ - uint16_t adcVal = ADC0_read(); - VREF.ADC0REF = VREF_REFSEL_VDD_gc; +uint16_t diode_voltage_read(void){ + /* Gets value for the diode */ + uint8_t adcVal = ADC0_read(); + return adcVal; +} +uint16_t internal_voltage_read(void) { + /* Gets value for the internal voltage reffreance*/ + + VREF.ADC0REF = VREF_REFSEL_VDD_gc; + } \ No newline at end of file diff --git a/prosjekt.X/voltage.h b/prosjekt.X/voltage.h index 221b741..381f8fd 100644 --- a/prosjekt.X/voltage.h +++ b/prosjekt.X/voltage.h @@ -44,16 +44,17 @@ #ifdef __cplusplus extern "C" { #endif /* __cplusplus */ -// Initializing of the sensor pins -void sensor_init(void); + // Initializing of the ADC0 pins + void ADC0_init(void); // //void ADC0_start(void); //Start ADC conversion uint16_t ADC0_read(void); // Gets the value from sensor and internal voltage -uint16_t voltage_values(void); +uint16_t internal_voltage_read(void); +uint16_t diode_voltage_read(void) #ifdef __cplusplus } #endif /* __cplusplus */ From 980e6b7c5a555236b45941b6f0b3b60eb8ccb33f Mon Sep 17 00:00:00 2001 From: Inamr Date: Wed, 20 Mar 2024 15:53:26 +0100 Subject: [PATCH 2/5] renamed diode voltage read --- prosjekt.X/voltage.c | 11 ++++++----- prosjekt.X/voltage.h | 18 +++++++++--------- 2 files changed, 15 insertions(+), 14 deletions(-) diff --git a/prosjekt.X/voltage.c b/prosjekt.X/voltage.c index 3a26823..95b79a3 100644 --- a/prosjekt.X/voltage.c +++ b/prosjekt.X/voltage.c @@ -23,19 +23,20 @@ uint16_t ADC0_read(void) { ; } // Clear the interrupt flag by writing 1: - ADC0.INTFLAGS = ADC_RESRDY_bm; + ADC0.INTFLAGS = ADC_RESRDY_bm; return ADC0.RES; } -uint16_t diode_voltage_read(void){ +uint16_t diode_voltage_read() { /* Gets value for the diode */ uint8_t adcVal = ADC0_read(); return adcVal; } -uint16_t internal_voltage_read(void) { + +uint16_t internal_voltage_read() { /* Gets value for the internal voltage reffreance*/ - + VREF.ADC0REF = VREF_REFSEL_VDD_gc; - + } \ No newline at end of file diff --git a/prosjekt.X/voltage.h b/prosjekt.X/voltage.h index 381f8fd..c006796 100644 --- a/prosjekt.X/voltage.h +++ b/prosjekt.X/voltage.h @@ -45,16 +45,16 @@ extern "C" { #endif /* __cplusplus */ -// Initializing of the ADC0 pins + // Initializing of the ADC0 pins -void ADC0_init(void); -// -//void ADC0_start(void); -//Start ADC conversion -uint16_t ADC0_read(void); -// Gets the value from sensor and internal voltage -uint16_t internal_voltage_read(void); -uint16_t diode_voltage_read(void) + void ADC0_init(void); + // + //void ADC0_start(void); + //Start ADC conversion + uint16_t ADC0_read(void); + // Gets the value from sensor and internal voltage + uint16_t internal_voltage_read(); + uint16_t diode_voltage_read(); #ifdef __cplusplus } #endif /* __cplusplus */ From b8e2305349739e4beb2ccda01d62bd43fa35e286 Mon Sep 17 00:00:00 2001 From: Inamr Date: Wed, 20 Mar 2024 16:09:16 +0100 Subject: [PATCH 3/5] Auto stash before merge of "voltage-reading" and "origin/voltage-reading" --- prosjekt.X/voltage.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/prosjekt.X/voltage.c b/prosjekt.X/voltage.c index 95b79a3..c31322d 100644 --- a/prosjekt.X/voltage.c +++ b/prosjekt.X/voltage.c @@ -39,4 +39,14 @@ uint16_t internal_voltage_read() { VREF.ADC0REF = VREF_REFSEL_VDD_gc; +uint16_t diode_voltage_read(void){ + /* Gets value for the diode */ + uint8_t adcVal = ADC0_read(); + return adcVal; +} +uint16_t internal_voltage_read(void) { + /* Gets value for the internal voltage reffreance*/ + + VREF.ADC0REF = VREF_REFSEL_VDD_gc; + } \ No newline at end of file From be82194a6d634905e46070cb25827c2965c3c0bb Mon Sep 17 00:00:00 2001 From: Inamr Date: Wed, 20 Mar 2024 16:11:01 +0100 Subject: [PATCH 4/5] add bracket --- prosjekt.X/voltage.c | 1 + 1 file changed, 1 insertion(+) diff --git a/prosjekt.X/voltage.c b/prosjekt.X/voltage.c index c31322d..6366edd 100644 --- a/prosjekt.X/voltage.c +++ b/prosjekt.X/voltage.c @@ -38,6 +38,7 @@ uint16_t internal_voltage_read() { /* Gets value for the internal voltage reffreance*/ VREF.ADC0REF = VREF_REFSEL_VDD_gc; +} uint16_t diode_voltage_read(void){ /* Gets value for the diode */ From c189291012ac440812c4b4b3ced53a0663fa1b87 Mon Sep 17 00:00:00 2001 From: Inamr Date: Tue, 26 Mar 2024 13:35:36 +0100 Subject: [PATCH 5/5] test --- prosjekt.X/voltage.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/prosjekt.X/voltage.c b/prosjekt.X/voltage.c index 6366edd..8c43dfd 100644 --- a/prosjekt.X/voltage.c +++ b/prosjekt.X/voltage.c @@ -40,14 +40,14 @@ uint16_t internal_voltage_read() { VREF.ADC0REF = VREF_REFSEL_VDD_gc; } -uint16_t diode_voltage_read(void){ +uint16_t diode_voltage_read(){ /* Gets value for the diode */ uint8_t adcVal = ADC0_read(); return adcVal; } -uint16_t internal_voltage_read(void) { +uint16_t internal_voltage_read() { /* Gets value for the internal voltage reffreance*/ VREF.ADC0REF = VREF_REFSEL_VDD_gc; - + return VREF_REFSEL_VDD_gc; } \ No newline at end of file