From 230716242471cd7f8663c056be594bdc69f01287 Mon Sep 17 00:00:00 2001 From: deadprogram Date: Thu, 15 Jun 2017 20:07:25 +0200 Subject: [PATCH] curie: a few docs improvements Signed-off-by: deadprogram --- platforms/intel-iot/curie/README.md | 8 ++++---- platforms/intel-iot/curie/imu_driver.go | 11 ++++++++--- 2 files changed, 12 insertions(+), 7 deletions(-) diff --git a/platforms/intel-iot/curie/README.md b/platforms/intel-iot/curie/README.md index f5b0e381..ca128139 100644 --- a/platforms/intel-iot/curie/README.md +++ b/platforms/intel-iot/curie/README.md @@ -83,13 +83,13 @@ To setup your Arduino environment: - Download the ZIP file for the ConfigurableFirmata library. You can download the latest version of the ConfigurableFirmata from here: - https://github.com/firmata/ConfigurableFirmata/archive/master.zip + [https://github.com/firmata/ConfigurableFirmata/archive/master.zip](https://github.com/firmata/ConfigurableFirmata/archive/master.zip) Once you have downloaded ConfigurableFirmata, install it by using the "Library Manager". You can find it in the Arduino IDE under the "Sketch" menu. Choose "Include Library > Add .ZIP Library". Select the ZIP file for the ConfigurableFirmata library that you just downloaded. - Download the ZIP file for the FirmataCurieIMU library. You can download the latest version of FirmataCurieIMU from here: - https://github.com/intel-iot-devkit/firmata-curie-imu/archive/master.zip + [https://github.com/intel-iot-devkit/firmata-curie-imu/archive/master.zip](https://github.com/intel-iot-devkit/firmata-curie-imu/archive/master.zip) Once you have downloaded the FirmataCurieIMU library, install it by using the "Library Manager". You can find it in the Arduino IDE under the "Sketch" menu. Choose "Include Library > Add .ZIP Library". Select the ZIP file for the FirmataCurieIMU library that you just downloaded. @@ -99,7 +99,7 @@ Now you are ready to install your firmware. You must decide if you want to conne To use your Intel Curie connected via serial port, you should use the sketch located here: -https://github.com/intel-iot-devkit/firmata-curie-imu/blob/master/examples/everythingIMU/everythingIMU.ino +[https://github.com/intel-iot-devkit/firmata-curie-imu/blob/master/examples/everythingIMU/everythingIMU.ino](https://github.com/intel-iot-devkit/firmata-curie-imu/blob/master/examples/everythingIMU/everythingIMU.ino) Once you have loaded this sketch on your Intel Curie, you can run your Gobot code to communicate with it. Leave your Arduino 101 or TinyTILE connected using the serial cable that you used to flash the firmware, and refer to that same serial port name in your Gobot code. @@ -107,7 +107,7 @@ Once you have loaded this sketch on your Intel Curie, you can run your Gobot cod To use your Intel Curie connected via Bluetooth LE, you should use the sketch located here: -https://github.com/intel-iot-devkit/firmata-curie-imu/blob/master/examples/bleIMU/bleIMU.ino +[https://github.com/intel-iot-devkit/firmata-curie-imu/blob/master/examples/bleIMU/bleIMU.ino](https://github.com/intel-iot-devkit/firmata-curie-imu/blob/master/examples/bleIMU/bleIMU.ino) Once you have loaded this sketch on your Intel Curie, you can run your Gobot code to communicate with it. diff --git a/platforms/intel-iot/curie/imu_driver.go b/platforms/intel-iot/curie/imu_driver.go index 8abe040c..7ce86abb 100644 --- a/platforms/intel-iot/curie/imu_driver.go +++ b/platforms/intel-iot/curie/imu_driver.go @@ -18,28 +18,33 @@ const ( CURIE_IMU_READ_MOTION = 0x06 ) +// AccelerometerData is what gets returned with the "Accelerometer" event. type AccelerometerData struct { X int16 Y int16 Z int16 } +// GyroscopeData is what gets returned with the "Gyroscope" event. type GyroscopeData struct { X int16 Y int16 Z int16 } +// ShockData is what gets returned with the "Shock" event. type ShockData struct { Axis byte Direction byte } +// TapData is what gets returned with the "Tap" event. type TapData struct { Axis byte Direction byte } +// MotionData is what gets returned with the "Motion" event. type MotionData struct { AX int16 AY int16 @@ -52,12 +57,12 @@ type MotionData struct { // IMUDriver represents the IMU that is built-in to the Curie type IMUDriver struct { name string - connection firmata.FirmataAdaptor + connection *firmata.Adaptor gobot.Eventer } // NewIMUDriver returns a new IMUDriver -func NewIMUDriver(a firmata.FirmataAdaptor) *IMUDriver { +func NewIMUDriver(a *firmata.Adaptor) *IMUDriver { imu := &IMUDriver{ name: gobot.DefaultName("CurieIMU"), connection: a, @@ -184,7 +189,7 @@ func (imu *IMUDriver) handleEvent(data []byte) (err error) { } } } - return + } func parseAccelerometerData(data []byte) (*AccelerometerData, error) {