voltage-reading #13
No reviewers
Labels
No Label
bug
duplicate
enhancement
help wanted
invalid
question
wontfix
No Milestone
No project
No Assignees
3 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: Mikrokontrollersystemer-gruppe-4/mikrokontrollersystemer-prosjekt#13
Loading…
Reference in New Issue
Block a user
No description provided.
Delete Branch "voltage-reading"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
closes #2
@ -19,3 +25,2 @@while (1) {printf("Hello, world!\n");_delay_ms(500);uint16_t adcVal = ADC0_read();Make this to its own function.
Fixed in commit
efe623936a@ -0,0 +1,29 @@#include "voltage.h"void sensor_init(void) {what does this function do? anything at all?
Where the sensor set up wil be
@ -0,0 +3,4 @@/* Disable digital input buffer */}void ADC0_init(void) {Description of what the function does
Fixed in
25050d4500@ -0,0 +16,4 @@ADC0.MUXPOS = ADC_MUXPOS_AIN6_gc;}uint16_t ADC0_read(void) {Here too
Fixed in
25050d4500Needs overhaul.
@ -0,0 +1,53 @@#include "voltage.h"#include "uart.h"void ADC0_init(void) {We need to be able to read three different analog voltages.
As far as I can see this code only allows for reading one analog voltage.
Fix in
a9f5c42243@ -0,0 +40,4 @@VREF.ADC0REF = VREF_REFSEL_VDD_gc;}uint16_t diode_voltage_read(){diode_voltage_read() is defined twice. It is also defined on line 30.
Fixed in
a9f5c42243@ -0,0 +45,4 @@uint8_t adcVal = ADC0_read();return adcVal;}uint16_t internal_voltage_read() {Internal voltage read defined twice. Also defined on line 37.
Fixed in
a9f5c42243@ -0,0 +20,4 @@*//** File:This information should be filled out.
@ -0,0 +54,4 @@uint16_t ADC0_read(void);// Gets the value from sensor and internal voltageuint16_t internal_voltage_read();uint16_t diode_voltage_read();It is not clear what diode is.
Is diode the photodiode for the fan?
Fixed in
a9f5c42243voltage-readingto WIP: voltage-reading@ -0,0 +33,4 @@return ADC0.RES;}uint16_t photodiode_voltage_read() {This is no longer required, re-purpose for thermistor?
This should likely also configure the ADC MUX so it reads from the correct pin before reading the value.
Datasheet: 33.3.3.7
Fixed in
ae28be55d3@ -0,0 +44,4 @@/* Gets value for the internal voltage reffreance*/VREF.ADC0REF = VREF_REFSEL_VDD_gc;}Does this function return anything?
It does not look like it returns anything.
Fixed in
ae28be55d3This does not look correct, you are returning a variable assignment.
91ee8b1af8fixed herDelete the line that sets ADC0REF. This is redundant as this is set in init.
b0c0efa4fcfixed here@ -0,0 +55,4 @@// Gets the value from sensor and internal voltageuint16_t internal_voltage_read();uint16_t photodiode_voltage_read();#ifdef __cplusplusWe're missing a function to read the thermistor voltage.
Fixed in
ae28be55d3This has the wrong function name, and is identical to the function on line 56.
Please make the function for the external voltage. It also needs to be in
voltage.cfixed
91ee8b1af8@ -0,0 +41,4 @@return adc_val;}uint16_t external_voltage_read(){Not defined in
voltage.hFixed in
ca28e23b70@ -0,0 +42,4 @@}uint16_t external_voltage_read(){ADC0.MUXPOS = 0x02;Externale voltage pin is PD6 in init function, but PD2 here.
ca28e23b70fixedLGTM
WIP: voltage-readingto voltage-readingMerged in
1b8ca0c7f6Pull request closed