( !Startup)
( ONLY TO BE USED WITH RASPBERRY PI)

DECIMAL

( sreen mode block initialisation for LapDock / LG monitor)
( - quick fudge to get appropriate screen mode)
: addrmode ' NOWIMPS 24 + ; 
( 1280) 1920 addrmode 4 + !     ( X)
( 720)  1080 addrmode 8 + !     ( Y)

3 STRING cat$     cat$ STRCPY" CAT"
4 50 STRING[] app_dir$        ( for holding nonGPIO,GPIOTank,GPIOForth pathnames)
1 app_dir$ STRCPY" DIR <rforth$dir>.Examples.nonGPIO"
2 app_dir$ STRCPY" DIR <rforth$dir>.Examples.GPIOTank"
3 app_dir$ STRCPY" DIR <rforth$dir>.Examples.GPIOForth"

( addr of command...)  ( eg CDIR fred)
: do_oscli  DUP 4+ SWAP LEN OSCLI ;

: cat cat$ do_oscli ;

OSCLI" DIR <rforth$dir>.Support"
FLOAD" Misc_words"
FLOAD" Colour"
FLOAD" Float"

( load application names into array)
22 20 STRING[] all_apps
0 all_apps STRCPY" Exit"
1 all_apps STRCPY" FPTPtable"  ( floating point version)
2 all_apps STRCPY" FFT_App"
3 all_apps STRCPY" simequ_app"
4 all_apps STRCPY" calc_det3"
5 all_apps STRCPY" calc_det4"
6 all_apps STRCPY" MatrixMult"
7 all_apps STRCPY" Recursion"
8 all_apps STRCPY" 3tasks"

9  all_apps STRCPY" DCMotor_App"
10 all_apps STRCPY" SPI3208_App"
11 all_apps STRCPY" DCservo_App" 
12 all_apps STRCPY" 2Steppers"
13 all_apps STRCPY" ADS1115_App"
14 all_apps STRCPY" I2C_bitbang_App"

15 all_apps STRCPY" DCMotorForth_App"
16 all_apps STRCPY" SPI3208Forth_App"
17 all_apps STRCPY" DCservoForth" 
18 all_apps STRCPY" 2SteppersForth"
19 all_apps STRCPY" ADS1115Forth_App"
20 all_apps STRCPY" I2C_bitbangForth_App"


: app_path  9 -   6 /MOD SWAP DROP 2+ ;  ( option no...path no)
: load_apps  all_apps FLOAD  ;  ( n...)

: sel_app
 BEGIN
  CR ."  non-GPIO progs:" CR
  ."                                  Exit  (0)" CR
  ."  Temperature and Pressure Corrections  (1)" CR
  ."          Fast Fourier Transfoms (FFT)  (2)" CR
  ."                Simultaneous Equations  (3)" CR
  ."                      3x3 Determinants  (4)" CR
  ."                      4x4 Determinants  (5)" CR
  ."                 Matrix Multiplication  (6)" CR
  ."             Two Examples of Recursion  (7)" CR
  ."       Simple Example of Multitasking   (8)" CR

  CR CR ."  Using GPIO pins with module by 'Tank':" CR
  ."      DC Motor control with L293D chip  (9)" CR
  ."     Using SPI Bus to read SPI3208 ADC (10)" CR
  ."    DC Motor servoing with pot and ADC (11)" CR
  ."       Stepper Motors (1 or 2) control (12)" CR
  ."    IIC interface to read ADS1115C ADC (13)" CR
  ."          'Bit-banging' IIC simulation (14)" CR

  CR CR ."  Using GPIO pins controlled directly by Forth:" CR
  ."      DC Motor control with L293D chip (15)" CR
  ."     Using SPI Bus to read SPI3208 ADC (16)" CR
  ."    DC Motor servoing with pot and ADC (17)" CR
  ."       Stepper Motors (1 or 2) control (18)" CR
  ."    IIC interface to read ADS1115C ADC (19)" CR
  ."          'Bit-banging' IIC simulation (20)" CR

  CR ." Enter 0 to 20: " QUERY INTERPRET
  DUP 0 20  twixt
 UNTIL
 DUP 9 < IF           1      app_dir$   do_oscli   ( select pathname for prog)
         ELSE  DUP app_path  app_dir$   do_oscli 
         ENDIF
 load_apps ;   ( option...)


( sel_app)

