-
Notifications
You must be signed in to change notification settings - Fork 28
doc: sdh: extend documentation #515
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
|
You can find the documentation preview for this PR here. |
02292f2 to
6df3bcb
Compare
Extend SoftDevice handler documentation. Signed-off-by: Emanuele Di Santo <[email protected]>
| Usage | ||
| ***** | ||
|
|
||
| The SoftDevice handler API can be used to declare observers, changing the SoftDevice state, and enabling the SoftDevice Bluetooth stack. |
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.
| The SoftDevice handler API can be used to declare observers, changing the SoftDevice state, and enabling the SoftDevice Bluetooth stack. | |
| You can use the SoftDevice handler API to declare observers, change the SoftDevice state, and enable the SoftDevice Bluetooth stack. |
| Declaring observers | ||
| =================== | ||
|
|
||
| You can declare an observer in any part of your application by using a macro and specifying an event handler function, an optional parameter and a priority. |
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 can declare an observer in any part of your application by using a macro and specifying an event handler function, an optional parameter and a priority. | |
| You can declare an observer in any part of your application by using a macro and specifying an event handler function, an optional parameter, and a priority. |
| * :c:enumerator:`NRF_SDH_STATE_EVT_ENABLED` - SoftDevice is enabled. | ||
| * :c:enumerator:`NRF_SDH_STATE_EVT_BLE_ENABLED` - Bluetooth is enabled. | ||
| * :c:enumerator:`NRF_SDH_STATE_EVT_DISABLE_PREPARE` - SoftDevice is going to be disabled. | ||
| * :c:enumerator:`NRF_SDH_STATE_EVT_DISABLED` - SoftDevice is disabled |
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.
| * :c:enumerator:`NRF_SDH_STATE_EVT_DISABLED` - SoftDevice is disabled | |
| * :c:enumerator:`NRF_SDH_STATE_EVT_DISABLED` - SoftDevice is disabled. |
|
|
||
| A state observer is declared using the :c:macro:`NRF_SDH_STATE_EVT_OBSERVER` macro. | ||
|
|
||
| The following snippet shows how to declare a state observer. |
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.
| The following snippet shows how to declare a state observer. | |
| The following snippet shows how to declare a state observer: |
|
|
||
| A Bluetooth observer is declared using the :c:macro:`NRF_SDH_BLE_OBSERVER` macro. | ||
|
|
||
| The following snippet shows how to declare a Bluetooth observer. |
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.
| The following snippet shows how to declare a Bluetooth observer. | |
| The following snippet shows how to declare a Bluetooth observer: |
| The observers can return ``0`` from the event handler to let the SoftDevice change the state, or return a non-zero value to halt the SoftDevice state change. | ||
| When an observer returns non-zero to the :c:enumerator:`NRF_SDH_STATE_EVT_DISABLE_PREPARE` event, it must call the :c:func:`nrf_sdh_observer_ready` function when it becomes ready for the SoftDevice state change. | ||
|
|
||
| When the last state observer becomes ready for the SoftDevice state change, the SoftDevice changes the state and the :c:enumerator:`NRF_SDH_STATE_EVT_DISABLED` event is sent. |
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.
| When the last state observer becomes ready for the SoftDevice state change, the SoftDevice changes the state and the :c:enumerator:`NRF_SDH_STATE_EVT_DISABLED` event is sent. | |
| When the last state observer is ready for the SoftDevice state change, the state is changed and the :c:enumerator:`NRF_SDH_STATE_EVT_DISABLED` event is sent. |
| Fault handling | ||
| ============== | ||
|
|
||
| You can override the SoftDevice fault handler function by defining the following function, as shown in the snippet below: |
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 can override the SoftDevice fault handler function by defining the following function, as shown in the snippet below: | |
| You can override the SoftDevice fault handler function by defining the following function: |
| A Bluetooth observer receives Bluetooth events coming from the SoftDevice. | ||
|
|
||
| A Bluetooth observer is declared using the :c:macro:`NRF_SDH_BLE_OBSERVER` macro. |
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.
| A Bluetooth observer receives Bluetooth events coming from the SoftDevice. | |
| A Bluetooth observer is declared using the :c:macro:`NRF_SDH_BLE_OBSERVER` macro. | |
| A Bluetooth observer receives Bluetooth events coming from the SoftDevice and is declared using the :c:macro:`NRF_SDH_BLE_OBSERVER` macro. |
| An SoC observer receives SoC events coming from the SoftDevice. | ||
|
|
||
| An SoC observer is declared using the :c:macro:`NRF_SDH_BLE_OBSERVER` macro. |
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.
| An SoC observer receives SoC events coming from the SoftDevice. | |
| An SoC observer is declared using the :c:macro:`NRF_SDH_BLE_OBSERVER` macro. | |
| An SoC observer receives SoC events coming from the SoftDevice and is declared using the :c:macro:`NRF_SDH_BLE_OBSERVER` macro. |
| The SoftDevice handler has several options to control the clock configuration passed to the :c:func:`sd_softdevice_enable` function. | ||
|
|
||
| These options are used automatically when you enable the SoftDevice by calling the :c:func:`nrf_sdh_enable_request` function. |
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.
| The SoftDevice handler has several options to control the clock configuration passed to the :c:func:`sd_softdevice_enable` function. | |
| These options are used automatically when you enable the SoftDevice by calling the :c:func:`nrf_sdh_enable_request` function. | |
| The SoftDevice handler has several options to control the clock configuration passed to the :c:func:`sd_softdevice_enable` function. | |
| These options are used automatically when you enable the SoftDevice by calling the :c:func:`nrf_sdh_enable_request` function. |
Extend SoftDevice handler documentation.