Struct raspberry_pi::RaspberryPi
source · [−]pub struct RaspberryPi { /* private fields */ }Expand description
An interface to RaspberryPi libraries
Implementations
sourceimpl RaspberryPi
impl RaspberryPi
sourcepub unsafe fn new() -> Result<Self, Error>
pub unsafe fn new() -> Result<Self, Error>
Initialize a new RaspberryPi.
Safety
- There may only be 1 instance of this struct in the program at any given time.
- The libraries
libbcm_host.soin the search path must be the correct libraries with the correct function definitions. - No other calls may be made to the VideoCore may be made in this process by any means while this struct is active. This includes linking and using FFMpeg in-process.
sourcepub fn bcm_host_init(&mut self)
pub fn bcm_host_init(&mut self)
Init bcm_host.
This must be called before any other functions.
Right now, this is safe to call multiple times, even while already initialized.
sourcepub unsafe fn bcm_host_deinit(&mut self) -> Result<(), Error>
pub unsafe fn bcm_host_deinit(&mut self) -> Result<(), Error>
Deinit bcm_host.
The impl is currently a no-op, but this may change in the future.
Safety
The user must be done using the GPU.
sourcepub fn graphics_get_display_size(
&mut self,
display_number: u16
) -> Result<(u32, u32), Error>
pub fn graphics_get_display_size(
&mut self,
display_number: u16
) -> Result<(u32, u32), Error>
Get the size of the graphics display.
sourcepub fn get_model_type(&mut self) -> Result<BoardType, Error>
pub fn get_model_type(&mut self) -> Result<BoardType, Error>
Get the model type
sourcepub fn is_model_pi4(&mut self) -> bool
pub fn is_model_pi4(&mut self) -> bool
Return true if this is a pi 4, or in the same family.
sourcepub fn is_fkms_active(&mut self) -> bool
pub fn is_fkms_active(&mut self) -> bool
Return true if fkms is active.
sourcepub fn is_kms_active(&mut self) -> bool
pub fn is_kms_active(&mut self) -> bool
Return true if kms is active.
sourcepub fn get_processor_id(&mut self) -> Result<ProcessorId, Error>
pub fn get_processor_id(&mut self) -> Result<ProcessorId, Error>
Get the processor id.
sourcepub fn vc_gencmd_stop(&mut self) -> Result<(), Error>
pub fn vc_gencmd_stop(&mut self) -> Result<(), Error>
Stop the service from being used.
sourcepub fn vc_gencmd_send<F>(&mut self, format: F) -> Result<(), Error> where
F: Into<Vec<u8>>,
pub fn vc_gencmd_send<F>(&mut self, format: F) -> Result<(), Error> where
F: Into<Vec<u8>>,
Send command to general command serivce
sourcepub fn vc_gencmd_read_response(&mut self) -> Result<CString, Error>
pub fn vc_gencmd_read_response(&mut self) -> Result<CString, Error>
get resonse from general command serivce
sourcepub fn vcos_init(&mut self) -> Result<(), Error>
pub fn vcos_init(&mut self) -> Result<(), Error>
vcos initialization. Call this function before using other vcos functions. Calls can be nested within the same process; they are reference counted so that only a call from uninitialized state has any effect.
Note
On platforms/toolchains that support it, gcc’s constructor attribute or similar is used to invoke this function before main() or equivalent.
Returns
Status of initialisation.
sourcepub unsafe fn vcos_deinit(&mut self)
pub unsafe fn vcos_deinit(&mut self)
vcos deinitialization. Call this function when vcos is no longer required, in order to free resources. Calls can be nested within the same process; they are reference counted so that only a call that decrements the reference count to 0 has any effect.
Note
On platforms/toolchains that support it, gcc’s destructor attribute or similar is used to invoke this function after exit() or equivalent.
Safety
This function should not be called if vcos is not initialized. Furthermore, you should not use this while still using vcos interfaces.
Auto Trait Implementations
impl RefUnwindSafe for RaspberryPi
impl Send for RaspberryPi
impl Sync for RaspberryPi
impl Unpin for RaspberryPi
impl UnwindSafe for RaspberryPi
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more