Skip to content

Commit

Permalink
Adding mpx5100 support
Browse files Browse the repository at this point in the history
  • Loading branch information
k105la committed Aug 6, 2020
1 parent 33e022a commit 166e3be
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
9 changes: 8 additions & 1 deletion board/driver/mpx5100.h
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
#ifndef MPX5100_H
#define MPX5100_H

#include "../driver/adc.h"
// #define SIGNAL_OFFSET // This value corresponds to an air flow of 0
#define MAX_PRESSURE 120 // Pressure in KPa

float pascal, adc_val;
void getPascal(void);

#endif // MPX5100_H
6 changes: 6 additions & 0 deletions board/mpx5100/mpx5100.c
Original file line number Diff line number Diff line change
@@ -1 +1,7 @@
#include "../driver/adc.h"

void getPascal(void) {
adc_val = adcRead();
pascal = ((adc_val / 1023) * MAX_PRESSURE) * 1000;
printf("%.2f Pa\n" pascal);
}

0 comments on commit 166e3be

Please sign in to comment.