Skip to content

Commit

Permalink
some test
Browse files Browse the repository at this point in the history
  • Loading branch information
k105la committed Jun 9, 2020
2 parents 2734e3d + b4fc6fd commit 8ea619d
Show file tree
Hide file tree
Showing 5 changed files with 39 additions and 4 deletions.
4 changes: 3 additions & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
name: panflute tests

on:
# Trigger the workflow on push or pull request,
# but only for the master branch
Expand All @@ -18,4 +20,4 @@ jobs:
- name: Install dependencies
run: cd board && sh install.sh
- name: Build PanFLUte firmware
run: cd board && make
run: cd board && make
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
</p>
</div>

[![Build Status](http://img.shields.io/travis/COVID-19-electronic-health-system/PanFLUte/master.svg?style=for-the-badge)](https://travis-ci.org/COVID-19-electronic-health-system/PanFLUte)
![panflute tests](https://github.com/COVID-19-electronic-health-system/PanFLUte/workflows/panflute%20tests/badge.svg)

PanFLUte (Pneumonia analyzing node for FLU to everyone) is an open source spirometer.
It is used to measures the amount of air you're able to breathe in and out.
Expand Down
12 changes: 11 additions & 1 deletion board/adc/adc.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#include "../driver/adc.h"


void adcInit(void) {
/* Enable ADC */
ADCSRA = (1 << ADEN) | (1 << ADSC);
Expand All @@ -8,11 +9,20 @@ void adcInit(void) {
//printf("ADC has started\n");
}


/*
void getPSI(void) {
ADCSRA |= (1 << ADSC); // Start ADC conversion
float rawPresureData = ADCH; // Max is 8bit value
printf("PSI: %.2f", (rawPresureData / 255.0) * 14.5);
_delay_ms(100);


uint8_t adcStart(void) {
ADCSRA |= (1 << ADSC); // Start ADC conversion
loop_until_bit_is_clear(ADCSRA, ADSC);
uint8_t rawPresureData = ADCH; // Max is 8bit value

return rawPresureData;

}
*/
3 changes: 3 additions & 0 deletions board/driver/adc.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,7 @@
#include <stdint.h>

void adcInit(void);

//void getPSI(void);

uint8_t adcStart(void);
22 changes: 21 additions & 1 deletion board/main.c
Original file line number Diff line number Diff line change
@@ -1,24 +1,44 @@
#include <util/delay.h>
#include "driver/usart.h"
#include "driver/led.h"
#include "driver/adc.h"
#define OFFSET 44

static FILE mystdout = FDEV_SETUP_STREAM(print, NULL, _FDEV_SETUP_RW);
int a_in;
int a;

<<<<<<< HEAD
int main(void) {
=======

int main(void) {
>>>>>>> b4fc6fd1c59c6124dbb1c7cc156b1d2dfa90a838
adcInit();
usartInit(MYUBRR);
stdout = &mystdout;
while(1) {
while(ADCSRA & (1 << ADSC));
ADCSRA |= (1 << ADSC); // Start ADC conversion
<<<<<<< HEAD
a_in = ADCL;
a = (ADCH * 255) + a_in;
printf("10 bit ADC: %d\n", a - OFFSET);
_delay_ms(150);
}
=======
// TODO: Must subtract ADCH from offset.
printf("PSI: %.2f\n", (ADCH / 255.0) * 14.5);
delay_ms(150);

int main(void) {
adcInit();
usartInit(MYUBRR);
stdout = &mystdout;
while(1) {
printf("Should be sensor data: %d\n", adcStart());
delay_ms(1000);
>>>>>>> b4fc6fd1c59c6124dbb1c7cc156b1d2dfa90a838
}
return 0;
}
}

0 comments on commit 8ea619d

Please sign in to comment.