From 54f22bf19e7ed2e44ebc829d611e5ba522d3edf3 Mon Sep 17 00:00:00 2001 From: Karel Kalthoff Date: Fri, 24 Mar 2017 12:24:08 -0500 Subject: [PATCH 1/9] improvement: using specific range messages over writing to registers --- hardware/bean/avr/cores/bean/Bean.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/hardware/bean/avr/cores/bean/Bean.cpp b/hardware/bean/avr/cores/bean/Bean.cpp index b67f4c7..78cee09 100644 --- a/hardware/bean/avr/cores/bean/Bean.cpp +++ b/hardware/bean/avr/cores/bean/Bean.cpp @@ -328,12 +328,14 @@ void BeanClass::enableWakeOnAccelerometer(uint8_t sources) { uint8_t BeanClass::getAccelerationRange(void) { uint8_t value; - Serial.accelRegisterRead(REG_G_SETTING, 1, &value); + //Serial.accelRegisterRead(REG_G_SETTING, 1, &value); + Serial.accelRangeRead(&value); return value; } void BeanClass::setAccelerationRange(uint8_t range) { - Serial.accelRegisterWrite(REG_G_SETTING, range); + //Serial.accelRegisterWrite(REG_G_SETTING, range); + Serial.accelRangeSet(&range); } int16_t BeanClass::getAccelerationX(void) { From a0301348de4e6356de343f73d42e796190fd399b Mon Sep 17 00:00:00 2001 From: Karel Kalthoff Date: Fri, 24 Mar 2017 12:34:33 -0500 Subject: [PATCH 2/9] fix: pointer --- hardware/bean/avr/cores/bean/Bean.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hardware/bean/avr/cores/bean/Bean.cpp b/hardware/bean/avr/cores/bean/Bean.cpp index 78cee09..457f929 100644 --- a/hardware/bean/avr/cores/bean/Bean.cpp +++ b/hardware/bean/avr/cores/bean/Bean.cpp @@ -335,7 +335,7 @@ uint8_t BeanClass::getAccelerationRange(void) { void BeanClass::setAccelerationRange(uint8_t range) { //Serial.accelRegisterWrite(REG_G_SETTING, range); - Serial.accelRangeSet(&range); + Serial.accelRangeSet(range); } int16_t BeanClass::getAccelerationX(void) { From b5576114bcdfd65fe9a3d28bd526aadca21cb8b5 Mon Sep 17 00:00:00 2001 From: Karel Kalthoff Date: Mon, 27 Mar 2017 08:46:25 -0500 Subject: [PATCH 3/9] indicate error in reading acc range --- hardware/bean/avr/cores/bean/Bean.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/hardware/bean/avr/cores/bean/Bean.cpp b/hardware/bean/avr/cores/bean/Bean.cpp index 457f929..164c61c 100644 --- a/hardware/bean/avr/cores/bean/Bean.cpp +++ b/hardware/bean/avr/cores/bean/Bean.cpp @@ -329,7 +329,9 @@ void BeanClass::enableWakeOnAccelerometer(uint8_t sources) { uint8_t BeanClass::getAccelerationRange(void) { uint8_t value; //Serial.accelRegisterRead(REG_G_SETTING, 1, &value); - Serial.accelRangeRead(&value); + if (Serial.accelRangeRead(&value)) { + return 0xFF; + } return value; } From 9d893a8d2bbd8535e5ccccdbcaad58aa62a7bdfd Mon Sep 17 00:00:00 2001 From: Karel Kalthoff Date: Mon, 27 Mar 2017 09:27:12 -0500 Subject: [PATCH 4/9] Revert "indicate error in reading acc range" This reverts commit b5576114bcdfd65fe9a3d28bd526aadca21cb8b5. --- hardware/bean/avr/cores/bean/Bean.cpp | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/hardware/bean/avr/cores/bean/Bean.cpp b/hardware/bean/avr/cores/bean/Bean.cpp index 164c61c..457f929 100644 --- a/hardware/bean/avr/cores/bean/Bean.cpp +++ b/hardware/bean/avr/cores/bean/Bean.cpp @@ -329,9 +329,7 @@ void BeanClass::enableWakeOnAccelerometer(uint8_t sources) { uint8_t BeanClass::getAccelerationRange(void) { uint8_t value; //Serial.accelRegisterRead(REG_G_SETTING, 1, &value); - if (Serial.accelRangeRead(&value)) { - return 0xFF; - } + Serial.accelRangeRead(&value); return value; } From 7f26c1a84669691578e409025252c884e66f07dd Mon Sep 17 00:00:00 2001 From: Karel Kalthoff Date: Fri, 24 Mar 2017 12:24:08 -0500 Subject: [PATCH 5/9] improvement: using specific range messages over writing to registers --- hardware/bean/avr/cores/bean/Bean.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/hardware/bean/avr/cores/bean/Bean.cpp b/hardware/bean/avr/cores/bean/Bean.cpp index b67f4c7..78cee09 100644 --- a/hardware/bean/avr/cores/bean/Bean.cpp +++ b/hardware/bean/avr/cores/bean/Bean.cpp @@ -328,12 +328,14 @@ void BeanClass::enableWakeOnAccelerometer(uint8_t sources) { uint8_t BeanClass::getAccelerationRange(void) { uint8_t value; - Serial.accelRegisterRead(REG_G_SETTING, 1, &value); + //Serial.accelRegisterRead(REG_G_SETTING, 1, &value); + Serial.accelRangeRead(&value); return value; } void BeanClass::setAccelerationRange(uint8_t range) { - Serial.accelRegisterWrite(REG_G_SETTING, range); + //Serial.accelRegisterWrite(REG_G_SETTING, range); + Serial.accelRangeSet(&range); } int16_t BeanClass::getAccelerationX(void) { From ace3e74d11018d06f401db85e7512f375f7a2fe0 Mon Sep 17 00:00:00 2001 From: Karel Kalthoff Date: Fri, 24 Mar 2017 12:34:33 -0500 Subject: [PATCH 6/9] fix: pointer --- hardware/bean/avr/cores/bean/Bean.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hardware/bean/avr/cores/bean/Bean.cpp b/hardware/bean/avr/cores/bean/Bean.cpp index 78cee09..457f929 100644 --- a/hardware/bean/avr/cores/bean/Bean.cpp +++ b/hardware/bean/avr/cores/bean/Bean.cpp @@ -335,7 +335,7 @@ uint8_t BeanClass::getAccelerationRange(void) { void BeanClass::setAccelerationRange(uint8_t range) { //Serial.accelRegisterWrite(REG_G_SETTING, range); - Serial.accelRangeSet(&range); + Serial.accelRangeSet(range); } int16_t BeanClass::getAccelerationX(void) { From ff77e8e8d0eb586bbfa776be1ce6809f0123fb1c Mon Sep 17 00:00:00 2001 From: Karel Kalthoff Date: Mon, 27 Mar 2017 08:46:25 -0500 Subject: [PATCH 7/9] indicate error in reading acc range --- hardware/bean/avr/cores/bean/Bean.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/hardware/bean/avr/cores/bean/Bean.cpp b/hardware/bean/avr/cores/bean/Bean.cpp index 457f929..164c61c 100644 --- a/hardware/bean/avr/cores/bean/Bean.cpp +++ b/hardware/bean/avr/cores/bean/Bean.cpp @@ -329,7 +329,9 @@ void BeanClass::enableWakeOnAccelerometer(uint8_t sources) { uint8_t BeanClass::getAccelerationRange(void) { uint8_t value; //Serial.accelRegisterRead(REG_G_SETTING, 1, &value); - Serial.accelRangeRead(&value); + if (Serial.accelRangeRead(&value)) { + return 0xFF; + } return value; } From ad064af452b53aa89a575f26cb56e43adf654545 Mon Sep 17 00:00:00 2001 From: Karel Kalthoff Date: Mon, 27 Mar 2017 09:27:12 -0500 Subject: [PATCH 8/9] Revert "indicate error in reading acc range" This reverts commit b5576114bcdfd65fe9a3d28bd526aadca21cb8b5. --- hardware/bean/avr/cores/bean/Bean.cpp | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/hardware/bean/avr/cores/bean/Bean.cpp b/hardware/bean/avr/cores/bean/Bean.cpp index 164c61c..457f929 100644 --- a/hardware/bean/avr/cores/bean/Bean.cpp +++ b/hardware/bean/avr/cores/bean/Bean.cpp @@ -329,9 +329,7 @@ void BeanClass::enableWakeOnAccelerometer(uint8_t sources) { uint8_t BeanClass::getAccelerationRange(void) { uint8_t value; //Serial.accelRegisterRead(REG_G_SETTING, 1, &value); - if (Serial.accelRangeRead(&value)) { - return 0xFF; - } + Serial.accelRangeRead(&value); return value; } From abeb202f7d099fca69dcc5882fe37de633a26d9e Mon Sep 17 00:00:00 2001 From: Karel Kalthoff Date: Fri, 31 Mar 2017 11:10:10 -0500 Subject: [PATCH 9/9] fix: removing comments for formatting restrictions --- hardware/bean/avr/cores/bean/Bean.cpp | 2 -- 1 file changed, 2 deletions(-) diff --git a/hardware/bean/avr/cores/bean/Bean.cpp b/hardware/bean/avr/cores/bean/Bean.cpp index 457f929..c7d173c 100644 --- a/hardware/bean/avr/cores/bean/Bean.cpp +++ b/hardware/bean/avr/cores/bean/Bean.cpp @@ -328,13 +328,11 @@ void BeanClass::enableWakeOnAccelerometer(uint8_t sources) { uint8_t BeanClass::getAccelerationRange(void) { uint8_t value; - //Serial.accelRegisterRead(REG_G_SETTING, 1, &value); Serial.accelRangeRead(&value); return value; } void BeanClass::setAccelerationRange(uint8_t range) { - //Serial.accelRegisterWrite(REG_G_SETTING, range); Serial.accelRangeSet(range); }