Merge branch 'master' into flash_storage

This commit is contained in:
Gordon Williams 2018-02-13 12:40:34 +00:00
commit 5822cc5c20
5 changed files with 12 additions and 9 deletions

View File

@ -99,10 +99,10 @@ hdiutil attach ~/diskimages/Espruino.sparsebundle
```
mkdir /Espruino/{gcc,sdk,repos,tmp}
/Espruino -+- gcc GNU Compiler Collection for different processors
+- sdk Software Development Kits
/Espruino -+- gcc GNU Compiler Collection for different processors
+- sdk Software Development Kits
+- repos like Espruino EspruinoDocs ...
+- tmp temporary files
+- tmp temporary files
```
#### Install build and flash tools

View File

@ -294,6 +294,7 @@ else:
codeOut("#define FLASH_SAVED_CODE_START "+str(flash_saved_code_start))
codeOut("#define FLASH_SAVED_CODE_LENGTH "+str(int(flash_page_size*flash_saved_code_pages)))
codeOut("");
codeOut("#define CLOCK_SPEED_MHZ "+str(board.chip["speed"]))
codeOut("#define USART_COUNT "+str(board.chip["usart"]))
codeOut("#define SPI_COUNT "+str(board.chip["spi"]))
codeOut("#define I2C_COUNT "+str(board.chip["i2c"]))

View File

@ -156,7 +156,7 @@ IOEventFlags jsiGetPreferredConsoleDevice() {
#endif
#ifdef USB
if (jshIsUSBSERIALConnected())
consoleDevice = EV_USBSERIAL;
dev = EV_USBSERIAL;
#endif
#ifdef BLUETOOTH
if (jsble_has_simple_connection(dev))
@ -861,6 +861,7 @@ void jsiOneSecondAfterStartup() {
char or two can get corrupted.
*/
#ifdef USB
if (consoleDevice == EV_LIMBO) {
consoleDevice = jsiGetPreferredConsoleDevice();
// now move any output that was made to Limbo to the given device

View File

@ -1046,7 +1046,7 @@ JsVar *jsvNewNativeFunction(void (*ptr)(void), unsigned short argTypes) {
}
JsVar *jsvNewNativeString(char *ptr, size_t len) {
if (len<65535) len=65535; // crop string to 65535 characters because that's all be can store in nativeStr.len
if (len>65535) len=65535; // crop string to 65535 characters because that's all be can store in nativeStr.len
JsVar *str = jsvNewWithFlags(JSV_NATIVE_STRING);
if (!str) return 0;
str->varData.nativeStr.ptr = ptr;

View File

@ -51,7 +51,6 @@
#define IRQ_PRIOR_LOW 15
#ifdef USE_RTC
#include "jswrap_date.h" // for non-F1 calendar -> days since 1970 conversion
// TODO: could jshRTCPrescaler (and the hardware prescaler) be modified on SysTick, to calibrate the LSI against the HSE?
@ -70,6 +69,8 @@ JsSysTime jshGetRTCSystemTime();
static JsSysTime jshGetTimeForSecond();
// The amount of systicks for one second depends on the clock speed
#define SYSTICKS_FOR_ONE_SECOND (1+(CLOCK_SPEED_MHZ*1000000/SYSTICK_RANGE))
// see jshPinWatch/jshGetWatchedPinState
Pin watchedPins[16];
@ -97,11 +98,11 @@ JsSysTime jshLastWokenByUSB = 0;
* and then masking off the top bit */
unsigned char jsh7BitUART;
bool jshIsSerial7Bit(IOEventFlags device) {
assert(SERIAL_COUNT<=8);
assert(USART_COUNT<=8);
return jsh7BitUART & (1<<(device-EV_SERIAL1));
}
void jshSetIsSerial7Bit(IOEventFlags device, bool is7Bit) {
assert(SERIAL_COUNT<=8);
assert(USART_COUNT<=8);
if (is7Bit) jsh7BitUART |= (1<<(device-EV_SERIAL1));
else jsh7BitUART &= ~(1<<(device-EV_SERIAL1));
}
@ -836,7 +837,7 @@ void jshDoSysTick() {
/* One second after start, call jsinteractive. This is used to swap
* to USB (if connected), or the Serial port. */
if (ticksSinceStart == 5) {
if (ticksSinceStart == SYSTICKS_FOR_ONE_SECOND) {
jsiOneSecondAfterStartup();
}
}