-
Notifications
You must be signed in to change notification settings - Fork 62
[Sensor] Added support for trigger mode #453
Conversation
7e59fbd to
9dba6bb
Compare
Added trigger support, since currently in Zephyr, triggers can only be signaledfrom interrupt from x86 side, all the x86 side code is wrapped with BUILD_MODULE_SENSOR_TRIGGER #ifdef so that it can be turn off later when Zephyr changes. The trigger are set to sample in 50Hz, any higher frequency will cause the ring buffer to start dropping change events. Signed-off-by: Jimmy Huang <jimmy.huang@intel.com>
9dba6bb to
35bda8e
Compare
arc/src/main.c
Outdated
|
|
||
| if (sensor_channel_get(dev, SENSOR_CHAN_GYRO_ANY, val) < 0) { | ||
| ZJS_PRINT("Cannot read gyroscope channels.\n"); | ||
| ZJS_PRINT("failed to read gyroscope channels.\n"); |
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.
remove period for consistency i guess?
arc/src/main.c
Outdated
| sensor_value_snprintf(buf_y, sizeof(buf_y), &val[1]); | ||
| sensor_value_snprintf(buf_z, sizeof(buf_z), &val[2]); | ||
| ZJS_PRINT("Sending gyro : X=%s, Y=%s, Z=%s\n", buf_x, buf_y, buf_z); | ||
| ZJS_PRINT("sending gyro : X=%s, Y=%s, Z=%s\n", buf_x, buf_y, buf_z); |
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.
let's remove the space before the : like good Americans
arc/src/main.c
Outdated
| ZJS_PRINT("failed to initialize BMI160 sensor\n"); | ||
| } else { | ||
| if (!auto_calibration(bmi160)) { | ||
| if (auto_calibration(bmi160) != 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.
You don't really need the != 0, but that's just my personal preferred style, not going to enforce it. :)
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.
ok
scripts/analyze.sh
Outdated
| echo "CONFIG_GPIO_QMSI_1_PRI=2" >> prj.conf.tmp | ||
| echo "CONFIG_SPI=y" >> arc/prj.conf.tmp | ||
| echo "CONFIG_SPI_DW_ARC_AUX_REGS=y" >> arc/prj.conf.tmp | ||
| echo "CONFIG_SPI_DW_INTERRUPT_SEPARATED_LINES=y" >> arc/prj.conf.tmp |
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.
This GPIO and SPI here is specific to the Arduino 101 hardware, we'd eventually need to make that dependent on architecture.
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.
Do the same thing I did for UART:
if [ $BOARD = "arduino_101" ]; then
This is precisely the reason I changed the script to pass in BOARD from the Makefile.
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.
ok, sounds good
Signed-off-by: Jimmy Huang <jimmy.huang@intel.com>
9a16373 to
f6f50f2
Compare
|
+1 |
Added trigger support, since currently in Zephyr, triggers can
only be signaledfrom interrupt from x86 side, all the x86 side
code is wrapped with BUILD_MODULE_SENSOR_TRIGGER #ifdef so that
it can be turn off later when Zephyr changes.
The trigger are set to sample in 50Hz, any higher frequency
will cause the ring buffer to start dropping change events.
Signed-off-by: Jimmy Huang jimmy.huang@intel.com