Merge pull request #47 from aditihilbert/temp-tutorial

fixed missing link to BLE docs
diff --git a/docs/mynewt_faq.rst b/docs/mynewt_faq.rst
index c67bf89..129a57e 100644
--- a/docs/mynewt_faq.rst
+++ b/docs/mynewt_faq.rst
@@ -92,7 +92,7 @@
 Configuring Maximum Number of Connections for ``blehci``
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
-**Q**: How do I set the maximum number of connections for the example :doc:```blehci`` <../tutorials/ble/blehci_project>`? I see there is a ``MYNEWT_VAL_BLE_MAX_CONNECTIONS``, but I don't know how to set it.
+**Q**: How do I set the maximum number of connections for the ``blehci`` :doc:`example <../tutorials/ble/blehci_project>`? I see there is a ``MYNEWT_VAL_BLE_MAX_CONNECTIONS``, but I don't know how to set it.
 
 **A**:  You can to set it in target settings:
 
@@ -112,7 +112,16 @@
 
 **Q**: How do you know the constant is ``BLE_MAX_CONNECTIONS`` and not ``MYNEWT_VAL_BLE_MAX_CONNECTIONS``? Is there a place I can see those names?
 
-**A**: This is actually one of NimBLE’s settings - you can find these settings available for different packages in the ``syscfg.yml`` files in the repository. You can also use ``newt target config show <target>`` to show all settings with their current values, and then change any of these settings accordingly. Each setting will get a symbol prefixed by ``MYNEWT_VAL_`` in the autogenerated `syscfg.h` file so you can get the actual setting name from this symbol. For more info on System Configuration and Initialization, please visit the :doc:`Compile-Time Configuration and Initialization <../../../os/modules/sysinitconfig/sysinitconfig.rst>` page in the OS User Guide.
+**A**: This is actually one of NimBLE’s settings - you can find these settings available for different packages in the ``syscfg.yml`` files in the repository. You can also use ``newt target config show <target>`` to show all settings with their current values, and then change any of these settings accordingly. Each setting will get a symbol prefixed by ``MYNEWT_VAL_`` in the autogenerated ``syscfg.h`` file so you can get the actual setting name from this symbol. For more info on System Configuration and Initialization, please visit the :doc:`Compile-Time Configuration and Initialization <../../../os/modules/sysinitconfig/sysinitconfig.rst>` page in the OS User Guide.
+
+Disconnect/Crash While Writing Analog Value From Central Module
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+**Q**: I’m trying to write analog sensor data from my central module to my peripheral module. I can receive the values from the ADC callback perfectly, but I’m not able to write them to the peripheral module. The peripheral module disconnects right when the ``ble_gattc_write_flat`` command is called. What could be causing the issue?
+
+**A**: First, check the reason for the disconnect. The gap event callback should indicate the reason in ``disconnect.reason``. If the code never reaches the disconnect callback, then the code most likely crashed. If so, check whether ``ble_gattc_write_flat`` is called from an interrupt context. Calling into the BLE host from within an interrupt is a bad idea in general, and may cause a crash to occur because the Bluetooth host attempts to log to the console during the write procedure. Logging to the console uses quite a bit of stack space, so it is likely that the interrupt stack is overflowing. 
+
+Instead, you should send an event to the event queue and handle this in a task context. You’ll need to associate the characteristic data with the event so that your event callback knows what payload to pass to the ``ble_gattc_write_flat()`` function. If you don’t need to perform multiple writes in rapid succession, then you can just use a single global event and single global buffer. However, you will still need to make sure your buffer doesn’t become corrupted by a subsequent ADC interrupt while you are in mid-write. 
+
 
 Bootloader and Firmware Upgrade
 -------------------------------
@@ -255,7 +264,7 @@
 
 **Q**: What is ``mfghash``? How do I set ``serial`` and ``mfghash`` (currently blank in my app)?
 
-**A**: ``mfghash`` is computed if you’re using ``newt mfg`` to construct your flash image, and it identifies the build of your bootloader. ``newt mfg`` bundles togetherthe bootloader, target image, and other data you’d want to bundle when creating an image to burn to flash. See the :doc:```newt mfg`` documentation<../../../command_list/newt_mfg>` for the construction side of things and ``apache-mynewt-core/sys/mfg/src/mfg.c`` for the firmware side. ``serial`` was intended to be used if you want to have your own naming scheme per device when building products; i.e. you want something other than the mcu serial number, or if you don’t have serial number available.
+**A**: ``mfghash`` is computed if you’re using ``newt mfg`` to construct your flash image, and it identifies the build of your bootloader. ``newt mfg`` bundles togetherthe bootloader, target image, and other data you’d want to bundle when creating an image to burn to flash. See the ``newt mfg`` :doc:`documentation<../../../command_list/newt_mfg>` for the construction side of things and ``apache-mynewt-core/sys/mfg/src/mfg.c`` for the firmware side. ``serial`` was intended to be used if you want to have your own naming scheme per device when building products; i.e. you want something other than the mcu serial number, or if you don’t have serial number available.
 
 Leading Zeros Format in ``printf``
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@@ -343,7 +352,7 @@
 
 **Q**: I’m trying to use gdb with Trace, but do not know how to enable it. How do I do this in Mynewt?
 
-**A**: To enable Trace, you can add cflags to pkg.yml in your target directory: 
+**A**: To enable Trace, you can add ``cflags`` to ``pkg.yml`` in your target directory: 
 
 .. code-block:: console
 
@@ -357,6 +366,16 @@

     pkg.cflags:
       - -DENABLE_TRACE
+      
+Version Control Applications with Git 
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+**Q**: What's the recommended way to work with git when you want to version control your application? As ``apache-mynewt-core`` is already a repository, there is a repo in repo problem. Are there any good alternatives/tools to submodules, mirror, etc? Ideally, I want to version control everything from the top level project directory as well as upgrading apache-mynewt-core, pushing pull requests back to Mynewt if needed, etc.
+
+**A**: You can simply have a separate git for your app. For example, if you followed the Blinky tutorial, your git would be in ``apps/foo``, while repos gits are in repos. You may also keep your app in the core repo, just have your own working branch for it. 
+
+Another option is to have your git repository with local packages (including apps) and have ``repository.yml`` there so ``newt install`` can download all dependencies. Just make sure to put e.g. ``bin``, ``repos``, and ``project.state``, and others in ``.gitignore`` so they are not in version control. 
+
 
 Alternatives to ``cmsis_nvic.c``
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
diff --git a/docs/tutorials/sensors/sensor_nrf52_drv2605.rst b/docs/tutorials/sensors/sensor_nrf52_drv2605.rst
index b02e06d..a07e8fb 100644
--- a/docs/tutorials/sensors/sensor_nrf52_drv2605.rst
+++ b/docs/tutorials/sensors/sensor_nrf52_drv2605.rst
@@ -165,8 +165,8 @@
 Theres a lot more setup numbers you could enter here for the DRV2605 to figure out
 how to actuate your motor, but some of them it can figure out itself through auto calibration.
 Lets run autocalibration and then dump the fresh calibration numbers:
-.. code-block:: console
 
+.. code-block:: console
 
     001407 compat> drv2605 op_mode cal
     drv2605 op_mode cal
@@ -185,8 +185,8 @@
 Now you're ready to (sigh) rumble. One way to use the DRV2605 device is to enable
 the ROM mode to use its stored patterns. Technically you dont need to do this after
 first configure as ROM mode is the default mode:
-.. code-block:: console
 
+.. code-block:: console
 
     021773 compat> drv2605 op_mode rom
     drv2605 op_mode rom
@@ -195,30 +195,29 @@
 Now you can load up to 8 internal roms or delays. In this case we'll use four hard
 clicks (1) with max delays (255) in between. You may only have to do this once per
 boot if you wanted to use this same sequence every time you trigger the DRV2605 device.
-.. code-block:: console
 
+.. code-block:: console
 
     120858 compat> drv2605 load 1 255 1 255 1 255 1 255
     drv2605 load 1 255 1 255 1 255 1 255
     122555 Load succeeded
 
 The motor is in standby by default after a mode change, so enable it:
-.. code-block:: console
 
+.. code-block:: console
 
     002111 compat> drv2605 power_mode active
     drv2605 power_mode active
     003263 power_mode succeeded
 
 Now you can trigger those forms as many times as you want or load new forms and trigger again:
-.. code-block:: console
 
+.. code-block:: console
 
     122555 compat> drv2605 trigger
     drv2605 trigger
     128806 Trigger succeeded
 
-
 Conclusion
 ~~~~~~~~~~