Beware that this post is related to an SDK in maintenance mode
More Info: Consider nRF Connect SDK for new designs
This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

NRF_SDH_DISPATCH_MODEL question

If I use NRF_SDH_DISPATCH_MODEL with NRF_SDH_DISPATCH_MODEL_APPSH what size do I need to use for the scheduler data size and queue length in

APP_SCHED_INIT( ?, ? ),

Is sizeof ble_evt_t sufficient, except I believe it has some variable length array structures

Parents
  • Hi,

    The EVENT_SIZE supplied to APP_SCHED_INIT() is the maximum size of events to be passed through the scheduler. In other words, the event size is simply the size (reported by sizeof()) of the data type that is inserted into the events queue by the call to app_sched_event_put(). In some applications, only one data type is ever used as an event, and in that case, use the size of that type (in your case sizeof(ble_evt_t) )

Reply
  • Hi,

    The EVENT_SIZE supplied to APP_SCHED_INIT() is the maximum size of events to be passed through the scheduler. In other words, the event size is simply the size (reported by sizeof()) of the data type that is inserted into the events queue by the call to app_sched_event_put(). In some applications, only one data type is ever used as an event, and in that case, use the size of that type (in your case sizeof(ble_evt_t) )

Children
  • Well that would be true, (and may well be) BUT ble_evt_t has some place holder definitions

    /**@brief Event structure for @ref BLE_GATTS_EVT_WRITE. */
    typedef struct
    {
      uint16_t                    handle;             /**< Attribute Handle. */
      ble_uuid_t                  uuid;               /**< Attribute UUID. */
      uint8_t                     op;                 /**< Type of write operation, see @ref BLE_GATTS_OPS. */
      uint8_t                     auth_required;      /**< Writing operation deferred due to authorization requirement. Application may use @ref sd_ble_gatts_value_set to finalize the writing operation. */
      uint16_t                    offset;             /**< Offset for the write operation. */
      uint16_t                    len;                /**< Length of the received data. */
      uint8_t                     data[1];            /**< Received data. @note This is a variable length array. The size of 1 indicated is only a placeholder for compilation.
                                                           See @ref sd_ble_evt_get for more information on how to use event structures with variable length array members. */
    } ble_gatts_evt_write_t;
    

    Note that the data member is defined as size[1] but is probably bigger

Related