albsod / pinetime-hypnos

Zephyr firmware for the nRF52832 PineTime smartwatch
Apache License 2.0
72 stars 21 forks source link

[feature] BMA421 integration #48

Open sdorre opened 4 years ago

sdorre commented 4 years ago

The Pinetime has an accelerometer integrated. Let's try to get it to work.

The hardware is a Bosch BMA421. One guy already has it working with Micro Python on the pinetime. He wrote the following code: https://github.com/daniel-thompson/bma42x-upy

endian-albin commented 4 years ago

As long as the implemention is all free software, then yeah!

sdorre commented 4 years ago

I pushed a branch if you want to have a look at the alpha. I did not get the chance to see other than 0 for the step counter so far. I broke my debug setup. I will fix it on monday.

endian-albin commented 4 years ago

This looks really promising! The step counter appears to be accurate from a very short test. I'm a bit suspicious about the thermometer though. I don't think it exists in the BMA421 component that's on the PineTime, see the flyer for example). Also, I went outside where it's more than 10 degrees colder right now and the temperature dropped just one degree.

endian-albin commented 4 years ago

Ah, so the thermometer is for the accelerometer chip itself... It shouldn't be used to measure the outside temperature.

sdorre commented 4 years ago

I made some changes on my PR. It is now running on interrupt without the config blob. So only acceleration data is accessible.

@endian-albin Do you want me to rewrite it so we get rid of the BSD-3 Code from Bosch ?

endian-albin commented 4 years ago

I made some changes on my PR. It is now running on interrupt without the config blob. So only acceleration data is accessible.

OK, can you think of a use case for this? Even if this is good for the future, I prefer to have at least some new feature that makes use of added code. Could we use it combined with a repeatable timer (80--100 ms) that checks the XYZ values for a position where a human might look at it and then light up the display ("lift to wake")?

@endian-albin Do you want me to rewrite it so we get rid of the BSD-3 Code from Bosch ?

If you think you can also make it smaller, better, etc and you do a proper rewrite like ATCWatch did. That might also make it easier to upstream. Otherwise, BSD-3-Claue is compatible with Apache 2.0 so you could also simply add a copyright line and Apache 2.0 SPDX line on top of the BSD-3 header text. Then you should also add a BSD-3-Clause SPDX line close to the Bosch copyright line, maybe just above it.