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
hw/bsp/dwm1001-dev Add LIS2DH12 accelerometer support #2639
Conversation
Sounds like you need to look at the module's (DWM1001, not DWM1001-dev) schematic there you should find all the pinout info. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Minor style (extra spaces and line) changes would be nice.
restriction should be changed to allow turning sensor on and off.
|
||
dev = (struct os_dev *) os_dev_open("lis2dh12_0", OS_TIMEOUT_NEVER, NULL); | ||
assert(dev != NULL); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
extra empty line
struct os_dev *dev; | ||
struct lis2dh12_cfg cfg; | ||
|
||
dev = (struct os_dev *) os_dev_open("lis2dh12_0", OS_TIMEOUT_NEVER, NULL); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
in mynewt code it is custom not to put space after finishing ) in casts like this
dev = (struct os_dev *)os_dev_open(....
(void)rc; | ||
|
||
#if MYNEWT_VAL(LIS2DH12_ONB) | ||
rc = os_dev_create((struct os_dev *) &lis2dh12, "lis2dh12_0", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
extra space after cast expression
syscfg.restrictions: | ||
- "LIS2DH12_ONB && I2C_0_PIN_SCL == 28 && I2C_0_PIN_SDA == 29" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if it was:
syscfg.restrictions:
- "!LIS2DH12_ONB || (I2C_0 == 1 && I2C_0_PIN_SCL == 28 && I2C_0_PIN_SDA == 29)"
sensor could be turned on and off as syscfg value implies it could.
notice extra I2C_0 == 1
that is also needed I guess
{ /* TODO: determine correct values */ | ||
.host_pin = 25, | ||
.device_pin = 0, | ||
.active = true | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would remove this second table entry, first one seems to be correct
pkg.deps.LIS2DH12_ONB: | ||
- "@apache-mynewt-core/hw/drivers/sensors/lis2dh12" | ||
|
||
pkg.init: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if it was changed to:
pkg.init.LIS2DH12_ONB:
whole config_lis2dh12_sensor() function could be ifdef'ed-out not just its body
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fist line of commit message would also be more consistent with what is used in mynewt if it looked like text that was chosen for PR title:
hw/bsp/dwm1001-dev: Add LIS2DH12 accelerometer support
instead of "Add LIS2DH12 accelerometer support for DWM1001-dev boards"
Sorry, I don't have access to the hardware anymore, so I can't continue on this with testing. |
Hey guys,
thanks for this awesome piece of software!
This PR is an attempt at adding support for the LIS2DH12 accelerometer sensor, which is integrated with DWM1001-DEV boards.
I'm fairly new to mynewt, so this PR is more like a shot in the dark, and mostly copied from other BSPs with the same accelerometer.
The
sensor_itf.si_ints
values are chosen, such that it does not crash - which does not mean that it's working ;). Would be good if somebody with more hardware knowledge could take a look at them (the.active = true
certainly isn't true, this should be something likeHAL_GPIO_TRIG_RISING
orHAL_GPIO_TRIG_FALLING
).Here is an example application: