Skip to content

Commit

Permalink
almost there???
Browse files Browse the repository at this point in the history
  • Loading branch information
tballmsft committed Jan 23, 2024
1 parent 4f4125e commit 86d9436
Show file tree
Hide file tree
Showing 6 changed files with 8 additions and 38 deletions.
2 changes: 1 addition & 1 deletion libs/core/codal.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ void platform_init() {
seedRandom(seed);
}

void initMicrobitGC() {
void initfbitGC() {
uBit.init();
if (device_heap_size(1) > NON_GC_HEAP_RESERVATION + 4)
gcPreAllocateBlock(device_heap_size(1) - NON_GC_HEAP_RESERVATION);
Expand Down
5 changes: 0 additions & 5 deletions libs/st7735/_locales/st7735-jsdoc-strings.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,5 @@
"images._image": "An image",
"images._image|param|image": "the image",
"img": "Tagged image literal converter",
"pins": "Control currents in Pins for analog/digital signals, servos, i2c, ...",
"pins.createBuffer": "Create a new zero-initialized buffer.",
"pins.createBuffer|param|size": "number of bytes in the buffer",
"pins.pinByCfg": "Get a pin by configuration id (DAL.CFG_PIN...)",
"pins.pulseDuration": "Get the duration of the last pulse in microseconds. This function should be called from a ``onPulsed`` handler.\n\nGet the duration of the last pulse in microseconds. This function should be called from a\n``onPulsed`` handler.",
"simage.screenImage": "Get the screen image"
}
4 changes: 0 additions & 4 deletions libs/st7735/_locales/st7735-strings.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,16 +20,13 @@
"images._tile|block": "%tile",
"images|block": "images",
"image|block": "image",
"pins.pulseDuration|block": "pulse duration (µs)",
"pins|block": "pins",
"simage.create|block": "create image width %width height %height",
"simage.screenImage|block": "screen",
"simage|block": "simage",
"{id:category}Control": "Control",
"{id:category}Helpers": "Helpers",
"{id:category}Image": "Image",
"{id:category}Images": "Images",
"{id:category}Pins": "Pins",
"{id:category}SImage": "SImage",
"{id:category}Scene": "Scene",
"{id:category}ScreenImage": "ScreenImage",
Expand All @@ -40,7 +37,6 @@
"{id:group}Compare": "Compare",
"{id:group}Create": "Create",
"{id:group}Drawing": "Drawing",
"{id:group}Pulse": "Pulse",
"{id:group}Tiles": "Tiles",
"{id:group}Transformations": "Transformations"
}
4 changes: 4 additions & 0 deletions libs/st7735/config_nrf.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,10 @@
//#define CODAL_TIMER Timer
//#define CODAL_SERIAL NRF52Serial

#define PXT_INTERNAL_KEY_UP 2050
#define PXT_INTERNAL_KEY_DOWN 2051
#define DEVICE_ID_FIRST_BUTTON 4000

typedef CODAL_PIN DevicePin;

typedef DevicePin *DigitalInOutPin;
Expand Down
7 changes: 3 additions & 4 deletions libs/st7735/jddisplay.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@

#include "jddisplay.h"

#define PXT_INTERNAL_KEY_UP 2050
#define PXT_INTERNAL_KEY_DOWN 2051
#include "config_nrf.h"

#define VLOG NOLOG
//#define VLOG DMESG
Expand Down Expand Up @@ -239,7 +238,7 @@ void JDDisplay::step() {

memset(&sendFrame, 0, JD_SERIAL_FULL_HEADER_SIZE);
sendFrame.crc = JDSPI_MAGIC;
sendFrame.device_identifier = device.getLongSerialNumber();
sendFrame.device_identifier = device.getSerialNumber();

if (recvFrame.crc == JDSPI_MAGIC_NOOP) {
// empty frame, skip
Expand Down Expand Up @@ -284,7 +283,7 @@ void JDDisplay::step() {

if (soundServiceNum) {
// we only need this for sending sound
uint32_t now = (uint32_t)(pxt::micros());
uint32_t now = (uint32_t)(pxt::current_time_ms());
if (lastFrameTimestamp) {
uint32_t thisFrame = now - lastFrameTimestamp;
avgFrameTime = (avgFrameTime * 15 + thisFrame) >> 4;
Expand Down
24 changes: 0 additions & 24 deletions libs/st7735/shims.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -149,29 +149,5 @@ declare namespace image {
//% shim=image::doubledIcon
function doubledIcon(icon: Buffer): Buffer;
}
declare namespace pins {

/**
* Get a pin by configuration id (DAL.CFG_PIN...)
*/
//% shim=pins::pinByCfg
function pinByCfg(key: int32): DigitalInOutPin;

/**
* Create a new zero-initialized buffer.
* @param size number of bytes in the buffer
*/
//% shim=pins::createBuffer
function createBuffer(size: int32): Buffer;

/**
* Get the duration of the last pulse in microseconds. This function should be called from a
* ``onPulsed`` handler.
*/
//% help=pins/pulse-duration blockGap=8
//% blockId=pins_pulse_duration block="pulse duration (µs)"
//% weight=19 shim=pins::pulseDuration
function pulseDuration(): int32;
}

// Auto-generated. Do not edit. Really.

0 comments on commit 86d9436

Please sign in to comment.