Hi, I'm using nRF52832 ble_app_uart example project. In ble_gap.h file, I could see:
typedef struct { // var : 4 means that var is 4-bit uint8_t sm : 4; /**< Security Mode (1 or 2), 0 for no permissions at all. */ uint8_t lv : 4; /**< Level (1, 2, 3 or 4), 0 for no permissions at all. */ } ble_gap_conn_sec_mode_t;
From my understanding, the number 4 means that the variable sm (security mode) will only use the lowest 4 bits as its value. For example, if sm = 0000 0001, then sm = 0001 due to the ": 4".
Is that correct?
Also, why Nordic defines uint8_t, then use ": 4" (only uses 4 bits), please?
Thanks