File tree Expand file tree Collapse file tree 1 file changed +65
-72
lines changed Expand file tree Collapse file tree 1 file changed +65
-72
lines changed Original file line number Diff line number Diff line change 887
887
]
888
888
)
889
889
890
- _ov2640_settings_jpeg3 = bytes (
891
- [
892
- _BANK_SEL ,
893
- _BANK_DSP ,
894
- _RESET ,
895
- _RESET_JPEG | _RESET_DVP ,
896
- _IMAGE_MODE ,
897
- _IMAGE_MODE_JPEG_EN | _IMAGE_MODE_HREF_VSYNC ,
898
- 0xD7 ,
899
- 0x03 ,
900
- 0xE1 ,
901
- 0x77 ,
902
- 0xE5 ,
903
- 0x1F ,
904
- 0xD9 ,
905
- 0x10 ,
906
- 0xDF ,
907
- 0x80 ,
908
- 0x33 ,
909
- 0x80 ,
910
- 0x3C ,
911
- 0x10 ,
912
- 0xEB ,
913
- 0x30 ,
914
- 0xDD ,
915
- 0x7F ,
916
- _RESET ,
917
- 0x00 ,
918
- ]
919
- )
920
-
921
- _ov2640_settings_yuv422 = bytes (
922
- [
923
- _BANK_SEL ,
924
- _BANK_DSP ,
925
- _RESET ,
926
- _RESET_DVP ,
927
- _IMAGE_MODE ,
928
- _IMAGE_MODE_YUV422 ,
929
- 0xD7 ,
930
- 0x01 ,
931
- 0xE1 ,
932
- 0x67 ,
933
- _RESET ,
934
- 0x00 ,
935
- ]
936
- )
937
-
938
- _ov2640_settings_rgb565 = bytes (
939
- [
940
- _BANK_SEL ,
941
- _BANK_DSP ,
942
- _RESET ,
943
- _RESET_DVP ,
944
- _IMAGE_MODE ,
945
- _IMAGE_MODE_RGB565 ,
946
- 0xD7 ,
947
- 0x03 ,
948
- 0xE1 ,
949
- 0x77 ,
950
- _RESET ,
951
- 0x00 ,
952
- ]
953
- )
890
+ _ov2640_color_settings = {
891
+ OV2640_COLOR_JPEG : bytes (
892
+ [
893
+ _BANK_SEL ,
894
+ _BANK_DSP ,
895
+ _RESET ,
896
+ _RESET_JPEG | _RESET_DVP ,
897
+ _IMAGE_MODE ,
898
+ _IMAGE_MODE_JPEG_EN | _IMAGE_MODE_HREF_VSYNC ,
899
+ 0xD7 ,
900
+ 0x03 ,
901
+ 0xE1 ,
902
+ 0x77 ,
903
+ 0xE5 ,
904
+ 0x1F ,
905
+ 0xD9 ,
906
+ 0x10 ,
907
+ 0xDF ,
908
+ 0x80 ,
909
+ 0x33 ,
910
+ 0x80 ,
911
+ 0x3C ,
912
+ 0x10 ,
913
+ 0xEB ,
914
+ 0x30 ,
915
+ 0xDD ,
916
+ 0x7F ,
917
+ _RESET ,
918
+ 0x00 ,
919
+ ]
920
+ ),
921
+ OV2640_COLOR_YUV : bytes (
922
+ [
923
+ _BANK_SEL ,
924
+ _BANK_DSP ,
925
+ _RESET ,
926
+ _RESET_DVP ,
927
+ _IMAGE_MODE ,
928
+ _IMAGE_MODE_YUV422 ,
929
+ 0xD7 ,
930
+ 0x01 ,
931
+ 0xE1 ,
932
+ 0x67 ,
933
+ _RESET ,
934
+ 0x00 ,
935
+ ]
936
+ ),
937
+ OV2640_COLOR_RGB : bytes (
938
+ [
939
+ _BANK_SEL ,
940
+ _BANK_DSP ,
941
+ _RESET ,
942
+ _RESET_DVP ,
943
+ _IMAGE_MODE ,
944
+ _IMAGE_MODE_RGB565 ,
945
+ 0xD7 ,
946
+ 0x03 ,
947
+ 0xE1 ,
948
+ 0x77 ,
949
+ _RESET ,
950
+ 0x00 ,
951
+ ]
952
+ ),
953
+ }
954
954
955
955
956
956
class _RegBits :
@@ -1173,14 +1173,7 @@ def colorspace(self, colorspace):
1173
1173
1174
1174
def _set_colorspace (self ):
1175
1175
colorspace = self ._colorspace
1176
- if colorspace == OV2640_COLOR_RGB :
1177
- settings = _ov2640_settings_rgb565
1178
- elif colorspace == OV2640_COLOR_YUV :
1179
- settings = _ov2640_settings_yuv422
1180
- elif colorspace == OV2640_COLOR_JPEG :
1181
- settings = _ov2640_settings_jpeg3
1182
- else :
1183
- raise ValueError (f"Invalid colorspace { repr (colorspace )} " )
1176
+ settings = _ov2640_color_settings [colorspace ]
1184
1177
1185
1178
self ._write_list (settings )
1186
1179
# written twice?
You can’t perform that action at this time.
0 commit comments