1
0
forked from me/IronOS

Starting hall effect support

This commit is contained in:
Ben V. Brown
2020-10-13 18:46:37 +11:00
parent 2c626d7203
commit 58c4ecaea6
8 changed files with 103 additions and 2 deletions

View File

@@ -51,6 +51,10 @@ uint8_t showBootLogoIfavailable();
void delay_ms(uint16_t count) ;
//Used to allow knowledge of if usb_pd is being used
uint8_t usb_pd_detect();
// If the iron has a hall effect sensor in the handle, return an signed count of the reading
// If the sensor is single polarity (or polarity insensitive) just return 0..32768
int16_t getRawHallEffect();
#ifdef __cplusplus
}

View File

@@ -20,7 +20,8 @@
#define POW_QC
#define TEMP_TMP36
#define ACCEL_BMA
#define HALL_SENSOR
#define HALL_SI7210
#define BATTFILTERDEPTH 32
#endif

View File

@@ -9,10 +9,25 @@
#include "task.h"
#include "I2C_Wrapper.hpp"
#include "fusbpd.h"
#include "Si7210.h"
bool hall_effect_present = false;
void postRToSInit() {
// Any after RTos setup
#ifdef POW_PD
//Spawn all of the USB-C processors
fusb302_start_processing();
#endif
#ifdef HALL_SI7210
if (Si7210::detect()) {
hall_effect_present = Si7210::init();
}
#endif
}
int16_t getRawHallEffect() {
if (hall_effect_present) {
return Si7210::read();
}
return 0;
}