mirror of
https://github.com/espruino/Espruino.git
synced 2025-12-08 19:06:15 +00:00
Shrink new vector font sizes to allow multi-line use (fix #1873)
This commit is contained in:
parent
708cef5159
commit
f49f7fb444
@ -8,6 +8,7 @@
|
||||
WIZNet: add setHostname(), geHostname(), getStatus()
|
||||
Fix XON not sent after reset() (fix #1872)
|
||||
Remove USBSERIAL enum for non-USB devices
|
||||
Shrink new vector font sizes to allow multi-line use (fix #1873)
|
||||
|
||||
2v06 : Allow `"ram"` keyword at the top of a function to allow it to be pretokenised and loaded to RAM
|
||||
Don't store line numbers for pretokenised functions
|
||||
|
||||
@ -1035,7 +1035,7 @@ void jswrap_banglejs_setLCDTimeout(JsVarFloat timeout) {
|
||||
"name" : "setPollInterval",
|
||||
"generate" : "jswrap_banglejs_setPollInterval",
|
||||
"params" : [
|
||||
["interval","float","Polling interval in milliseconds"]
|
||||
["interval","float","Polling interval in milliseconds (Default is 80ms - 12.5Hz to match accelerometer)"]
|
||||
],
|
||||
"ifdef" : "BANGLEJS"
|
||||
}
|
||||
@ -2037,22 +2037,32 @@ void jswrap_banglejs_accelWr(JsVarInt reg, JsVarInt data) {
|
||||
"name" : "accelRd",
|
||||
"generate" : "jswrap_banglejs_accelRd",
|
||||
"params" : [
|
||||
["reg","int",""]
|
||||
["reg","int",""],
|
||||
["cnt","int","If specified, `accelRd` returns and array of the given length (max 128). If not (or 0) it returns a number"]
|
||||
],
|
||||
"return" : ["int",""],
|
||||
"return" : ["JsVar",""],
|
||||
"ifdef" : "BANGLEJS"
|
||||
}
|
||||
Reads a register from the KX023 Accelerometer
|
||||
|
||||
**Note:** On Espruino 2v06 and before this function only returns a number (`cnt` is ignored).
|
||||
*/
|
||||
int jswrap_banglejs_accelRd(JsVarInt reg) {
|
||||
JsVar *jswrap_banglejs_accelRd(JsVarInt reg, JsVarInt cnt) {
|
||||
#ifndef EMSCRIPTEN
|
||||
unsigned char buf[1];
|
||||
if (cnt<0) cnt=0;
|
||||
unsigned char buf[128];
|
||||
if (cnt>sizeof(buf)) cnt=sizeof(buf);
|
||||
buf[0] = (unsigned char)reg;
|
||||
i2cBusy = true;
|
||||
jsi2cWrite(&internalI2C, ACCEL_ADDR, 1, buf, true);
|
||||
jsi2cRead(&internalI2C, ACCEL_ADDR, 1, buf, true);
|
||||
jsi2cRead(&internalI2C, ACCEL_ADDR, cnt, buf, true);
|
||||
i2cBusy = false;
|
||||
return buf[0];
|
||||
if (cnt) {
|
||||
JsVar *ab = jsvNewArrayBufferWithData(cnt, buf);
|
||||
JsVar *d = jswrap_typedarray_constructor(ARRAYBUFFERVIEW_UINT8, ab,0,0);
|
||||
jsvUnLock(ab);
|
||||
return d;
|
||||
} else return jsvNewFromInteger(buf[0]);
|
||||
#else
|
||||
return 0;
|
||||
#endif
|
||||
|
||||
@ -18,8 +18,8 @@
|
||||
const uint8_t vfFirstChar = 33;
|
||||
const uint8_t vfLastChar = 255;
|
||||
#define VF_CHAR_WIDTH 13
|
||||
#define VF_SCALE 12
|
||||
#define VF_OFFSET_Y (-3)
|
||||
#define VF_SCALE 16
|
||||
#define VF_OFFSET_Y (-2)
|
||||
#define VF_CHAR_SPACING 1
|
||||
static const uint8_t vfPolyVerts[] IN_FLASH_MEMORY = {
|
||||
169,171,197,195,
|
||||
|
||||
@ -441,8 +441,8 @@ var vector_font_c = `/*
|
||||
const uint8_t vfFirstChar = ${firstChar};
|
||||
const uint8_t vfLastChar = ${lastChar};
|
||||
#define VF_CHAR_WIDTH ${charWidth}
|
||||
#define VF_SCALE 12
|
||||
#define VF_OFFSET_Y (-3)
|
||||
#define VF_SCALE 16
|
||||
#define VF_OFFSET_Y (-2)
|
||||
#define VF_CHAR_SPACING 1
|
||||
static const uint8_t vfPolyVerts[] IN_FLASH_MEMORY = {
|
||||
${uniquePolys.map(p => p.join(",")).join(",\n ")}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user