Mouse code for the MacroRat

Dependencies:   ITG3200 QEI

Committer:
sahilmgandhi
Date:
Sat Jun 03 00:22:44 2017 +0000
Revision:
46:b156ef445742
Parent:
18:6a4db94011d3
Final code for internal battlebot competition.

Who changed what in which revision?

UserRevisionLine numberNew contents of line
sahilmgandhi 18:6a4db94011d3 1
sahilmgandhi 18:6a4db94011d3 2 # LF Clock configuration using mbed configuration system
sahilmgandhi 18:6a4db94011d3 3
sahilmgandhi 18:6a4db94011d3 4 In order to provide the configuration for a low frequency (LF) clock, add a description of the LF clock inside a mbed configuration JSON file.
sahilmgandhi 18:6a4db94011d3 5 For example at application level the description might be added in a mbed_app.json file and on target level the description might be added in the hal/target.json file.
sahilmgandhi 18:6a4db94011d3 6 LF clock source configuration is used for MCU startup initialization and the BLE SoftDevice LF clock configuration (if BLE libraries is used). Advanced configurations are used only for the BLE SoftDevice LF clock configuration.
sahilmgandhi 18:6a4db94011d3 7
sahilmgandhi 18:6a4db94011d3 8
sahilmgandhi 18:6a4db94011d3 9 ## Usage:
sahilmgandhi 18:6a4db94011d3 10
sahilmgandhi 18:6a4db94011d3 11 1. Clock source
sahilmgandhi 18:6a4db94011d3 12
sahilmgandhi 18:6a4db94011d3 13 Default clock source is XTAL oscillator. It is defined at the target level configuration as the target.lf_clock_src key.
sahilmgandhi 18:6a4db94011d3 14 There are three options that can be configured as the clock source:
sahilmgandhi 18:6a4db94011d3 15 - NRF_LF_SRC_XTAL
sahilmgandhi 18:6a4db94011d3 16 - NRF_LF_SRC_RC
sahilmgandhi 18:6a4db94011d3 17 - NRF_LF_SRC_SYNTH
sahilmgandhi 18:6a4db94011d3 18
sahilmgandhi 18:6a4db94011d3 19 In order to override this configuration use targed_override section in configuration file (e.g mbed_app.json)
sahilmgandhi 18:6a4db94011d3 20
sahilmgandhi 18:6a4db94011d3 21 ```json
sahilmgandhi 18:6a4db94011d3 22 {
sahilmgandhi 18:6a4db94011d3 23 "target_overrides": {
sahilmgandhi 18:6a4db94011d3 24 "*": {
sahilmgandhi 18:6a4db94011d3 25 "target.lf_clock_src": "NRF_LF_SRC_XTAL"
sahilmgandhi 18:6a4db94011d3 26 }
sahilmgandhi 18:6a4db94011d3 27 }
sahilmgandhi 18:6a4db94011d3 28 }
sahilmgandhi 18:6a4db94011d3 29 ```
sahilmgandhi 18:6a4db94011d3 30
sahilmgandhi 18:6a4db94011d3 31 2a. Advanced configuration of the LFCLK RC oscillator:
sahilmgandhi 18:6a4db94011d3 32
sahilmgandhi 18:6a4db94011d3 33 ```json
sahilmgandhi 18:6a4db94011d3 34 {
sahilmgandhi 18:6a4db94011d3 35 "config": {
sahilmgandhi 18:6a4db94011d3 36 "lf_clock_rc_calib_timer_interval": {
sahilmgandhi 18:6a4db94011d3 37 "value": 16,
sahilmgandhi 18:6a4db94011d3 38 "macro_name": "MBED_CONF_NORDIC_NRF_LF_CLOCK_CALIB_TIMER_INTERVAL"
sahilmgandhi 18:6a4db94011d3 39 },
sahilmgandhi 18:6a4db94011d3 40 "lf_clock_rc_calib_mode_config": {
sahilmgandhi 18:6a4db94011d3 41 "value": 1,
sahilmgandhi 18:6a4db94011d3 42 "macro_name": "MBED_CONF_NORDIC_NRF_LF_CLOCK_CALIB_MODE_CONFIG"
sahilmgandhi 18:6a4db94011d3 43 }
sahilmgandhi 18:6a4db94011d3 44 }
sahilmgandhi 18:6a4db94011d3 45 }
sahilmgandhi 18:6a4db94011d3 46
sahilmgandhi 18:6a4db94011d3 47 ```
sahilmgandhi 18:6a4db94011d3 48
sahilmgandhi 18:6a4db94011d3 49 "lf_clock_rc_calib_timer_interval" - Calibration timer interval in 250 ms. It is equivalent to nrf_clock_lf_cfg_t::rc_ctiv.
sahilmgandhi 18:6a4db94011d3 50 This item generates macro MBED_CONF_NORDIC_NRF_LF_CLOCK_CALIB_TIMER_INTERVAL.
sahilmgandhi 18:6a4db94011d3 51 By default, such configuration is set to 16.
sahilmgandhi 18:6a4db94011d3 52
sahilmgandhi 18:6a4db94011d3 53 "lf_clock_rc_calib_mode_config" - This value configures how often the RC oscillator will be calibrated, in number of calibration intervals.
sahilmgandhi 18:6a4db94011d3 54 It is equivalent to nrf_clock_lf_cfg_t::rc_temp_ctiv.
sahilmgandhi 18:6a4db94011d3 55 For further information, see the documentation for the [API of a SoftDevice 13x version 2.0.0](http://infocenter.nordicsemi.com/topic/com.nordic.infocenter.s132.api.v2.0.0/structnrf__clock__lf__cfg__t.html)
sahilmgandhi 18:6a4db94011d3 56 This item generates macro MBED_CONF_NORDIC_NRF_LF_CLOCK_CALIB_MODE_CONFIG.
sahilmgandhi 18:6a4db94011d3 57 By default, such configuration is set to 1.
sahilmgandhi 18:6a4db94011d3 58
sahilmgandhi 18:6a4db94011d3 59 2b. Advanced configuration of the LFCLK XTAL oscillator:
sahilmgandhi 18:6a4db94011d3 60
sahilmgandhi 18:6a4db94011d3 61 Accuracy of the clock source can be set. In order to do so macro MBED_CONF_NORDIC_LF_CLOCK_XTAL_ACCURACY should been provided (e.g. in mbed_app.json).
sahilmgandhi 18:6a4db94011d3 62 By default such configuration is set to NRF_CLOCK_LF_XTAL_ACCURACY_20_PPM.
sahilmgandhi 18:6a4db94011d3 63 For further information, see the documentation for the [API of a SoftDevice 13x version 2.0.0](https://infocenter.nordicsemi.com/index.jsp?topic=%2Fcom.nordic.infocenter.s132.api.v2.0.0%2Fgroup___n_r_f___s_d_m___d_e_f_i_n_e_s.html)
sahilmgandhi 18:6a4db94011d3 64
sahilmgandhi 18:6a4db94011d3 65 ```json
sahilmgandhi 18:6a4db94011d3 66 {
sahilmgandhi 18:6a4db94011d3 67 "config": {
sahilmgandhi 18:6a4db94011d3 68 "lf_clock_xtal_accuracy": {
sahilmgandhi 18:6a4db94011d3 69 "value": "NRF_CLOCK_LF_XTAL_ACCURACY_250_PPM",
sahilmgandhi 18:6a4db94011d3 70 "macro_name": "MBED_CONF_NORDIC_LF_CLOCK_XTAL_ACCURACY"
sahilmgandhi 18:6a4db94011d3 71 }
sahilmgandhi 18:6a4db94011d3 72 }
sahilmgandhi 18:6a4db94011d3 73 }
sahilmgandhi 18:6a4db94011d3 74
sahilmgandhi 18:6a4db94011d3 75 ```
sahilmgandhi 18:6a4db94011d3 76
sahilmgandhi 18:6a4db94011d3 77
sahilmgandhi 18:6a4db94011d3 78
sahilmgandhi 18:6a4db94011d3 79 2c. Advance configuration of the LFCLK Synthesized from HFCLK:
sahilmgandhi 18:6a4db94011d3 80
sahilmgandhi 18:6a4db94011d3 81 Accuracy of the clock source can be set. In order to do so macro MBED_CONF_NORDIC_LF_CLOCK_SYNTH_ACCURACY should been provided (e.g. in mbed_app.json).
sahilmgandhi 18:6a4db94011d3 82 By default, such configuration is set to NRF_CLOCK_LF_XTAL_ACCURACY_20_PPM.
sahilmgandhi 18:6a4db94011d3 83 For further information, see the documentation for the [API of a SoftDevice 13x version 2.0.0](https://infocenter.nordicsemi.com/index.jsp?topic=%2Fcom.nordic.infocenter.s132.api.v2.0.0%2Fgroup___n_r_f___s_d_m___d_e_f_i_n_e_s.html)
sahilmgandhi 18:6a4db94011d3 84
sahilmgandhi 18:6a4db94011d3 85 ```json
sahilmgandhi 18:6a4db94011d3 86 {
sahilmgandhi 18:6a4db94011d3 87 "config": {
sahilmgandhi 18:6a4db94011d3 88 "lf_clock_synth_accuracy": {
sahilmgandhi 18:6a4db94011d3 89 "value": "NRF_CLOCK_LF_SYNTH_ACCURACY_250_PPM",
sahilmgandhi 18:6a4db94011d3 90 "macro_name": "MBED_CONF_NORDIC_LF_CLOCK_XTAL_ACCURACY"
sahilmgandhi 18:6a4db94011d3 91 }
sahilmgandhi 18:6a4db94011d3 92 }
sahilmgandhi 18:6a4db94011d3 93 }
sahilmgandhi 18:6a4db94011d3 94
sahilmgandhi 18:6a4db94011d3 95 ```
sahilmgandhi 18:6a4db94011d3 96
sahilmgandhi 18:6a4db94011d3 97