Skip to content

Instantly share code, notes, and snippets.

@gr33n7007h
Created December 2, 2017 16:48
Show Gist options
  • Save gr33n7007h/651ef33ff52b573612473a375cf49085 to your computer and use it in GitHub Desktop.
Save gr33n7007h/651ef33ff52b573612473a375cf49085 to your computer and use it in GitHub Desktop.
fiddle struct
require 'fiddle'
require 'fiddle/import'
# C Struct E.g.
#
# typedef struct {
# uint8_t b[6];
# } bdaddr_t;
#
# typedef struct {
# bdaddr_t bdaddr;w
# uint8_t pscan_rep_mode;
# uint8_t pscan_period_mode;
# uint8_t pscan_mode;
# uint8_t dev_class[3];
# uint16_t clock_offset;
# } inquiry_info;
include Fiddle::Importer
bdaddr_t = [
'char b[6]'
]
Inquiry_info = struct [
*bdaddr_t, # is this right, idk?
'char pscan_rep_mode',
'char pscan_period_mode',
'char pscan_mode',
'char dev_class[3]',
'unsigned short clock_offset',
]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment