-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Prox 156 f1 a687 bdadef7 #480
base: integration
Are you sure you want to change the base?
Changes from 2 commits
7e84dee
e5a853f
a028aa4
81d9f6f
f8b9f21
5f6872c
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -34,8 +34,14 @@ static inline void TWI_READ(uint8_t addr, uint8_t reg, void * ptr, size_t ptr_si | |
} | ||
|
||
|
||
static const uint8_t CONF_MEAS1[3] = { 0x08, 0x1C, 0x00 }; | ||
static const uint8_t CONF_MEAS4[3] = { 0x0B, 0x7C, 0x00 }; | ||
static const uint8_t CONF_MEAS1[3] = { 0x08, 0x1C, 0x00 };// if differential measurement- 0x0C/single ended measurement- 0x1C/ and store results in MEAS1 | ||
static const uint8_t CONF_MEAS4[3] = { 0x0B, 0x7C, 0x00 };// single ended measurement- 0x7C/ and store results in MEAS4 | ||
|
||
static const uint8_t CONF_GAIN_CAL1[3] = {0x11, 0xFF, 0xFF};// CIN1 4x gain as 0xFF | ||
static const uint8_t CONF_GAIN_CAL4[3] = {0x14, 0xFF, 0xFF};// CIN4 4x gain as 0xFF | ||
|
||
static const uint8_t CONF_OFFSET_CAL1[3] = {0x0D, 0xF0, 0x00};// CIN1 offset calibration -16pF -> 16pF | ||
//static const uint8_t CONF_OFFSET_CAL4[3] = {0x10, 0xC8, 0x00}; | ||
|
||
static const uint8_t CONF_READ1[3] = {0x0C, 0x04, 0x80};//config nonrepeat | ||
static const uint8_t CONF_READ4[3] = {0x0C, 0x04, 0x10};//config nonrepeat | ||
|
@@ -60,7 +66,7 @@ static uint32_t _byte_check(const uint8_t * compare, const uint8_t * actual, siz | |
return 0; | ||
} | ||
static void _reset_config(void){ | ||
uint8_t RST[3] = {0x0C, 0x84, 0x90}; | ||
uint8_t RST[3] = {0x0C, 0x84, 0x00}; | ||
TWI_WRITE(FDC_ADDRESS, RST, sizeof(RST)); | ||
} | ||
static void _check_id(void){ | ||
|
@@ -78,6 +84,12 @@ static void _conf_prox(void){ | |
uint8_t r[2] = {0}; | ||
TWI_WRITE(FDC_ADDRESS, CONF_MEAS1, sizeof(CONF_MEAS1)); | ||
TWI_WRITE(FDC_ADDRESS, CONF_MEAS4, sizeof(CONF_MEAS4)); | ||
// CONFIG OFFSET | ||
TWI_WRITE(FDC_ADDRESS, CONF_OFFSET_CAL1, sizeof(CONF_OFFSET_CAL1)); //OFFSET CANCELLATION FOR CAP1 (BATT SIDE) | ||
// TWI_WRITE(FDC_ADDRESS, CONF_OFFSET_CAL4, sizeof(CONF_OFFSET_CAL4)); | ||
// CONFIG GAIN | ||
TWI_WRITE(FDC_ADDRESS, CONF_GAIN_CAL1, sizeof(CONF_GAIN_CAL1)); // GAIN COMPENSATION FOR CAP1 (BATT SIDE) | ||
TWI_WRITE(FDC_ADDRESS, CONF_GAIN_CAL4, sizeof(CONF_GAIN_CAL4)); | ||
//verify | ||
TWI_READ(FDC_ADDRESS, CONF_MEAS1[0], r,sizeof(r)); | ||
APP_OK( _byte_check(r, &CONF_MEAS1[1], sizeof(r)) ); | ||
|
@@ -90,9 +102,9 @@ MSG_Status init_prox(void){ | |
//tie vaux to vbat | ||
#ifdef PLATFORM_HAS_PROX | ||
nrf_gpio_cfg_output(PROX_BOOST_ENABLE); | ||
nrf_gpio_pin_clear(PROX_BOOST_ENABLE); | ||
nrf_gpio_cfg_output(PROX_VDD_EN); | ||
nrf_gpio_pin_set(PROX_VDD_EN); | ||
nrf_gpio_pin_write(PROX_BOOST_ENABLE, 0); | ||
nrf_gpio_cfg_output(PROX_VDD_EN); | ||
nrf_gpio_pin_write(PROX_VDD_EN, 1); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. does this change the behavior ? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. No. it doesn’t. Ben
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. please use the original code then There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Okay |
||
_reset_config(); | ||
_check_id(); | ||
_conf_prox(); | ||
|
@@ -106,8 +118,8 @@ void read_prox(uint32_t * out_val1, uint32_t * out_val4){ | |
uint16_t cap_meas1_lo = 0; | ||
uint16_t cap_meas4_hi = 0; | ||
uint16_t cap_meas4_lo = 0; | ||
uint64_t cap_meas1_raw = 0; | ||
uint64_t cap_meas4_raw = 0; | ||
uint32_t cap_meas1_raw = 0; | ||
uint32_t cap_meas4_raw = 0; | ||
TWI_WRITE(FDC_ADDRESS, CONF_READ1, sizeof(CONF_READ1)); | ||
TWI_WRITE(FDC_ADDRESS, CONF_READ4, sizeof(CONF_READ4)); | ||
//todo verify write | ||
|
@@ -120,7 +132,7 @@ void read_prox(uint32_t * out_val1, uint32_t * out_val4){ | |
cap_meas1_raw = cap_meas1_raw >> 8; | ||
cap_meas4_raw = swap_endian16(cap_meas4_lo) | (swap_endian16(cap_meas4_hi) << 16); | ||
cap_meas4_raw = cap_meas4_raw >> 8; | ||
*out_val1 = (uint32_t)((cap_meas1_raw << 10) / 524288); | ||
*out_val4 = (uint32_t)((cap_meas4_raw << 10) / 524288); | ||
*out_val1 = (uint32_t)((cap_meas1_raw ) / 1); | ||
*out_val4 = (uint32_t)((cap_meas4_raw ) / 1); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. divide by one? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. if format changes, the ant payload version needs to change as well. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, we need 32 bit raw data out as the format changes. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. just remove the divide. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. done. Removed the divide. |
||
#endif | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,14 +6,14 @@ | |
#define ANT_ENABLE | ||
#endif | ||
|
||
#define BLE_ENABLE | ||
//#define BLE_ENABLE | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. debug code? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, it is for debug.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. please reenable for integration, and disable it locally for testing. |
||
|
||
#define HW_REVISION 3 | ||
|
||
#define DEVICE_KEY_ADDRESS 0x20003FF0 | ||
//use hello's ant network key | ||
#define USE_HLO_ANT_NETWORK | ||
#define PILL_ANT_TYPE HLO_ANT_DEVICE_TYPE_PILL1_5 | ||
//#define PILL_ANT_TYPE HLO_ANT_DEVICE_TYPE_PILL1_5 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. debug code? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. please reenable for integration, and disable it locally for testing ( or keep in separate branch) |
||
|
||
#define configTOTAL_HEAP_SIZE 1024 | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
pls remove this packet type