-
Notifications
You must be signed in to change notification settings - Fork 451
Https/GitHub.com/alan840706/micropython #472
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
69397de
4e7c673
8a12976
27d3c31
b5e9665
fc264ee
f45f7c0
f21b664
42fb7b0
c858fc2
afaf429
f9cb005
e625b7d
c745f40
c0497a4
75037f6
f5cbf26
ca477cb
aecd4d8
8029e17
4baa889
e5d1a48
016bd6d
ad23e99
9d774bd
a81250c
5019894
499981e
251ab2b
b1483f1
839c99f
09a58cc
4e4b72b
71e1a85
d500595
31ceff8
3f9714d
6d2b204
85cc7b8
14fd53e
dd7e169
6617fb9
b8b08cf
1e6abde
ba7ada0
0bac2ce
82c9340
41018db
c851ae4
9489619
f4ddaf8
e3cd886
95bb264
8d10493
8b2d462
44d4620
ba4f611
224b5ba
d01e4b6
8e8c001
44b7643
f57b332
3c7e275
783874c
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This empty file was added by mistake and needs to be cleaned up |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,6 +7,7 @@ | |
* | ||
*/ | ||
#include <math.h> | ||
#include <stdio.h> | ||
#include <stdlib.h> | ||
#include <ff.h> | ||
#include "vfs_wrapper.h" | ||
|
@@ -229,7 +230,6 @@ void bmp_write_subimg(image_t *img, const char *path, rectangle_t *r) | |
mp_obj_t file = vfs_internal_open(path, "wb", &err); | ||
if(file == MP_OBJ_NULL || err != 0) | ||
mp_raise_OSError(err); | ||
|
||
if (IM_IS_GS(img)) { | ||
const int row_bytes = (((rect.w * 8) + 31) / 32) * 4; | ||
const int data_size = (row_bytes * rect.h); | ||
|
@@ -257,6 +257,7 @@ void bmp_write_subimg(image_t *img, const char *path, rectangle_t *r) | |
for (int i = 0; i < 256; i++) { | ||
write_long_raise(file, ((i) << 16) | ((i) << 8) | i); | ||
} | ||
printf("OK1!\n"); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Need to clean up unnecessary code |
||
if ((rect.x == 0) && (rect.w == img->w) && (img->w == row_bytes)) { | ||
write_data_raise(file, // Super Fast - Zoom, Zoom! | ||
img->pixels + (rect.y * img->w), | ||
|
@@ -270,6 +271,7 @@ void bmp_write_subimg(image_t *img, const char *path, rectangle_t *r) | |
} | ||
} | ||
} else { | ||
printf("OK2!\n"); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Need to clean up unnecessary code |
||
const int row_bytes = (((rect.w * 16) + 31) / 32) * 4; | ||
const int data_size = (row_bytes * rect.h); | ||
const int waste = (row_bytes / sizeof(uint16_t)) - rect.w; | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,7 +2,7 @@ | |
* Copyright (c) 2013-2018 Ibrahim Abdelkader <[email protected]> & Kwabena W. Agyeman <[email protected]> | ||
* This work is licensed under the MIT license, see the file LICENSE for details. | ||
*/ | ||
|
||
#include <stdio.h> | ||
#include "font.h" | ||
#include "imlib.h" | ||
|
||
|
@@ -31,7 +31,7 @@ int imlib_get_pixel(image_t *img, int x, int y) | |
|
||
// Set pixel (handles boundary check and image type check). | ||
void imlib_set_pixel(image_t *img, int x, int y, int p) | ||
{ | ||
{ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Unnecessary trailing space |
||
if ((0 <= x) && (x < img->w) && (0 <= y) && (y < img->h)) { | ||
switch(img->bpp) { | ||
case IMAGE_BPP_BINARY: { | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -652,18 +652,22 @@ STATIC mp_obj_t py_image_set_pixel(size_t n_args, const mp_obj_t *args, mp_map_t | |
switch (arg_img->bpp) { | ||
case IMAGE_BPP_BINARY: { | ||
IMAGE_PUT_BINARY_PIXEL(arg_img, arg_x, arg_y, arg_c); | ||
//printf("0"); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Need to clean up unnecessary code |
||
return args[0]; | ||
} | ||
case IMAGE_BPP_GRAYSCALE: { | ||
IMAGE_PUT_GRAYSCALE_PIXEL(arg_img, arg_x, arg_y, arg_c); | ||
//printf("1"); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Need to clean up unnecessary code |
||
return args[0]; | ||
} | ||
case IMAGE_BPP_RGB565: { | ||
IMAGE_PUT_RGB565_PIXEL(arg_img, arg_x, arg_y, arg_c); | ||
//printf("2"); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Need to clean up unnecessary code |
||
return args[0]; | ||
} | ||
case IMAGE_BPP_BAYER: { | ||
IMAGE_PUT_GRAYSCALE_PIXEL(arg_img, arg_x, arg_y, arg_c); // Correct! | ||
//printf("3"); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Need to clean up unnecessary code |
||
return args[0]; | ||
} | ||
default: return args[0]; | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -142,10 +142,10 @@ void mp_soft_spi_transfer(void *self_in, size_t len, const uint8_t *src, uint8_t | |
machine_hw_spi_obj_t *self = (machine_hw_spi_obj_t*)self_in; | ||
uint32_t delay_half = self->delay_half; | ||
|
||
// printk("%s %d %d %d\r\n", __func__, self->pin_sck, self->pin_d[0], self->pin_d[1]); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Unnecessary trailing space |
||
|
||
// only MSB transfer is implemented | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Unnecessary trailing space |
||
// If a port defines MICROPY_HW_SOFTSPI_MIN_DELAY, and the configured | ||
// delay_half is equal to this value, then the software SPI implementation | ||
// will run as fast as possible, limited only by CPU speed and GPIO time. | ||
|
@@ -220,7 +220,6 @@ STATIC void machine_hw_spi_deinit(mp_obj_base_t *self_in) { | |
|
||
STATIC void machine_hw_spi_transfer(mp_obj_base_t *self_in, size_t len, const uint8_t *src, uint8_t *dest, int cs) { | ||
machine_hw_spi_obj_t *self = MP_OBJ_TO_PTR(self_in); | ||
|
||
if (self->state == MACHINE_HW_SPI_STATE_DEINIT) { | ||
mp_raise_msg(&mp_type_OSError, "[MAIXPY]SPI: transfer on deinitialized SPI"); | ||
return; | ||
|
@@ -231,6 +230,7 @@ STATIC void machine_hw_spi_transfer(mp_obj_base_t *self_in, size_t len, const ui | |
mp_soft_spi_transfer(self, len, src, dest); | ||
return; | ||
} | ||
|
||
#endif | ||
if(dest==NULL) | ||
sipeed_spi_transfer_data_standard(self->id, cs, src, NULL, len, 0); | ||
|
@@ -523,7 +523,7 @@ STATIC void mp_machine_spi_transfer(mp_obj_t self, size_t len, const void *src, | |
spi_p->transfer(s, len, src, dest, cs); | ||
} | ||
|
||
STATIC mp_obj_t mp_machine_spi_read(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) { | ||
STATIC mp_obj_t mp_machine_spi_read(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Unnecessary trailing space |
||
enum { | ||
ARG_write, | ||
ARG_cs, | ||
|
@@ -553,6 +553,7 @@ STATIC mp_obj_t mp_machine_spi_read(size_t n_args, const mp_obj_t *pos_args, mp_ | |
vstr_t vstr; | ||
vstr_init_len(&vstr, mp_obj_get_int(pos_args[1])); | ||
memset(vstr.buf, args[ARG_write].u_int, vstr.len); | ||
|
||
mp_machine_spi_transfer(self, vstr.len, vstr.buf, vstr.buf, cs); | ||
return mp_obj_new_str_from_vstr(&mp_type_bytes, &vstr); | ||
} | ||
|
@@ -722,4 +723,4 @@ const mp_obj_type_t machine_hw_spi_type = { | |
.locals_dict = (mp_obj_dict_t *) &mp_machine_spi_locals_dict, | ||
}; | ||
|
||
#endif //MICROPY_PY_MACHINE_HW_SPI | ||
#endif //MICROPY_PY_MACHINE_HW_SPI |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please explain the specific reason for the modification here