|
10 | 10 | #include <klib/usb/usb/video/descriptor.hpp> |
11 | 11 |
|
12 | 12 | namespace klib::usb::device { |
13 | | - template <uint32_t Width, uint32_t Height, uint32_t InterruptEndpoint = 6, uint32_t IsoEndpoint = 8, uint32_t MaxIsoEndpointSize = 1023> |
| 13 | + /** |
| 14 | + * @brief USB camera |
| 15 | + * |
| 16 | + * @tparam Width width of the data in pixels |
| 17 | + * @tparam Height height of the data in pixels |
| 18 | + * @tparam Fps |
| 19 | + * @tparam InterruptEndpoint |
| 20 | + * @tparam IsoEndpoint |
| 21 | + * @tparam MaxIsoEndpointSize size for the isochronous endpoint. Default should be fine for most devices. |
| 22 | + */ |
| 23 | + template <uint32_t Width, uint32_t Height, uint32_t Fps = 10, uint32_t InterruptEndpoint = 6, uint32_t IsoEndpoint = 8, uint32_t MaxIsoEndpointSize = 1023> |
14 | 24 | class camera { |
15 | 25 | protected: |
16 | 26 | /** |
@@ -251,14 +261,14 @@ namespace klib::usb::device { |
251 | 261 | .bmCapabilities = 0x03, |
252 | 262 | .wWidth = Width, |
253 | 263 | .wHeight = Height, |
254 | | - .dwMinBitRate = 0x000dec00, |
255 | | - .dwMaxBitRate = 0x000dec00, |
256 | | - .dwMaxVideoFrameBufSize = 0x00009480, |
257 | | - .dwDefaultFrameInterval = 0x000a2c2a, |
| 264 | + .dwMinBitRate = Width * Height * 16 * Fps, |
| 265 | + .dwMaxBitRate = Width * Height * 16 * Fps, |
| 266 | + .dwMaxVideoFrameBufSize = Width * Height * 16 / 8, |
| 267 | + .dwDefaultFrameInterval = 10000000 / Fps, |
258 | 268 | .bFrameIntervalType = 0x00, |
259 | 269 | .interval = { |
260 | | - .dwMinFrameInterval = 0x000a2c2a, |
261 | | - .dwMaxFrameInterval = 0x000a2c2a, |
| 270 | + .dwMinFrameInterval = 10000000 / Fps, |
| 271 | + .dwMaxFrameInterval = 10000000 / Fps, |
262 | 272 | .dwFrameIntervalStep = 0x00000000, |
263 | 273 | }, |
264 | 274 | }, |
|
0 commit comments