summaryrefslogtreecommitdiff
path: root/stmhal/accel.c
diff options
context:
space:
mode:
authorDamien George <damien.p.george@gmail.com>2014-07-31 13:47:06 +0000
committerDamien George <damien.p.george@gmail.com>2014-07-31 13:47:06 +0000
commit8cc2018d47bc15a1b10295965fc0ccd27c0dcbba (patch)
tree5e8ba4bed5de1f1973203b9cff2c8aab78b419fc /stmhal/accel.c
parentc9aa58e6381018cca2513e3468363af0b5442d1f (diff)
parentbb4c6f35c627ab3487cdd6bafb4588cc633cd6a4 (diff)
Merge branch 'master' of https://github.com/micropython/micropython
Diffstat (limited to 'stmhal/accel.c')
-rw-r--r--stmhal/accel.c15
1 files changed, 8 insertions, 7 deletions
diff --git a/stmhal/accel.c b/stmhal/accel.c
index cfc80f9d3..e846ca4e7 100644
--- a/stmhal/accel.c
+++ b/stmhal/accel.c
@@ -83,11 +83,11 @@ STATIC void accel_start(void) {
I2CHandle1.Init.OwnAddress2 = 0xfe; // unused
i2c_init(&I2CHandle1);
- // turn off AVDD, wait 20ms, turn on AVDD, wait 20ms again
+ // turn off AVDD, wait 30ms, turn on AVDD, wait 30ms again
GPIOB->BSRRH = GPIO_PIN_5; // turn off
- HAL_Delay(20);
+ HAL_Delay(30);
GPIOB->BSRRL = GPIO_PIN_5; // turn on
- HAL_Delay(20);
+ HAL_Delay(30);
HAL_StatusTypeDef status;
@@ -100,11 +100,12 @@ STATIC void accel_start(void) {
}
}
- //printf("MemWrite\n");
- uint8_t data[1];
- data[0] = 1; // active mode
+ // set MMA to active mode
+ uint8_t data[1] = {1}; // active mode
status = HAL_I2C_Mem_Write(&I2CHandle1, MMA_ADDR, MMA_REG_MODE, I2C_MEMADD_SIZE_8BIT, data, 1, 200);
- //printf(" got %d\n", status);
+
+ // wait for MMA to become active
+ HAL_Delay(30);
}
/******************************************************************************/