Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Fork of d7a_1x by
Diff: include/d7a.h
- Revision:
- 59:b42eae56b51b
- Parent:
- 58:38a366236bda
- Child:
- 60:8d4133fbc060
--- a/include/d7a.h Mon Sep 12 16:36:09 2016 +0000 +++ b/include/d7a.h Fri Sep 23 15:00:41 2016 +0000 @@ -14,10 +14,6 @@ #define D7A_XCL_GATEWAY (0x21) #define D7A_CTF_VAL(mant,exp) ((uint8_t)(mant|(exp<<5))) -#define D7A_CTF_TO_VAL(ctf) ((uint32_t)() - - - #define D7A_NBID(nbid) (nbid >= 32)? D7A_CTF_VAL(8,1) : D7A_CTF_VAL(nbid,0) @@ -179,8 +175,14 @@ /// Retries: 0 /// Slot: 1 ALP_RPOL_BULK = 4, + /// Respond: false + /// Persist: false + /// Depth: 1 + /// Bulk: false + /// Retries: 0 + /// Slot: 1 + ALP_RPOL_BLINK = 5, - //ALP_RPOL_SPARE_1 = 5, //ALP_RPOL_SPARE_2 = 6, //ALP_RPOL_SPARE_3 = 7, } alp_rpol_t; @@ -236,6 +238,29 @@ uint16_t rx_buffer_size; } d7a_com_config_t; +TYPEDEF_STRUCT_PACKED { + uint8_t fid; + uint32_t length; + uint32_t offset; + uint8_t buf[1]; +} d7a_data_t; + +// ======================================================================= +// d7a_msg_t +// ----------------------------------------------------------------------- +/// Response data and meta-data from a device +// ======================================================================= +typedef struct +{ + /// Error code + int8_t err; + /// Responder's UID + uint8_t id[D7A_UID_LEN]; + /// Transmission Link Budget + int8_t lb; + /// Potential data + d7a_data_t* data; +} d7a_msg_t; typedef uint32_t (*WriteFileFunction)( const uint8_t file_id, @@ -250,6 +275,8 @@ typedef void (*NotifDoneFunction)( const uint8_t file_id, const uint8_t error); + +typedef void (*UnsolicitedMsgFunction)( d7a_msg_t** msg); //====================================================================== // d7a_fs_callbacks_t @@ -263,6 +290,8 @@ ReadFileFunction read_file; /// Is called when the notification is finished (depending on the retry policy) NotifDoneFunction notif_done; + /// This function is called when an unsolicited message is catched + UnsolicitedMsgFunction unsolicited_msg; } d7a_callbacks_t; //====================================================================== @@ -375,25 +404,6 @@ } d7a_addressee_t; -// ======================================================================= -// d7a_resp_t -// ----------------------------------------------------------------------- -/// Response data and meta-data from a device -// ======================================================================= -typedef struct -{ - /// Error code - int8_t err; - /// Responder's UID - uint8_t id[D7A_UID_LEN]; - /// Transmission Link Budget - int8_t lb; - /// Potential data - uint32_t data_len; - uint8_t* data; -} d7a_msg_t; - - //====================================================================== // Prototypes //======================================================================