Skip to content
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

Open
wants to merge 6 commits into
base: integration
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion common/message_ant.h
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,8 @@ typedef enum {
ANT_PILL_SHAKING,
ANT_PILL_DATA_ENCRYPTED,
ANT_PILL_PROX_ENCRYPTED,
ANT_SENSE_RESPONSE_HEARTBEAT,
ANT_PILL_PROX_PLAINTEXT,
ANT_SENSE_RESPONSE_HEARTBEAT,
Copy link
Contributor

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

}MSG_ANT_PillDataType_t;

typedef struct{
Expand Down
32 changes: 22 additions & 10 deletions drivers/prox_i2c.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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){
Expand All @@ -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)) );
Expand All @@ -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);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

does this change the behavior ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No. it doesn’t.

Ben

On May 23, 2016, at 1:39 PM, Chris Johnson [email protected] wrote:

In drivers/prox_i2c.c #480 (comment):

@@ -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);
    does this change the behavior ?


You are receiving this because you authored the thread.
Reply to this email directly or view it on GitHub https://github.com/hello/kodobannin/pull/480/files/e5a853fe66c23a29cdb3e267ef6df60fd522b63c#r64284541

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please use the original code then

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay

_reset_config();
_check_id();
_conf_prox();
Expand All @@ -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
Expand All @@ -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);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

divide by one?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if format changes, the ant payload version needs to change as well.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, we need 32 bit raw data out as the format changes.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just remove the divide.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done. Removed the divide.

#endif
}
4 changes: 2 additions & 2 deletions drivers/twi_hw_master.c
Original file line number Diff line number Diff line change
Expand Up @@ -274,14 +274,14 @@ bool twi_master_init(void)
NRF_GPIO->PIN_CNF[TWI_MASTER_CONFIG_CLOCK_PIN_NUMBER] = \
(GPIO_PIN_CNF_SENSE_Disabled << GPIO_PIN_CNF_SENSE_Pos) \
| (GPIO_PIN_CNF_DRIVE_S0D1 << GPIO_PIN_CNF_DRIVE_Pos) \
| (GPIO_PIN_CNF_PULL_Pullup << GPIO_PIN_CNF_PULL_Pos) \
| (GPIO_PIN_CNF_PULL_Disabled << GPIO_PIN_CNF_PULL_Pos) \
| (GPIO_PIN_CNF_INPUT_Connect << GPIO_PIN_CNF_INPUT_Pos) \
| (GPIO_PIN_CNF_DIR_Input << GPIO_PIN_CNF_DIR_Pos);

NRF_GPIO->PIN_CNF[TWI_MASTER_CONFIG_DATA_PIN_NUMBER] = \
(GPIO_PIN_CNF_SENSE_Disabled << GPIO_PIN_CNF_SENSE_Pos) \
| (GPIO_PIN_CNF_DRIVE_S0D1 << GPIO_PIN_CNF_DRIVE_Pos) \
| (GPIO_PIN_CNF_PULL_Pullup << GPIO_PIN_CNF_PULL_Pos) \
| (GPIO_PIN_CNF_PULL_Disabled << GPIO_PIN_CNF_PULL_Pos) \
| (GPIO_PIN_CNF_INPUT_Connect << GPIO_PIN_CNF_INPUT_Pos) \
| (GPIO_PIN_CNF_DIR_Input << GPIO_PIN_CNF_DIR_Pos);

Expand Down
4 changes: 2 additions & 2 deletions pillx_EVT1/platform.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,14 @@
#define ANT_ENABLE
#endif

#define BLE_ENABLE
//#define BLE_ENABLE
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

debug code?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, it is for debug.

On May 23, 2016, at 1:38 PM, Chris Johnson [email protected] wrote:

In pillx_EVT1/platform.h #480 (comment):

@@ -6,14 +6,14 @@
#define ANT_ENABLE
#endif

-#define BLE_ENABLE
+//#define BLE_ENABLE
debug code?


You are receiving this because you authored the thread.
Reply to this email directly or view it on GitHub https://github.com/hello/kodobannin/pull/480/files/e5a853fe66c23a29cdb3e267ef6df60fd522b63c#r64284417

Copy link
Contributor

Choose a reason for hiding this comment

The 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
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

debug code?

Copy link
Contributor

Choose a reason for hiding this comment

The 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

Expand Down