Find file
Fetching contributors…
Cannot retrieve contributors at this time
45 lines (28 sloc) 812 Bytes
local ffi = require "ffi"
local host = require "bcm_host"
local bcm_host_lib = ffi.load("bcm_host");
--[[
The bcm_host_init() function must be called
before any other functions in the library can be
utilized. This will be done automatically
if the developer does:
require "bcm_host"
--]]
bcm_host_lib.bcm_host_init();
local GetDisplaySize = function(display_number)
display_number = display_number or 0
local pWidth = ffi.new("uint32_t[1]");
local pHeight = ffi.new("uint32_t[1]");
local err = lib.graphics_get_display_size(display_number, pWidth, pHeight);
-- Return immediately if there was an error
if err ~= 0 then
return false, err
end
return pWidth[0], pHeight[0];
end
return {
-- Libraries
Lib = lib,
bcm_host_lib = bcm_host_lib,
GetDisplaySize = GetDisplaySize,
}