forgot to commit everything...

This commit is contained in:
2018-02-03 16:55:37 +01:00
parent 20d46af1fb
commit 3da4722748
15 changed files with 991 additions and 0 deletions

21
user/ADC.h Executable file
View File

@@ -0,0 +1,21 @@
#ifndef ADC_H
#define ADC_H
class ADC {
public:
static uint16_t getA0() {
return 0xffff & system_adc_read();
}
static uint16_t getVcc() {
static constexpr float SCALER = 1.93; // divider of 10k / 10k -> * 2
static constexpr int V_REF = 330; // 3.3 volt
static constexpr int MUL = SCALER * V_REF;
return getA0() * MUL / 1024;
}
};
#endif // ADC_H