{"comment":{"url":"https://api.github.com/repos/doanac/libsoc/comments/13777517","html_url":"https://github.com/doanac/libsoc/commit/82f70d59e417da2d7ff20f0c18326687178b5d20#commitcomment-13777517","id":13777517,"user":{"login":"doanac","id":227620,"avatar_url":"https://avatars.githubusercontent.com/u/227620?v=3","gravatar_id":"","url":"https://api.github.com/users/doanac","html_url":"https://github.com/doanac","followers_url":"https://api.github.com/users/doanac/followers","following_url":"https://api.github.com/users/doanac/following{/other_user}","gists_url":"https://api.github.com/users/doanac/gists{/gist_id}","starred_url":"https://api.github.com/users/doanac/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/doanac/subscriptions","organizations_url":"https://api.github.com/users/doanac/orgs","repos_url":"https://api.github.com/users/doanac/repos","events_url":"https://api.github.com/users/doanac/events{/privacy}","received_events_url":"https://api.github.com/users/doanac/received_events","type":"User","site_admin":false},"position":84,"line":84,"path":"lib/board.c","commit_id":"82f70d59e417da2d7ff20f0c18326687178b5d20","created_at":"2015-10-14T20:42:50Z","updated_at":"2015-10-14T20:42:50Z","body":"I could have libsoc_board_init return \"board_config\" struct rather than just the pin-mappings. That could contain function pointers to \"board functions\". Something like:\r\n\r\n struct {\r\n  pin_mappings *pin_mappings;\r\n  unsigned int (*gpio_id)(struct board_config, char *pin_name);\r\n } board_config;\r\n\r\nboard_config *bc = libsoc_board_init();\r\nunsigned int foo = bc->gpio_id(bc, \"pin_foo\");\r\n\r\nThat's a bit of a detour from the style of you API though. So unless you like this idea, I'll stick with how it is."}}