mirror of
https://github.com/espruino/Espruino.git
synced 2025-12-08 19:06:15 +00:00
Lower size of timer task array of devices with little RAM (fix #401)
This commit is contained in:
parent
e1c9ea3d75
commit
641570adec
@ -1,4 +1,4 @@
|
||||
1v67 : ...
|
||||
1v67 : Lower size of timer task array of devices with little RAM (fix #401)
|
||||
|
||||
1v66 : Ensure that analogWrite(pin,1) works on negated outputs
|
||||
Allow multiple Waveform playback on one pin (+ wave fixes)
|
||||
|
||||
@ -229,11 +229,14 @@ codeOut("");
|
||||
if LINUX:
|
||||
bufferSizeIO = 256
|
||||
bufferSizeTX = 256
|
||||
bufferSizeTimer = 16
|
||||
else:
|
||||
bufferSizeIO = 64 if board.chip["ram"]<20 else 128
|
||||
bufferSizeTX = 32 if board.chip["ram"]<20 else 128
|
||||
bufferSizeTimer = 4 if board.chip["ram"]<20 else 16
|
||||
codeOut("#define IOBUFFERMASK "+str(bufferSizeIO-1)+" // (max 255) amount of items in event buffer - events take ~9 bytes each")
|
||||
codeOut("#define TXBUFFERMASK "+str(bufferSizeIO-1)+" // (max 255)")
|
||||
codeOut("#define TXBUFFERMASK "+str(bufferSizeTX-1)+" // (max 255)")
|
||||
codeOut("#define UTILTIMERTASK_TASKS ("+str(bufferSizeTimer-1)+") // Must be power of 2 - and max 256")
|
||||
|
||||
codeOut("");
|
||||
|
||||
|
||||
@ -14,7 +14,6 @@
|
||||
#include "jstimer.h"
|
||||
#include "jsparse.h"
|
||||
|
||||
#define UTILTIMERTASK_TASKS (16) // MUST BE POWER OF 2
|
||||
UtilTimerTask utilTimerTasks[UTILTIMERTASK_TASKS];
|
||||
volatile unsigned char utilTimerTasksHead = 0;
|
||||
volatile unsigned char utilTimerTasksTail = 0;
|
||||
|
||||
@ -61,8 +61,8 @@ typedef struct UtilTimerTaskBuffer {
|
||||
JsVar *var; ///< variable to get data from
|
||||
JsVarRef currentBuffer; ///< The current buffer we're reading from (or 0)
|
||||
JsVarRef nextBuffer; ///< Subsequent buffer to read from (or 0)
|
||||
unsigned char charIdx; ///< Index of character in variable
|
||||
unsigned short currentValue; ///< current value being written (for writes)
|
||||
unsigned char charIdx; ///< Index of character in variable
|
||||
union {
|
||||
JshPinFunction pinFunction; ///< Pin function to write to
|
||||
Pin pin; ///< Pin to read from
|
||||
@ -78,8 +78,8 @@ typedef union UtilTimerTaskData {
|
||||
typedef struct UtilTimerTask {
|
||||
JsSysTime time; // time at which to set pins
|
||||
unsigned int repeatInterval; // if nonzero, repeat the timer
|
||||
UtilTimerEventType type;
|
||||
UtilTimerTaskData data; // data used when timer is hit
|
||||
UtilTimerEventType type; // the type of this task - do we set pin(s) or read/write data
|
||||
} PACKED_FLAGS UtilTimerTask;
|
||||
|
||||
void jstUtilTimerInterruptHandler();
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user