pykms: add videomode related features
[android/external-libkmsxx.git] / py / pykms / pykmsbase.cpp
index c371a0b76accf503c072d2459b91a2969cf87b06..d013f1f38cd39ef6827b4a038f274f872028fa99 100644 (file)
@@ -147,6 +147,12 @@ void init_pykmsbase(py::module &m)
                        .value("BGR565", PixelFormat::BGR565)
                        ;
 
                        .value("BGR565", PixelFormat::BGR565)
                        ;
 
+       py::enum_<SyncPolarity>(m, "SyncPolarity")
+                       .value("Undefined", SyncPolarity::Undefined)
+                       .value("Positive", SyncPolarity::Positive)
+                       .value("Negative", SyncPolarity::Negative)
+                       ;
+
        py::class_<Videomode>(m, "Videomode")
                        .def(py::init<>())
 
        py::class_<Videomode>(m, "Videomode")
                        .def(py::init<>())
 
@@ -172,8 +178,14 @@ void init_pykmsbase(py::module &m)
                        .def("__repr__", [](const Videomode& vm) { return "<pykms.Videomode " + to_string(vm.hdisplay) + "x" + to_string(vm.vdisplay) + ">"; })
 
                        .def("to_blob", &Videomode::to_blob)
                        .def("__repr__", [](const Videomode& vm) { return "<pykms.Videomode " + to_string(vm.hdisplay) + "x" + to_string(vm.vdisplay) + ">"; })
 
                        .def("to_blob", &Videomode::to_blob)
+
+                       .def_property("hsync", &Videomode::hsync, &Videomode::set_hsync)
+                       .def_property("vsync", &Videomode::vsync, &Videomode::set_vsync)
                        ;
 
                        ;
 
+
+       m.def("videomode_from_timings", &videomode_from_timings);
+
        py::class_<AtomicReq>(m, "AtomicReq")
                        .def(py::init<Card&>(),
                             py::keep_alive<1, 2>())    // Keep Card alive until this is destructed
        py::class_<AtomicReq>(m, "AtomicReq")
                        .def(py::init<Card&>(),
                             py::keep_alive<1, 2>())    // Keep Card alive until this is destructed