Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
TASTE
uPython-mirror
Commits
6f702839
Commit
6f702839
authored
Oct 29, 2015
by
Damien George
Browse files
stmhal: Make accel AVDD pin configurable via mpconfigboard.h.
parent
98b6d35c
Changes
4
Hide whitespace changes
Inline
Side-by-side
stmhal/accel.c
View file @
6f702839
...
...
@@ -31,6 +31,8 @@
#include
"py/nlr.h"
#include
"py/runtime.h"
#include
"pin.h"
#include
"genhdr/pins.h"
#include
"i2c.h"
#include
"accel.h"
...
...
@@ -59,12 +61,12 @@ void accel_init(void) {
GPIO_InitTypeDef
GPIO_InitStructure
;
// PB5 is connected to AVDD; pull high to enable MMA accel device
GPIOB
->
BSRRH
=
GPIO_PIN_5
;
// turn off AVDD
GPIO_InitStructure
.
Pin
=
GPIO_PIN_5
;
MICROPY_HW_MMA_AVDD_PIN
.
gpio
->
BSRRH
=
MICROPY_HW_MMA_AVDD_PIN
.
pin_mask
;
// turn off AVDD
GPIO_InitStructure
.
Pin
=
MICROPY_HW_MMA_AVDD_PIN
.
pin_mask
;
GPIO_InitStructure
.
Mode
=
GPIO_MODE_OUTPUT_PP
;
GPIO_InitStructure
.
Speed
=
GPIO_SPEED_LOW
;
GPIO_InitStructure
.
Pull
=
GPIO_NOPULL
;
HAL_GPIO_Init
(
GPIOB
,
&
GPIO_InitStructure
);
HAL_GPIO_Init
(
MICROPY_HW_MMA_AVDD_PIN
.
gpio
,
&
GPIO_InitStructure
);
}
STATIC
void
accel_start
(
void
)
{
...
...
@@ -80,9 +82,9 @@ STATIC void accel_start(void) {
i2c_init
(
&
I2CHandle1
);
// turn off AVDD, wait 30ms, turn on AVDD, wait 30ms again
GPIOB
->
BSRRH
=
GPIO_PIN_5
;
// turn off
MICROPY_HW_MMA_AVDD_PIN
.
gpio
->
BSRRH
=
MICROPY_HW_MMA_AVDD_PIN
.
pin_mask
;
// turn off
HAL_Delay
(
30
);
GPIOB
->
BSRRL
=
GPIO_PIN_5
;
// turn on
MICROPY_HW_MMA_AVDD_PIN
.
gpio
->
BSRRL
=
MICROPY_HW_MMA_AVDD_PIN
.
pin_mask
;
// turn on
HAL_Delay
(
30
);
HAL_StatusTypeDef
status
;
...
...
stmhal/boards/PYBV10/mpconfigboard.h
View file @
6f702839
...
...
@@ -86,3 +86,6 @@
// USB config
#define MICROPY_HW_USB_VBUS_DETECT_PIN (pin_A9)
#define MICROPY_HW_USB_OTG_ID_PIN (pin_A10)
// MMA accelerometer config
#define MICROPY_HW_MMA_AVDD_PIN (pin_B5)
stmhal/boards/PYBV3/mpconfigboard.h
View file @
6f702839
...
...
@@ -71,3 +71,6 @@
// USB VBUS detect pin
#define MICROPY_HW_USB_VBUS_DETECT_PIN (pin_A9)
// MMA accelerometer config
#define MICROPY_HW_MMA_AVDD_PIN (pin_B5)
stmhal/boards/PYBV4/mpconfigboard.h
View file @
6f702839
...
...
@@ -86,3 +86,6 @@
// USB config
#define MICROPY_HW_USB_VBUS_DETECT_PIN (pin_A9)
#define MICROPY_HW_USB_OTG_ID_PIN (pin_A10)
// MMA accelerometer config
#define MICROPY_HW_MMA_AVDD_PIN (pin_B5)
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment