/
11111
1
Fork of nRF51822 by
common/ansi_escape.h@58:de6b64cd7f21, 2014-09-02 (annotated)
- Committer:
- Rohit Grover
- Date:
- Tue Sep 02 16:15:26 2014 +0100
- Revision:
- 58:de6b64cd7f21
- Parent:
- 0:eff01767de02
Release 0.1.0
=============
We've achieved significant gains in power consumption: the BLE_Beacon demo now
runs at around 35uA of average current broadcasting once a second at 0dB; when
not using the radio, this demo consumes around 7uA.
Features
~~~~~~~~
- Replace initialization of high-frequency external crystal clock-source with
the use of low-frequency clock. This brings in significant gains in power
consumption.
- Re-implement the micro-second timer on nRF51 using the app_timer module
(which internally uses RTC). This limits the precision of the us_Timer to
30uS; but brings in significant gains in power consumption.
- Reduce the number of available app_timers and the event depths for app-timer
events; this will reduce memory consumption for zero-initialized data by
around 1K.i
- Remove the call to conn_params_init() at startup. This is not mandatory; and
was causing an unnecessary re-negotiation of connection parameters a few
seconds into every connection.
- Reduce default transmission power level to 0dbB (was 4dbB before).
- Reduce min connection interval to 50ms and max to 500ms (previous values
were much larger).
- Replace a few instances of use of wait() with nrf_delay_us().
- onConnection() callback now receives connection-parameters applicable to the
new connection.
- onDataSent() callback now receives a count parameter containing the number of
times notifications were sent out since the last callback.
- A 'reason' parameter has been added to Gap::disconnect() to indicate the
reason for disconnection; and also to the onDisconnection callback to
receive a reason from the remote host.
- disable the app_gpiote module by default.
Bugfixes
~~~~~~~~
- onDataWritten() callback now passes an additional parameter
(GattServer::WriteEventCallback_t) encapsulating the update. This avoids
having to re-fetch the updated characteristic's value attribute. It also
fixes a bug where multiple updates to the characteristic's value-attribute
could get clobbered if they occurred in quick succession before the
callbacks could be processed.
Compatibility
~~~~~~~~~~~~~
Compatible with revision 0.1.0 of the BLE_API.
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
bogdanm | 0:eff01767de02 | 1 | /**************************************************************************/ |
bogdanm | 0:eff01767de02 | 2 | /*! |
bogdanm | 0:eff01767de02 | 3 | @file ansi_esc_code.h |
bogdanm | 0:eff01767de02 | 4 | @author hathach (tinyusb.org) |
bogdanm | 0:eff01767de02 | 5 | |
bogdanm | 0:eff01767de02 | 6 | @section LICENSE |
bogdanm | 0:eff01767de02 | 7 | |
bogdanm | 0:eff01767de02 | 8 | Software License Agreement (BSD License) |
bogdanm | 0:eff01767de02 | 9 | |
bogdanm | 0:eff01767de02 | 10 | Copyright (c) 2013, hathach (tinyusb.org) |
bogdanm | 0:eff01767de02 | 11 | All rights reserved. |
bogdanm | 0:eff01767de02 | 12 | |
bogdanm | 0:eff01767de02 | 13 | Redistribution and use in source and binary forms, with or without |
bogdanm | 0:eff01767de02 | 14 | modification, are permitted provided that the following conditions are met: |
bogdanm | 0:eff01767de02 | 15 | 1. Redistributions of source code must retain the above copyright |
bogdanm | 0:eff01767de02 | 16 | notice, this list of conditions and the following disclaimer. |
bogdanm | 0:eff01767de02 | 17 | 2. Redistributions in binary form must reproduce the above copyright |
bogdanm | 0:eff01767de02 | 18 | notice, this list of conditions and the following disclaimer in the |
bogdanm | 0:eff01767de02 | 19 | documentation and/or other materials provided with the distribution. |
bogdanm | 0:eff01767de02 | 20 | 3. Neither the name of the copyright holders nor the |
bogdanm | 0:eff01767de02 | 21 | names of its contributors may be used to endorse or promote products |
bogdanm | 0:eff01767de02 | 22 | derived from this software without specific prior written permission. |
bogdanm | 0:eff01767de02 | 23 | |
bogdanm | 0:eff01767de02 | 24 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY |
bogdanm | 0:eff01767de02 | 25 | EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED |
bogdanm | 0:eff01767de02 | 26 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
bogdanm | 0:eff01767de02 | 27 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR ANY |
bogdanm | 0:eff01767de02 | 28 | DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES |
bogdanm | 0:eff01767de02 | 29 | INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; |
bogdanm | 0:eff01767de02 | 30 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION HOWEVER CAUSED AND |
bogdanm | 0:eff01767de02 | 31 | ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
bogdanm | 0:eff01767de02 | 32 | INCLUDING NEGLIGENCE OR OTHERWISE ARISING IN ANY WAY OUT OF THE USE OF THIS |
bogdanm | 0:eff01767de02 | 33 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
bogdanm | 0:eff01767de02 | 34 | |
bogdanm | 0:eff01767de02 | 35 | This file is part of the tinyusb stack. |
bogdanm | 0:eff01767de02 | 36 | */ |
bogdanm | 0:eff01767de02 | 37 | /**************************************************************************/ |
bogdanm | 0:eff01767de02 | 38 | |
bogdanm | 0:eff01767de02 | 39 | /** \file |
bogdanm | 0:eff01767de02 | 40 | * \brief TBD |
bogdanm | 0:eff01767de02 | 41 | * |
bogdanm | 0:eff01767de02 | 42 | * \note TBD |
bogdanm | 0:eff01767de02 | 43 | */ |
bogdanm | 0:eff01767de02 | 44 | |
bogdanm | 0:eff01767de02 | 45 | /** \ingroup TBD |
bogdanm | 0:eff01767de02 | 46 | * \defgroup TBD |
bogdanm | 0:eff01767de02 | 47 | * \brief TBD |
bogdanm | 0:eff01767de02 | 48 | * |
bogdanm | 0:eff01767de02 | 49 | * @{ |
bogdanm | 0:eff01767de02 | 50 | */ |
bogdanm | 0:eff01767de02 | 51 | |
bogdanm | 0:eff01767de02 | 52 | #ifndef _ANSI_ESC_CODE_H_ |
bogdanm | 0:eff01767de02 | 53 | #define _ANSI_ESC_CODE_H_ |
bogdanm | 0:eff01767de02 | 54 | |
bogdanm | 0:eff01767de02 | 55 | |
bogdanm | 0:eff01767de02 | 56 | #ifdef __cplusplus |
Rohit Grover |
58:de6b64cd7f21 | 57 | extern "C" { |
bogdanm | 0:eff01767de02 | 58 | #endif |
bogdanm | 0:eff01767de02 | 59 | |
bogdanm | 0:eff01767de02 | 60 | #define CSI_CODE(seq) "\33[" seq |
bogdanm | 0:eff01767de02 | 61 | #define CSI_SGR(x) CSI_CODE(#x) "m" |
bogdanm | 0:eff01767de02 | 62 | |
bogdanm | 0:eff01767de02 | 63 | //------------- Cursor movement -------------// |
bogdanm | 0:eff01767de02 | 64 | #define ANSI_CURSOR_UP(n) CSI_CODE(#n "A") |
bogdanm | 0:eff01767de02 | 65 | #define ANSI_CURSOR_DOWN(n) CSI_CODE(#n "B") |
bogdanm | 0:eff01767de02 | 66 | #define ANSI_CURSOR_FORWARD(n) CSI_CODE(#n "C") |
bogdanm | 0:eff01767de02 | 67 | #define ANSI_CURSOR_BACKWARD(n) CSI_CODE(#n "D") |
bogdanm | 0:eff01767de02 | 68 | #define ANSI_CURSOR_LINE_DOWN(n) CSI_CODE(#n "E") |
bogdanm | 0:eff01767de02 | 69 | #define ANSI_CURSOR_LINE_UP(n) CSI_CODE(#n "F") |
bogdanm | 0:eff01767de02 | 70 | #define ANSI_CURSOR_POSITION(n, m) CSI_CODE(#n ";" #m "H") |
bogdanm | 0:eff01767de02 | 71 | |
bogdanm | 0:eff01767de02 | 72 | #define ANSI_ERASE_SCREEN(n) CSI_CODE(#n "J") |
bogdanm | 0:eff01767de02 | 73 | #define ANSI_ERASE_LINE(n) CSI_CODE(#n "K") |
bogdanm | 0:eff01767de02 | 74 | |
bogdanm | 0:eff01767de02 | 75 | /** text color */ |
bogdanm | 0:eff01767de02 | 76 | #define ANSI_TEXT_BLACK CSI_SGR(30) |
bogdanm | 0:eff01767de02 | 77 | #define ANSI_TEXT_RED CSI_SGR(31) |
bogdanm | 0:eff01767de02 | 78 | #define ANSI_TEXT_GREEN CSI_SGR(32) |
bogdanm | 0:eff01767de02 | 79 | #define ANSI_TEXT_YELLOW CSI_SGR(33) |
bogdanm | 0:eff01767de02 | 80 | #define ANSI_TEXT_BLUE CSI_SGR(34) |
bogdanm | 0:eff01767de02 | 81 | #define ANSI_TEXT_MAGENTA CSI_SGR(35) |
bogdanm | 0:eff01767de02 | 82 | #define ANSI_TEXT_CYAN CSI_SGR(36) |
bogdanm | 0:eff01767de02 | 83 | #define ANSI_TEXT_WHITE CSI_SGR(37) |
bogdanm | 0:eff01767de02 | 84 | #define ANSI_TEXT_DEFAULT CSI_SGR(39) |
bogdanm | 0:eff01767de02 | 85 | |
bogdanm | 0:eff01767de02 | 86 | /** background color */ |
bogdanm | 0:eff01767de02 | 87 | #define ANSI_BG_BLACK CSI_SGR(40) |
bogdanm | 0:eff01767de02 | 88 | #define ANSI_BG_RED CSI_SGR(41) |
bogdanm | 0:eff01767de02 | 89 | #define ANSI_BG_GREEN CSI_SGR(42) |
bogdanm | 0:eff01767de02 | 90 | #define ANSI_BG_YELLOW CSI_SGR(43) |
bogdanm | 0:eff01767de02 | 91 | #define ANSI_BG_BLUE CSI_SGR(44) |
bogdanm | 0:eff01767de02 | 92 | #define ANSI_BG_MAGENTA CSI_SGR(45) |
bogdanm | 0:eff01767de02 | 93 | #define ANSI_BG_CYAN CSI_SGR(46) |
bogdanm | 0:eff01767de02 | 94 | #define ANSI_BG_WHITE CSI_SGR(47) |
bogdanm | 0:eff01767de02 | 95 | #define ANSI_BG_DEFAULT CSI_SGR(49) |
bogdanm | 0:eff01767de02 | 96 | |
bogdanm | 0:eff01767de02 | 97 | #ifdef __cplusplus |
Rohit Grover |
58:de6b64cd7f21 | 98 | } |
bogdanm | 0:eff01767de02 | 99 | #endif |
bogdanm | 0:eff01767de02 | 100 | |
bogdanm | 0:eff01767de02 | 101 | #endif /* _TUSB_ANSI_ESC_CODE_H_ */ |
bogdanm | 0:eff01767de02 | 102 | |
bogdanm | 0:eff01767de02 | 103 | /** @} */ |