Home
JAQForum Ver 24.01
Log In or Join  
Active Topics
Local Time 15:19 29 Dec 2024 Privacy Policy
Jump to

Notice. New forum software under development. It's going to miss a few functions and look a bit ugly for a while, but I'm working on it full time now as the old forum was too unstable. Couple days, all good. If you notice any issues, please contact me.

Forum Index : Microcontroller and PC projects : PicoMite V6.00.01 release candidates - please test thoroughly

     Page 22 of 22    
Author Message
matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 9304
Posted: 09:05am 28 Dec 2024
Copy link to clipboard 
Print this post

  Quote  

Joined: 30/10/2014
Location: Germany
Posts: 175

Posted: 05:52pm 27 Dec 2024
Copy link to clipboard

Print this post

Quote

Hi,

a comment regarding I2C:
The preliminary manual for version 6 says under "I2C OPEN speed, timeout": "... ‘speed’ is the clock speed (in KHz) to use and must be one of 100, 400 or 1000."
For 1000 KHz, I get:


Will allow 1000 in the release firmware for OPEN. For OPTION SYSTEM I2C the default is 400 and you can specify SLOW to set 100.

NOTE to all: I am just about to cut the release version of 6.00.01 so any bugs then speak now or forever hold your peace
 
IanT
Regular Member

Joined: 29/11/2016
Location: United Kingdom
Posts: 88
Posted: 09:39am 28 Dec 2024
Copy link to clipboard 
Print this post

As you jog lightly to the top of the latest (Pico) hill Peter, pause and look back.

There in the far, far distance you will see a grey haired old guy, puffing along trying (and failing) to keep up with the crowd. If you could just leave a good updated manual on the side of the road for me, I'll have a long sit down with it and get my breath back before resuming the chase.

Hope you had a great Christmas and have an even better New Year. Thank you (and the rest of the MMB team) for all your efforts this past year.

Best Regards,


IanT
 
javavi

Guru

Joined: 01/10/2023
Location: Ukraine
Posts: 305
Posted: 03:44pm 28 Dec 2024
Copy link to clipboard 
Print this post

The command OPTION PSRAM PIN DISABLE can be changed to simply OPTION PSRAM DISABLE
Similar to OPTION KEYBOARD DISABLE
 
matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 9304
Posted: 04:19pm 28 Dec 2024
Copy link to clipboard 
Print this post

The 6.00.01 release is now frozen. Source on Github
Edited 2024-12-29 02:20 by matherp
 
homa

Guru

Joined: 05/11/2021
Location: Germany
Posts: 388
Posted: 05:37pm 28 Dec 2024
Copy link to clipboard 
Print this post

  matherp said  The 6.00.01 release is now frozen. Source on Github

Good news Peter, thank you very much!
I wish you a happy new year!
Here's to the Pico story continuing for a long time to come.

Matthias
 
homa

Guru

Joined: 05/11/2021
Location: Germany
Posts: 388
Posted: 06:30pm 28 Dec 2024
Copy link to clipboard 
Print this post

Hello Peter,

The ZIP from Github still shows RC10 after flashing (HDMIUSB)!


> option list
PicoMiteHDMI MMBasic USB RP2350A Edition V6.00.01RC10
OPTION SERIAL CONSOLE COM2,GP8,GP9
OPTION FLASH SIZE 4194304
OPTION COLOURCODE ON
OPTION KEYBOARD US
OPTION CPUSPEED (KHz) 315000
> option reset hdmiusb
PicoMiteHDMI MMBasic USB RP2350A Edition V6.00.01RC10
OPTION SERIAL CONSOLE COM2,GP8,GP9
OPTION SYSTEM I2C GP20,GP21
OPTION FLASH SIZE 4194304
OPTION COLOURCODE ON
OPTION KEYBOARD US
OPTION CPUSPEED (KHz) 315000
OPTION DISPLAY 24, 80
OPTION SDCARD GP22, GP26, GP27, GP28
OPTION AUDIO GP10,GP11', ON PWM CHANNEL 5
OPTION RTC AUTO ENABLE
OPTION MODBUFF ENABLE  192
OPTION PLATFORM HDMIUSB
>


And then I just stumbled across an error? Or I'm using the command incorrectly.

You write in this thread on page 20:
MATH(BASE64 ENCODE/DECODE in$/in(), out$/out())


Print "Key: ";r$
'MATH(BASE64 ENCODE/DECODE in$/in(), out$/out())
Math BASE64 DECODE r$, rout$
Print "Decode: ",rout$

==>

Key: uAgmNI5MkmTc9E3jQl0N1g==
[47] Math BASE64 DECODE r$, rout$
Error : Syntax


I get an error here in the RC10, whether HDMIUSB or WebMite version ...
With brackets, without brackets, ... how should I use this?

Matthias
 
matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 9304
Posted: 06:46pm 28 Dec 2024
Copy link to clipboard 
Print this post

  Quote  The ZIP from Github still shows RC10 after flashing (HDMIUSB)!


Thanks - will fix

  Quote  With brackets, without brackets, ... how should I use this?


Its a function returning the length of the output, not a command
MATH(BASE64 ENCODE/DECODE in$/in(), out$/out())
 
twofingers
Guru

Joined: 02/06/2014
Location: Germany
Posts: 1321
Posted: 07:40pm 28 Dec 2024
Copy link to clipboard 
Print this post

PicoMiteHDMI MMBasic RP2350A Edition V6.00.01RC10

Hi Peter,
is there a way to free up the memory occupied by a long string?'
LS_SIZE=10400
CLS
Print MM.Info(heap)
Memory

Dim inp%(LS_SIZE),out%(LS_SIZE)
a$=String$(80,"x"):For i = 1 To 1000:LongString append inp%(),a$:Next
Print "Array length "LLen(inp%())

Print
Print "After DIM of two longstring arrays"
Print MM.Info(heap)
Memory

LongString CLEAR inp%()
LongString CLEAR out%()
'For i = 1 To 1000:LongString append inp%(),a$:Next
'LongString RESIZE inp%(),0
'LongString trim inp%(),1000
Print
Print "After CLEAR"
Print MM.Info(heap)
Memory

End


After CLEAR
16384
Program:
  2K ( 1%) Program (105 lines)
178K (99%) Free

Saved Variables:
 16K (100%) Free

RAM:
164K (71%) 6 Variables
  0K ( 0%) General
 64K (29%) Free


Regards
Michael
causality ≠ correlation ≠ coincidence
 
matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 9304
Posted: 07:57pm 28 Dec 2024
Copy link to clipboard 
Print this post

erase inp%()
 
twofingers
Guru

Joined: 02/06/2014
Location: Germany
Posts: 1321
Posted: 08:11pm 28 Dec 2024
Copy link to clipboard 
Print this post

  matherp said  erase inp%()

Works! I thought there was a long string command for this, but couldn't find one.
Thank you very much!

Please note:
erasetest()
End
Sub erasetest()
Local inp%(10400)
Memory
Erase inp%()
Local inp%(10400)
End Sub


> RUN
Program:
  2K ( 1%) Program (99 lines)
178K (99%) Free

Saved Variables:
 16K (100%) Free

RAM:
 82K (35%) 2 Variables
  0K ( 0%) General
146K (65%) Free
[6] Erase inp%()
Error : Cannot find INP


same thing here:
erasetest()
End
Sub erasetest()
Local integer temp
Erase temp
End Sub


[5] Erase temp
Error : Cannot find TEMP


Sorry!
Edited 2024-12-29 09:49 by twofingers
causality ≠ correlation ≠ coincidence
 
disco4now

Guru

Joined: 18/12/2014
Location: Australia
Posts: 918
Posted: 01:42am 29 Dec 2024
Copy link to clipboard 
Print this post

  twofingers said  
[5] Erase temp
Error : Cannot find TEMP


Sorry!


I think this would be the expected behavior.

A variable defined as LOCAL inside a SUB is removed by MMBasic when the END SUB is reached. IF you explicitly ERASE it inside the SUB, then MMBasic will rightly complain that is can't be found when it tries to remove it.

P.S.
May be not entirely accurate reasoning as the error is on the ERASE command, but certainly to do with trying to ERASE a LOCAL variable.( which would be removed at END SUB in any case}
Edited 2024-12-29 11:51 by disco4now
Latest F4 Latest H7
 
phil99

Guru

Joined: 11/02/2018
Location: Australia
Posts: 2191
Posted: 02:22am 29 Dec 2024
Copy link to clipboard 
Print this post

Perhaps ERASE only looks in the table of global variables and therefore will never find "temp".

To test DIM a  global "temp" an see what happens.

PS. Tried it and only the global is erased.
 
twofingers
Guru

Joined: 02/06/2014
Location: Germany
Posts: 1321
Posted: 02:37am 29 Dec 2024
Copy link to clipboard 
Print this post

  disco4now said  ... A variable defined as LOCAL inside a SUB is removed by MMBasic when the END SUB is reached. IF you explicitly ERASE it inside the SUB, then MMBasic will rightly complain that is can't be found when it tries to remove it. ...

Thanks for your answer! Yes, I thought about that too, but that doesn't help if I have to delete a variable within a sub. I was hoping to find something like a reDIM. I was hoping Peter could "adapt" something in MMBasic version 7.0 ...  
I'm just trying things out at the moment. I haven't worked with long strings before.

There might also have been the possibility that Peter knew of a mechanism to release the allocated memory within the subroutine.

Kind regards and peaceful holidays
Michael

EDIT:
@Phil
The global ones are not the problem, but you figured that out yourself!
Edited 2024-12-29 12:40 by twofingers
causality ≠ correlation ≠ coincidence
 
phil99

Guru

Joined: 11/02/2018
Location: Australia
Posts: 2191
Posted: 03:04am 29 Dec 2024
Copy link to clipboard 
Print this post

If you are going to erase the variable after using it anyway it does not need to be local.
To eliminate confusion with other variables that have the same name add the Sub name to the variable name.
Eg
Sub Test
   Dim Test_temp
   'do stuff with Test_temp
   Erase Test_temp
   'do other stuff
End Sub
 
twofingers
Guru

Joined: 02/06/2014
Location: Germany
Posts: 1321
Posted: 03:21am 29 Dec 2024
Copy link to clipboard 
Print this post

  phil99 said  If you are going to erase the variable after using it anyway it does not need to be local. ...

It works so far. So it's more something for the manual. Many thanks!
Michael
test()
End
Sub Test
  Dim integer Test_temp(10000)
 'do stuff with Test_temp
  Erase Test_temp()
  Dim integer Test_temp(10000) 'redim
  For i = 1 To 10000
    test_temp(i)=i
    Print test_temp(i);
  Next
  Erase Test_temp()
  Print : Print "ready!"
  'do other stuff
End Sub

causality ≠ correlation ≠ coincidence
 
disco4now

Guru

Joined: 18/12/2014
Location: Australia
Posts: 918
Posted: 03:29am 29 Dec 2024
Copy link to clipboard 
Print this post

The ZIP from Github still shows RC10 after flashing RP2040 versions of Picomite,PicomiteVGA and Webmite.


> update firmware
PicoMite MMBasic RP2040 Edition V6.00.01RC10
Copyright 2011-2024 Geoff Graham
Copyright 2016-2024 Peter Mather

The PicoCFunctions.h in the zip needs updating. It seems to have the latest addions for alternate KEYBOARD_CLOCk and DATA but is based on CMM2 file.

Also the copy of PicoCFunctions.h in the src directory needs an update as recent changes re KEYBOARD_CLOCK/DATA are not included.
Suggested updated version below.




/*******************************************************************************************
*
*  Definitions used when calling MMBasic Interpreter API Functions from CFunctions
*  For PicoMite MMBasic V6.00.01
*
*  This file is public domain and may be used without license.
*
*  Use with AMRCFGENV144.bas
*
*  V1.6.2
*  NB: Base address has changed from previous versions to match V5.07.05
*  V1.6.3  struct option_s updated to match 5.07.05 as defined in fileIO.h
*  V1.6.4  Additional links
*  v1.6.5  Latest Beta29 and PICOMITEVGA PICOMITEWEB Compiled with GCC 11.2.1
*  v1.6.6  Updated to match 5.07.07 and 5.07.08b5 updates for fixed IP address
*  v1.6.7  Updated to match 5.07.08 release matches option_s and CSubComplete now char
*  v2.0.0  Updated for MMBasic 6.00.00 and also for RP2350 chip.
*          BaseAddress is different for PICO and PICO2 Set the correct #define
*          Note: Use ? HEX$(MM.INFO(CALLTABLE)) to verify the location of the calltable.
*          struct option_s updated to match v6.00.00RC15
*  v2.0.1  struct option_s updated to match v6.00.01 Release
*
******************************************************************************************/
/*** Uncomment one of these three  ***/
#define PICOMITE
//#define PICOMITEVGA
//#define PICOMITEWEB

/***  Uncomment this define if using PICO2 Chip  ***/
#define PICORP2350

/***  Uncomment this define if HDMI pins required  ***/
#define GUICONTROLS

/*****************************************************************************************/
#define MAXVARLEN           32                      // maximum length of a variable name
#define MAXDIM              5                       // maximum nbr of dimensions to an array
#define MMFLOAT double
#define MAXKEYLEN 64

//Addresses in the API Table for the pointers to each function
#ifdef PICORP2350
 #define BaseAddress   0x1000023C
#else
 #define BaseAddress   0x100002D4
#endif

#define Vector_uSec               (*(unsigned int *)(BaseAddress+0x00))       // void uSec(unsigned int us)
#define Vector_putConsole         (*(unsigned int *)(BaseAddress+0x04))       // void putConsole(int C))
#define Vector_getConsole         (*(unsigned int *)(BaseAddress+0x08))       // int getConsole(void)
#define Vector_ExtCfg             (*(unsigned int *)(BaseAddress+0x0C))       // void ExtCfg(int pin, int cfg, int option)
#define Vector_ExtSet             (*(unsigned int *)(BaseAddress+0x10))       // void ExtSet(int pin, int val)
#define Vector_ExtInp             (*(unsigned int *)(BaseAddress+0x14))       // int ExtInp(int pin)
#define Vector_PinSetBit          (*(unsigned int *)(BaseAddress+0x18))       // void PinSetBit(int pin, unsigned int offset)
#define Vector_PinRead            (*(unsigned int *)(BaseAddress+0x1C))       // int PinRead(int pin)
#define Vector_MMPrintString      (*(unsigned int *)(BaseAddress+0x20))       // void MMPrintString(char* s)
#define Vector_IntToStr           (*(unsigned int *)(BaseAddress+0x24))       // void IntToStr(char *strr, long long int nbr, unsigned int base)
#define Vector_CheckAbort         (*(unsigned int *)(BaseAddress+0x28))       // void CheckAbort(void)
#define Vector_GetMemory          (*(unsigned int *)(BaseAddress+0x2C))       // void *GetMemory(size_t msize);
#define Vector_GetTempMemory      (*(unsigned int *)(BaseAddress+0x30))       // void *GetTempMemory(int NbrBytes)
#define Vector_FreeMemory         (*(unsigned int *)(BaseAddress+0x34))       // void FreeMemory(void *addr)
#define Vector_DrawRectangle      *(unsigned int *)(BaseAddress+0x38 )        // void DrawRectangle(int x1, int y1, int x2, int y2, int C))
#define Vector_DrawBitmap         *(unsigned int *)(BaseAddress+0x3c )        // void DrawBitmap(int x1, int y1, int width, int height, int scale, int fg, int bg, unsigned char *bitmap )
#define Vector_DrawLine           (*(unsigned int *)(BaseAddress+0x40))       // void DrawLine(int x1, int y1, int x2, int y2, int w, int C))
#define Vector_FontTable          (*(unsigned int *)(BaseAddress+0x44))       // const unsigned char *FontTable[FONT_NBR]
#define Vector_ExtCurrentConfig   (*(unsigned int *)(BaseAddress+0x48))       // int ExtCurrentConfig[NBRPINS + 1];
#define Vector_HRes               (*(unsigned int *)(BaseAddress+0x4C))       // HRes
#define Vector_VRes               (*(unsigned int *)(BaseAddress+0x50))       // VRes
#define Vector_SoftReset          (*(unsigned int *)(BaseAddress+0x54))       // void SoftReset(void)
#define Vector_error              (*(unsigned int *)(BaseAddress+0x58))       // void error(char *msg)
#define Vector_ProgFlash          (*(unsigned int *)(BaseAddress+0x5C))       // ProgFlash
#define Vector_vartbl             (*(unsigned int *)(BaseAddress+0x60))       // vartbl
#define Vector_varcnt             (*(unsigned int *)(BaseAddress+0x64))       // varcnt
#define Vector_DrawBuffer         *(unsigned int *)(BaseAddress+0x68 )        // void DrawRectangle(int x1, int y1, int x2, int y2, int C))
#define Vector_ReadBuffer         *(unsigned int *)(BaseAddress+0x6c )        // void DrawRectangle(int x1, int y1, int x2, int y2, int C))
#define Vector_FloatToStr         (*(unsigned int *)(BaseAddress+0x70))       // convert a float to a string including scientific notation if necessary
#define Vector_ExecuteProgram     (*(unsigned int *)(BaseAddress+0x74))       // void ExecuteProgram(char *fname)
#define Vector_CFuncmSec          (*(unsigned int *)(BaseAddress+0x78))       // CFuncmSec
#define Vector_CFuncRam           (*(unsigned int *)(BaseAddress+0x7C))       // StartOfCFuncRam
#define Vector_ScrollLCD          *(unsigned int *)(BaseAddress+0x80 )        // void scrollLCD(int lines, int blank)
#define Vector_IntToFloat         (*(unsigned int *)(BaseAddress+0x84))       // MMFLOAT IntToFloat(long long int a)
#define Vector_FloatToInt         (*(unsigned int *)(BaseAddress+0x88))       // long long int FloatToInt64(MMFLOAT x)
#define Vector_Option             (*(unsigned int *)(BaseAddress+0x8C))       // Option
#define Vector_Sine               (*(unsigned int *)(BaseAddress+0x90))       // MMFLOAT sin(MMFLOAT)
#define Vector_DrawCircle         (*(unsigned int *)(BaseAddress+0x94))       // DrawCircle(int x, int y, int radius, int w, int c, int fill, MMFLOAT aspect)
#define Vector_DrawTriangle       (*(unsigned int *)(BaseAddress+0x98))       // DrawTriangle(int x0, int y0, int x1, int y1, int x2, int y2, int c, int fill)
#define Vector_Timer      (*(unsigned int *)(BaseAddress+0x9C))       // uint64_t timer(void)
#define Vector_FMul      (*(unsigned int *)(BaseAddress+0xA0))       // MMFLOAT FMul(MMFLOAT a, MMFLOAT b){ return a * b; }
#define Vector_FAdd      (*(unsigned int *)(BaseAddress+0xA4))       // MMFLOAT FAdd(MMFLOAT a, MMFLOAT b){ return a + b; }
#define Vector_FSub      (*(unsigned int *)(BaseAddress+0xA8))       // MMFLOAT FSub(MMFLOAT a, MMFLOAT b){ return a - b; }
#define Vector_FDiv        (*(unsigned int *)(BaseAddress+0xAC))       // MMFLOAT FDiv(MMFLOAT a, MMFLOAT b){ return a / b; }
#define Vector_FCmp      (*(unsigned int *)(BaseAddress+0xB0))       // int   FCmp(MMFLOAT a,MMFLOAT b){if(a>b) return 1;else if(a<b)return -1; else return 0;}
#define Vector_LoadFloat        (*(unsigned int *)(BaseAddress+0xB4))       /* MMFLOAT LoadFloat(unsigned long long C)){union ftype{ unsigned long long a; MMFLOAT b;}f;f.a=c;return f.b; }*/
#define Vector_CFuncInt1          *(unsigned int *)(BaseAddress+0xB8 )        // CFuncInt1
#define Vector_CFuncInt2          *(unsigned int *)(BaseAddress+0xBC)         // CFuncInt2
#define Vector_CSubComplete    (*(unsigned int *)(BaseAddress+0xC0))       // CSubComplete
#define Vector_AudioOutput        *(unsigned int *)(BaseAddress+0xC4)         // AudioOutput(int left, int right)
#define Vector_IDiv      (*(unsigned int *)(BaseAddress+0xC8))       // int IDiv(int a, int b){ return a / b; }
#define Vector_AUDIO_WRAP         (*(volatile unsigned int *)(BaseAddress+0xCC))// AUDIO_WRAP
#define Vector_CFuncInt3          *(unsigned int *)(BaseAddress+0xD0 )        // CFuncInt3
#define Vector_CFuncInt4          *(unsigned int *)(BaseAddress+0xD4)         // CFuncInt4
#define Vector_PIOExecute         (*(unsigned int *)(BaseAddress+0xD8))       // void PioExecute(int pio, int sm, uint32_t instruction)



//Macros to call each function.
#define uSec(a)                         ((void  (*)(unsigned long long )) Vector_uSec) (a)
#define putConsole(a,b)                 ((void(*)(int, int)) Vector_putConsole) (a,b)
#define getConsole()                    ((int (*)(void)) Vector_getConsole) ()
#define ExtCfg(a,b,c)                   ((void (*)(int, int, int)) Vector_ExtCfg) (a,b,c)
#define ExtSet(a,b)                     ((void(*)(int, int)) Vector_ExtSet) (a,b)
#define ExtInp(a)                       ((int(*)(int)) Vector_ExtInp) (a)
#define PinSetBit(a,b)                  ((void(*)(int, int)) Vector_PinSetBit) (a,b)
#define PinRead(a)                      ((int(*)(int)) Vector_PinRead) (a)
#define MMPrintString(a)                ((void (*)(char*)) Vector_MMPrintString) (a)
#define IntToStr(a,b,c)                 ((void (*)(char *, long long int, unsigned int)) Vector_IntToStr) (a,b,c)
#define CheckAbort()                    ((void (*)(void)) Vector_CheckAbort) ()
#define GetMemory(a)                    ((void* (*)(int)) Vector_GetMemory) (a)
#define GetTempMemory(a)                ((void* (*)(int)) Vector_GetTempMemory) (a)
#define FreeMemory(a)                   ((void (*)(void *)) Vector_FreeMemory) (a)
#define DrawRectangle(a,b,c,d,e)        ((void (*)(int,int,int,int,int)) (*(unsigned int *)Vector_DrawRectangle)) (a,b,c,d,e)
#define DrawRectangleVector             (*(unsigned int *)Vector_DrawRectangle)
#define DrawBitmap(a,b,c,d,e,f,g,h)     ((void (*)(int,int,int,int,int,int,int, char*)) (*(unsigned int *)Vector_DrawBitmap)) (a,b,c,d,e,f,g,h)
#define DrawBitmapVector                (*(unsigned int *)Vector_DrawBitmap)
#define DrawLine(a,b,c,d,e,f)           ((void (*)(int,int,int,int,int,int)) Vector_DrawLine) (a,b,c,d,e,f)
#define FontTable                       (void*)((int*)(Vector_FontTable))
#define ExtCurrentConfig                ((int *) Vector_ExtCurrentConfig)
#define HRes                            (*(unsigned int *) Vector_HRes)
#define VRes                            (*(unsigned int *) Vector_VRes)
#define SoftReset()                     ((void (*)(void)) Vector_SoftReset) ()
#define error(a)                        ((void (*)(char *)) Vector_error) (a)
#define ProgFlash                       ((int *) Vector_ProgFlash)
#define vartbl                          (*(struct s_vartbl *) Vector_vartbl)
#define varcnt                          (*(unsigned int *) Vector_varcnt)
#define DrawBuffer(a,b,c,d,e)           ((void (*)(int,int,int,int,char *)) (*(unsigned int *)Vector_DrawBuffer)) (a,b,c,d,e)
#define DrawBufferVector                (*(unsigned int *)Vector_DrawBuffer)
#define ReadBuffer(a,b,c,d,e)           ((void (*)(int,int,int,int,char *)) (*(unsigned int *)Vector_ReadBuffer)) (a,b,c,d,e)
#define ReadBufferVector                (*(unsigned int *)Vector_ReadBuffer)
#define FloatToStr(a,b,c,d,e)           ((void (*)(char *, MMFLOAT, int, int, char)) Vector_FloatToStr) (a,b,c,d,e)
// NOTE:  The argument to RunBasicSub is a string specifying the name of the BASIC subroutine to be executed.
//        It MUST be terminated with TWO null chars.
#define RunBasicSub(a)                  ((void (*)(char *)) Vector_ExecuteProgram) (a)
#define CFuncmSec                       (*(unsigned int *) Vector_CFuncmSec)
#define CFuncRam                        ((int *) Vector_CFuncRam)
#define ScrollLCD(a,b)                  ((void (*)(int, int)) (*(unsigned int *)Vector_ScrollLCD)) (a, b)
#define ScrollLCDVector                 (*(unsigned int *)Vector_ScrollLCD)
#define ScrollBufferV(a,b)              ((void (*)(int, int)) (*(unsigned int *)Vector_ScrollBufferV)) (a, b)
#define ScrollBufferVVector             (*(unsigned int *)Vector_ScrollBufferV)
#define ScrollBufferH(a)                ((void (*)(int)) (*(unsigned int *)Vector_ScrollBufferH)) (a)
#define ScrollBufferHVector             (*(unsigned int *)Vector_ScrollBufferH)
#define DrawBufferFast(a,b,c,d,e)       ((void (*)(int,int,int,int, char*)) (*(unsigned int *)Vector_DrawBufferFast)) (a,b,c,d,e)
#define DrawBufferFastVector            (*(unsigned int *)Vector_DrawBufferFast)
#define ReadBufferFast(a,b,c,d,e)       ((void (*)(int,int,int,int, char*)) (*(unsigned int *)Vector_ReadBufferFast)) (a,b,c,d,e)
#define ReadBufferFastVector            (*(unsigned int *)Vector_ReadBufferFast)
#define MoveBufferFast(a,b,c,d,e,f,g)   ((void (*)(int,int,int,int, int,int,int)) (*(unsigned int *)Vector_MoveBuffer)) (a,b,c,d,e,f,g)
#define MoveBufferFastVector            (*(unsigned int *)Vector_MoveBuffer)
#define DrawPixel(a,b,c)                ((void(*)(int, int, int)) Vector_DrawPixel) (a,b,c)
#define RoutineChecks()                 ((void (*)(void)) Vector_RoutineChecks) ()
#define GetPageAddress(a)               ((int(*)(int)) Vector_GetPageAddress) (a)
//#define memcpy(a,b,c)                   ((void (*)(void *, void *, int)) Vector_mycopysafe) (a,b,c)
#define IntToFloat(a)                   ((MMFLOAT (*)(long long)) Vector_IntToFloat) (a)
#define FloatToInt(a)                   ((long long (*)(MMFLOAT)) Vector_FloatToInt) (a)
#define Option (*(struct option_s *)(unsigned int)Vector_Option)
#define ReadPageAddress                 (*(unsigned int *) Vector_ReadPageAddress)
#define WritePageAddress                (*(unsigned int *) Vector_WritePageAddress)
#define uSecTimer                       ((unsigned long long (*)(void)) Vector_Timer)
#define FastTimer                       ((unsigned long long  (*)(void)) Vector_FastTimer)
#define TicksPerUsec                    (*(unsigned int *) Vector_TicksPerUsec)
#define map(a) ((int(*)(int)) Vector_Map) (a)
#define Sine(a)                         ((MMFLOAT (*)(MMFLOAT)) Vector_Sine) (a)
#define VideoColour                     (*(int *) Vector_VideoColour)
#define DrawCircle(a,b,c,d,e,f,g)       ((void (*)(int,int,int,int,int,int,MMFLOAT)) Vector_DrawCircle) (a,b,c,d,e,f,g)
#define DrawTriangle(a,b,c,d,e,f,g,h)   ((void (*)(int,int,int,int,int,int,int,int)) Vector_DrawTriangle) (a,b,c,d,e,f,g,h)
#define LoadFloat(a)                    ((MMFLOAT (*)(unsigned int)) Vector_LoadFloat) (a)
#define FMul(a,b)                       ((MMFLOAT (*)(MMFLOAT, MMFLOAT)) Vector_FMul) (a,b)
#define FAdd(a,b)                       ((MMFLOAT (*)(MMFLOAT, MMFLOAT)) Vector_FAdd) (a,b)
#define FSub(a,b)                       ((MMFLOAT (*)(MMFLOAT, MMFLOAT)) Vector_FSub) (a,b)
#define FDiv(a,b)                       ((MMFLOAT (*)(MMFLOAT, MMFLOAT)) Vector_FDiv) (a,b)
#define FCmp(a,b)                       ((int (*)(MMFLOAT, MMFLOAT)) Vector_FCmp) (a,b)
#define CFuncInt1                       (*(unsigned int *) Vector_CFuncInt1)
#define CFuncInt2                       (*(unsigned int *) Vector_CFuncInt2)
//#define Interrupt                       (*(unsigned int *) Vector_CSubComplete)
#define Interrupt                       (*(char *) Vector_CSubComplete)   //CSubComplete now char in 5.08.00
#define AudioOutputVector               (*(unsigned int *) Vector_AudioOutput)
#define AudioOutput(a,b)                ((void (*)(uint16_t, uint16_t)) (*(unsigned int *)Vector_AudioOutput)) (a, b)
#define IDiv(a,b)                       ((int (*)(int, int)) Vector_IDiv) (a,b)
#define AUDIO_WRAP                      (*(uint16_t *) Vector_AUDIO_WRAP)
#define CFuncInt3                       (*(unsigned int *) Vector_CFuncInt3)
#define CFuncInt4                       (*(unsigned int *) Vector_CFuncInt4)
#define PIOExecute(a,b,c)               ((void (*)(int, int, unsigned int)) Vector_PIOExecute) (a,b,c)



// the structure of the variable table, passed to the CFunction as a pointer Vector_vartbl which is #defined as vartbl
struct s_vartbl {                               // structure of the variable table
  char name[MAXVARLEN];                       // variable's name
  char type;                                  // its type (T_NUM, T_INT or T_STR)
  char level;                                 // its subroutine or function level (used to track local variables)
  unsigned char size;                         // the number of chars to allocate for each element in a string array
  char dummy;
  int __attribute__ ((aligned (4))) dims[MAXDIM];                     // the dimensions. it is an array if the first dimension is NOT zero
  union u_val{
      MMFLOAT f;                              // the value if it is a float
      long long int i;                        // the value if it is an integer
      MMFLOAT *fa;                            // pointer to the allocated memory if it is an array of floats
      long long int *ia;                      // pointer to the allocated memory if it is an array of integers
      char *s;                                // pointer to the allocated memory if it is a string
  }  __attribute__ ((aligned (8))) val;
} __attribute__ ((aligned (8))) val;

//  Useful macros


// Types used to define a variable in the variable table (vartbl).   Often they are ORed together.
// Also used in tokens and arguments to functions
#define T_NOTYPE       0                            // type not set or discovered
#define T_NBR       0x01                            // number (or float) type
#define T_STR       0x02                            // string type
#define T_INT       0x04                            // 64 bit integer type
#define T_PTR       0x08                            // the variable points to another variable's data
#define T_IMPLIED   0x10                            // the variables type does not have to be specified with a suffix
#define T_CONST     0x20                            // the contents of this variable cannot be changed
#define T_BLOCKED   0x40                            // Hash table entry blocked after ERASE


//***************************************************************************************************
// Constants and definitions copied from the Micromite MkII and Micromite Plus source
//***************************************************************************************************

//The Option structure

struct option_s {
   int  Magic;
   char Autorun;
   char Tab;
   char Invert;
   char Listcase; //8
 //
   unsigned int PROG_FLASH_SIZE;
   unsigned int HEAP_SIZE;
   char Height;
   char Width;
   unsigned char DISPLAY_TYPE;
   char DISPLAY_ORIENTATION; //12=20
//
   int  PIN;
   int  Baudrate;
   char  ColourCode;
   unsigned char MOUSE_CLOCK;
   unsigned char MOUSE_DATA;
   char spare;
   int CPU_Speed;
   unsigned int Telnet;           // 40 used to store status on console OFF/ON/BOTH
   int DefaultFC, DefaultBC;      // 44 the default colours
   short DefaultBrightness;         // 48 default backlight brightness //40
   unsigned char KEYBOARD_CLOCK;
   unsigned char KEYBOARD_DATA;
   unsigned short VGAFC, VGABC;  // the default colours 36=56  //50?
//
   // display related
   unsigned char DefaultFont;
   unsigned char KeyboardConfig;
   unsigned char RTC_Clock;
   unsigned char RTC_Data; //4=60
   //
   #ifdef PICOMITE
       int dummy;                // maximum number of controls allowed //48
   #endif

   #ifdef PICOMITEWEB
       uint16_t TCP_PORT;             // maximum number of controls allowed //48
       uint16_t ServerResponceTime;
   #endif
   #ifdef PICOMITEVGA
       int16_t X_TILE;                // maximum number of controls allowed //48
       int16_t Y_TILE;                // maximum number of controls allowed //48
   #endif
   // for the SPI LCDs 4=64
   unsigned char LCD_CD;
   unsigned char LCD_CS;
   unsigned char LCD_Reset;
   // touch related
   unsigned char TOUCH_CS;
   unsigned char TOUCH_IRQ;
   char TOUCH_SWAPXY;
   unsigned char repeat;
   char disabletftp;//56   8=72
   int  TOUCH_XZERO;
   int  TOUCH_YZERO;
   float TOUCH_XSCALE;
   float TOUCH_YSCALE; //72 16=88
#ifdef GUICONTROLS
   int MaxCtrls;
#else
   uint8_t HDMIclock;
   uint8_t HDMId0;
   uint8_t HDMId1;
   uint8_t HDMId2;
#endif
   unsigned int FlashSize; //8=96
   unsigned char SD_CS;
   unsigned char SYSTEM_MOSI;
   unsigned char SYSTEM_MISO;
   unsigned char SYSTEM_CLK;
   unsigned char DISPLAY_BL;
   unsigned char DISPLAY_CONSOLE;
   unsigned char TOUCH_Click;
   char LCD_RD;                   // used for the RD pin for SSD1963  //8=104
   unsigned char AUDIO_L;
   unsigned char AUDIO_R;
   unsigned char AUDIO_SLICE;
   unsigned char SDspeed;
   unsigned char pins[8];  //8=116                // general use storage for CFunctions written by PeterM //86
   char LCDVOP;
   char I2Coffset;
   unsigned char NoHeartbeat;
   char Refresh;
   unsigned char SYSTEM_I2C_SDA;
   unsigned char SYSTEM_I2C_SCL;
   unsigned char RTC;
   char PWM;  //8=124
   unsigned char INT1pin;
   unsigned char INT2pin;
   unsigned char INT3pin;
   unsigned char INT4pin;
   unsigned char SD_CLK_PIN;
   unsigned char SD_MOSI_PIN;
   unsigned char SD_MISO_PIN;
   unsigned char SerialConsole; //8=132
   unsigned char SerialTX;
   unsigned char SerialRX;
   unsigned char numlock;
   unsigned char capslock; //4=136
   unsigned int LIBRARY_FLASH_SIZE; // 4=140
   unsigned char AUDIO_CLK_PIN;
   unsigned char AUDIO_MOSI_PIN;
   unsigned char SYSTEM_I2C_SLOW;
   unsigned char AUDIO_CS_PIN;     //+4=144
   #ifdef PICOMITEWEB
       uint16_t UDP_PORT;
       uint16_t UDPServerResponceTime;
       char hostname[32];
       char ipaddress[16];
       char mask[16];
       char gateway[16];
       unsigned char x[1];  //112=256
   #else
       unsigned char x[85]; //112=256
   #endif
   unsigned char PSRAM_CS_PIN;
   unsigned char BGR;
   unsigned char NoScroll;
   unsigned char CombinedCS;
   unsigned char USBKeyboard;
   unsigned char VGA_HSYNC;
   unsigned char VGA_BLUE;
   unsigned char AUDIO_MISO_PIN;
   unsigned char AUDIO_DCS_PIN;
   unsigned char AUDIO_DREQ_PIN;
   unsigned char AUDIO_RESET_PIN;
   unsigned char SSD_DC;
   unsigned char SSD_WR;
   unsigned char SSD_RD;
   unsigned char SSD_RESET;
   unsigned char BackLightLevel;
   unsigned char NoReset;
   unsigned char AllPins;
   unsigned char modbuff;
short RepeatStart;
short RepeatRate;
   int modbuffsize;                // +18=
   unsigned char F1key[MAXKEYLEN];    //64=320
   unsigned char F5key[MAXKEYLEN];    //64=384
   unsigned char F6key[MAXKEYLEN];    //64=448
   unsigned char F7key[MAXKEYLEN];    //64=512
   unsigned char F8key[MAXKEYLEN];    //64=576
   unsigned char F9key[MAXKEYLEN];    //64=640
   unsigned char SSID[MAXKEYLEN];     //64=704
   unsigned char PASSWORD[MAXKEYLEN]; //64=768
   unsigned char platform[32];
   unsigned char extensions[96]; //128=896 == 7 XMODEM blocks
   // To enable older CFunctions to run any new options *MUST* be added at the end of the list
}  __attribute__((packed));


// Define the offsets from the PORT address
// these are used by GetPortAddr(a,b)
#define ANSEL               -8
#define ANSELCLR            -7
#define ANSELSET            -6
#define ANSELINV            -5
#define TRIS                -4
#define TRISCLR             -3
#define TRISSET             -2
#define TRISINV             -1
#define PORT                0
#define PORTCLR             1
#define PORTSET             2
#define PORTINV             3
#define LAT                 4
#define LATCLR              5
#define LATSET              6
#define LATINV              7
#define ODC                 8
#define ODCCLR              9
#define ODCSET              10
#define ODCINV              11
#define CNPU                12
#define CNPUCLR             13
#define CNPUSET             14
#define CNPUINV             15
#define CNPD                16
#define CNPDCLR             17
#define CNPDSET             18
#define CNPDINV             19
#define CNCON               20
#define CNCONCLR            21
#define CNCONSET            22
#define CNCONINV            23
#define CNEN                24
#define CNENCLR             25
#define CNENSET             26
#define CNENINV             27
#define CNSTAT              28
#define CNSTATCLR           29
#define CNSTATSET           30
#define CNSTATINV           31

// configurations for an I/O pin
// these are used by ExtCfg(a,b,c)
#define EXT_NOT_CONFIG          0
#define EXT_ANA_IN 1
#define EXT_DIG_IN 2
#define EXT_FREQ_IN 3
#define EXT_PER_IN 4
#define EXT_CNT_IN 5
#define EXT_INT_HI 6
#define EXT_INT_LO 7
#define EXT_DIG_OUT 8
#define EXT_HEARTBEAT 9
#define EXT_INT_BOTH  10
#define EXT_UART0TX 11
#define EXT_UART0RX 12
#define EXT_UART1TX 13
#define EXT_UART1RX 14
#define EXT_I2C0SDA 15
#define EXT_I2C0SCL 16
#define EXT_I2C1SDA 17
#define EXT_I2C1SCL 18
#define EXT_SPI0RX 19
#define EXT_SPI0TX 20
#define EXT_SPI0SCK 21
#define EXT_SPI1RX 22
#define EXT_SPI1TX 23
#define EXT_SPI1SCK 24
#define EXT_IR          25
#define EXT_INT1        26
#define EXT_INT2        27
#define EXT_INT3        28
#define EXT_INT4        29
#define EXT_PWM0A        30
#define EXT_PWM0B        31
#define EXT_PWM1A        32
#define EXT_PWM1B        33
#define EXT_PWM2A        34
#define EXT_PWM2B        35
#define EXT_PWM3A        36
#define EXT_PWM3B        37
#define EXT_PWM4A        38
#define EXT_PWM4B        39
#define EXT_PWM5A        40
#define EXT_PWM5B        41
#define EXT_PWM6A        42
#define EXT_PWM6B        43
#define EXT_PWM7A        44
#define EXT_PWM7B        45
#define EXT_PIO0_OUT      46
#define EXT_PIO1_OUT      47
#define EXT_DS18B20_RESERVED    0x100                 // this pin is reserved for DS18B20 and cannot be used
#define EXT_COM_RESERVED        0x200                 // this pin is reserved and SETPIN and PIN cannot be used
#define EXT_BOOT_RESERVED       0x400                 // this pin is reserved at bootup and cannot be used
#define NOP()  __asm volatile ("nop")
#define USERLCDPANEL            25


Latest F4 Latest H7
 
     Page 22 of 22    
Print this page


To reply to this topic, you need to log in.

© JAQ Software 2024