summaryrefslogtreecommitdiff
path: root/supervisor/shared
diff options
context:
space:
mode:
authorMax Holliday <maholli@stanford.edu>2020-04-27 13:51:51 -0700
committerMax Holliday <maholli@stanford.edu>2020-04-27 13:51:51 -0700
commit86943ca8a11df8b490ef0c17139311db680bdb5d (patch)
treeadf18060930e7991bbe4f95436cc8d1967127045 /supervisor/shared
parent01e260b276f72485eeb938604e3366771b932e7b (diff)
parent29e7d00050b81624d06fe6c76e1d9abb218516cd (diff)
Merge remote-tracking branch 'adafruit/master'
Diffstat (limited to 'supervisor/shared')
-rw-r--r--supervisor/shared/display.c22
-rw-r--r--supervisor/shared/external_flash/devices.h19
-rwxr-xr-xsupervisor/shared/memory.c11
-rw-r--r--supervisor/shared/usb/usb_desc.c2
4 files changed, 47 insertions, 7 deletions
diff --git a/supervisor/shared/display.c b/supervisor/shared/display.c
index 855432d64..9c074209b 100644
--- a/supervisor/shared/display.c
+++ b/supervisor/shared/display.c
@@ -34,6 +34,10 @@
#include "shared-bindings/displayio/TileGrid.h"
#include "supervisor/memory.h"
+#if CIRCUITPY_RGBMATRIX
+#include "shared-module/displayio/__init__.h"
+#endif
+
extern size_t blinka_bitmap_data[];
extern displayio_bitmap_t blinka_bitmap;
extern displayio_group_t circuitpython_splash;
@@ -112,6 +116,14 @@ void supervisor_display_move_memory(void) {
grid->inline_tiles = false;
}
MP_STATE_VM(terminal_tilegrid_tiles) = NULL;
+ #if CIRCUITPY_RGBMATRIX
+ for (uint8_t i = 0; i < CIRCUITPY_DISPLAY_LIMIT; i++) {
+ if (displays[i].rgbmatrix.base.type == &rgbmatrix_RGBMatrix_type) {
+ rgbmatrix_rgbmatrix_obj_t * pm = &displays[i].rgbmatrix;
+ common_hal_rgbmatrix_rgbmatrix_reconstruct(pm, NULL);
+ }
+ }
+ #endif
#endif
}
@@ -157,28 +169,28 @@ _displayio_color_t blinka_colors[7] = {
},
{
.rgb888 = 0x8428bc,
- .rgb565 = 0x7889,
+ .rgb565 = 0x8978,
.luma = 0xff, // We cheat the luma here. It is actually 0x60
.hue = 184,
.chroma = 148
},
{
.rgb888 = 0xff89bc,
- .rgb565 = 0xB8FC,
+ .rgb565 = 0xFCB8,
.luma = 0xb5,
.hue = 222,
.chroma = 118
},
{
.rgb888 = 0x7beffe,
- .rgb565 = 0x9F86,
+ .rgb565 = 0x869F,
.luma = 0xe0,
.hue = 124,
.chroma = 131
},
{
.rgb888 = 0x51395f,
- .rgb565 = 0x0D5A,
+ .rgb565 = 0x5A0D,
.luma = 0x47,
.hue = 185,
.chroma = 38
@@ -191,7 +203,7 @@ _displayio_color_t blinka_colors[7] = {
},
{
.rgb888 = 0x0736a0,
- .rgb565 = 0xf501,
+ .rgb565 = 0x01f5,
.luma = 0x44,
.hue = 147,
.chroma = 153
diff --git a/supervisor/shared/external_flash/devices.h b/supervisor/shared/external_flash/devices.h
index 05e9e3c95..e148db985 100644
--- a/supervisor/shared/external_flash/devices.h
+++ b/supervisor/shared/external_flash/devices.h
@@ -498,6 +498,25 @@ typedef struct {
.single_status_byte = true, \
}
+// Settings for the Macronix MX25R1635F 8MiB SPI flash.
+// Datasheet: https://www.macronix.com/Lists/Datasheet/Attachments/7595/MX25R1635F,%20Wide%20Range,%2016Mb,%20v1.6.pdf
+// In low power mode, quad operations can only run at 8 MHz.
+#define MX25R1635F {\
+ .total_size = (1 << 21), /* 2 MiB */ \
+ .start_up_time_us = 800, \
+ .manufacturer_id = 0xc2, \
+ .memory_type = 0x28, \
+ .capacity = 0x18, \
+ .max_clock_speed_mhz = 33, /* 8 mhz for dual/quad */ \
+ .quad_enable_bit_mask = 0x80, \
+ .has_sector_protection = false, \
+ .supports_fast_read = true, \
+ .supports_qspi = true, \
+ .supports_qspi_writes = true, \
+ .write_status_register_split = false, \
+ .single_status_byte = true, \
+}
+
// Settings for the Macronix MX25L51245G 64MiB SPI flash.
// Datasheet: https://www.macronix.com/Lists/Datasheet/Attachments/7437/MX25L51245G,%203V,%20512Mb,%20v1.6.pdf
#define MX25L51245G {\
diff --git a/supervisor/shared/memory.c b/supervisor/shared/memory.c
index 14c3b4979..d52334eb4 100755
--- a/supervisor/shared/memory.c
+++ b/supervisor/shared/memory.c
@@ -31,7 +31,7 @@
#include "supervisor/shared/display.h"
-#define CIRCUITPY_SUPERVISOR_ALLOC_COUNT 8
+#define CIRCUITPY_SUPERVISOR_ALLOC_COUNT (12)
static supervisor_allocation allocations[CIRCUITPY_SUPERVISOR_ALLOC_COUNT];
// We use uint32_t* to ensure word (4 byte) alignment.
@@ -82,6 +82,15 @@ void free_memory(supervisor_allocation* allocation) {
allocation->ptr = NULL;
}
+supervisor_allocation* allocation_from_ptr(void *ptr) {
+ for (size_t index = 0; index < CIRCUITPY_SUPERVISOR_ALLOC_COUNT; index++) {
+ if (allocations[index].ptr == ptr) {
+ return &allocations[index];
+ }
+ }
+ return NULL;
+}
+
supervisor_allocation* allocate_remaining_memory(void) {
if (low_address == high_address) {
return NULL;
diff --git a/supervisor/shared/usb/usb_desc.c b/supervisor/shared/usb/usb_desc.c
index 9b333d6fe..080187ebc 100644
--- a/supervisor/shared/usb/usb_desc.c
+++ b/supervisor/shared/usb/usb_desc.c
@@ -52,7 +52,7 @@ uint8_t const * tud_hid_descriptor_report_cb(void) {
// Invoked when received GET STRING DESCRIPTOR request
// Application return pointer to descriptor, whose contents must exist long enough for transfer to complete
-uint16_t const* tud_descriptor_string_cb(uint8_t index) {
+uint16_t const* tud_descriptor_string_cb(uint8_t index, uint16_t langid) {
uint8_t const max_index = sizeof(string_desc_arr)/sizeof(string_desc_arr[0]);
return (index < max_index) ? string_desc_arr[index] : NULL;
}