aboutsummaryrefslogtreecommitdiffstats
path: root/testhal
diff options
context:
space:
mode:
authorbarthess <barthess@35acf78f-673a-0410-8e92-d51de3d6d3f4>2011-12-08 19:28:55 +0000
committerbarthess <barthess@35acf78f-673a-0410-8e92-d51de3d6d3f4>2011-12-08 19:28:55 +0000
commit8196de6aef7616f7df96d757dddc9cfa9eb661dc (patch)
treeb8ad2a8049314384e30f414b146ee4a875fbc953 /testhal
parentedfa9d2fae1d667b3f71a8e61aa954ac2233e493 (diff)
downloadChibiOS-8196de6aef7616f7df96d757dddc9cfa9eb661dc.tar.gz
ChibiOS-8196de6aef7616f7df96d757dddc9cfa9eb661dc.tar.bz2
ChibiOS-8196de6aef7616f7df96d757dddc9cfa9eb661dc.zip
I2C. Testhal update.
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@3584 35acf78f-673a-0410-8e92-d51de3d6d3f4
Diffstat (limited to 'testhal')
-rw-r--r--testhal/STM32F1xx/I2C/Makefile2
-rw-r--r--testhal/STM32F1xx/I2C/fake.c4
-rw-r--r--testhal/STM32F1xx/I2C/lis3.c6
-rw-r--r--testhal/STM32F1xx/I2C/tmp75.c3
4 files changed, 9 insertions, 6 deletions
diff --git a/testhal/STM32F1xx/I2C/Makefile b/testhal/STM32F1xx/I2C/Makefile
index 08494928a..829c472df 100644
--- a/testhal/STM32F1xx/I2C/Makefile
+++ b/testhal/STM32F1xx/I2C/Makefile
@@ -31,7 +31,7 @@ endif
# Enable this if you want to see the full log while compiling.
ifeq ($(USE_VERBOSE_COMPILE),)
- USE_VERBOSE_COMPILE = yes
+ USE_VERBOSE_COMPILE = no
endif
#
diff --git a/testhal/STM32F1xx/I2C/fake.c b/testhal/STM32F1xx/I2C/fake.c
index 53779893e..b06ffbdfd 100644
--- a/testhal/STM32F1xx/I2C/fake.c
+++ b/testhal/STM32F1xx/I2C/fake.c
@@ -36,15 +36,15 @@ static uint8_t rx_data[2];
/* temperature value */
static int16_t temperature = 0;
+static i2cflags_t errors = 0;
#define addr 0b1001100
/* This is main function. */
void request_fake(void){
- i2cflags_t errors = 0;
i2cAcquireBus(&I2CD1);
- errors = i2cMasterReceive(&I2CD1, addr, rx_data, 2);
+ i2cMasterReceive(&I2CD1, addr, rx_data, 2, &errors, TIME_INFINITE);
i2cReleaseBus(&I2CD1);
if (errors == I2CD_ACK_FAILURE){
diff --git a/testhal/STM32F1xx/I2C/lis3.c b/testhal/STM32F1xx/I2C/lis3.c
index d3369ac82..6f697f8f7 100644
--- a/testhal/STM32F1xx/I2C/lis3.c
+++ b/testhal/STM32F1xx/I2C/lis3.c
@@ -40,6 +40,8 @@
static uint8_t accel_rx_data[ACCEL_RX_DEPTH];
static uint8_t accel_tx_data[ACCEL_TX_DEPTH];
+static i2cflags_t errors = 0;
+
static int16_t acceleration_x = 0;
static int16_t acceleration_y = 0;
static int16_t acceleration_z = 0;
@@ -57,7 +59,7 @@ int init_lis3(void){
/* sending */
i2cAcquireBus(&I2CD1);
- i2cMasterTransmit(&I2CD1, lis3_addr, accel_tx_data, 4, accel_rx_data, 0);
+ i2cMasterTransmit(&I2CD1, lis3_addr, accel_tx_data, 4, accel_rx_data, 0, &errors, TIME_INFINITE);
i2cReleaseBus(&I2CD1);
return 0;
}
@@ -68,7 +70,7 @@ int init_lis3(void){
void request_acceleration_data(void){
accel_tx_data[0] = ACCEL_OUT_DATA | AUTO_INCREMENT_BIT; // register address
i2cAcquireBus(&I2CD1);
- i2cMasterTransmit(&I2CD1, lis3_addr, accel_tx_data, 1, accel_rx_data, 6);
+ i2cMasterTransmit(&I2CD1, lis3_addr, accel_tx_data, 1, accel_rx_data, 6, &errors, TIME_INFINITE);
i2cReleaseBus(&I2CD1);
acceleration_x = accel_rx_data[0] + (accel_rx_data[1] << 8);
diff --git a/testhal/STM32F1xx/I2C/tmp75.c b/testhal/STM32F1xx/I2C/tmp75.c
index 630a76dac..23410843f 100644
--- a/testhal/STM32F1xx/I2C/tmp75.c
+++ b/testhal/STM32F1xx/I2C/tmp75.c
@@ -38,6 +38,7 @@ static uint8_t tmp75_rx_data[TMP75_RX_DEPTH];
/* temperature value */
static int16_t temperature = 0;
+static i2cflags_t errors = 0;
#define tmp75_addr 0b1001000
@@ -46,7 +47,7 @@ void request_temperature(void){
int16_t t_int = 0, t_frac = 0;
i2cAcquireBus(&I2CD1);
- i2cMasterReceive(&I2CD1, tmp75_addr, tmp75_rx_data, 2);
+ i2cMasterReceive(&I2CD1, tmp75_addr, tmp75_rx_data, 2, &errors, TIME_INFINITE);
i2cReleaseBus(&I2CD1);
t_int = tmp75_rx_data[0] * 100;