This is the open source Pawn interpreter ported to mbed. See here: http://www.compuphase.com/pawn/pawn.htm and here: http://code.google.com/p/pawnscript/

Dependents:   Pawn4Test

Some instructions:

  • Put the attached include folder next to your source, so when you compile you get all the proper definitions
  • Use the attached main.p as a starting point if you wish
  • Compile your main.p into main.amx - Put your main.amx on the mbed 'drive'
  • Reset and be amazed.

Important Compile Notes:

  • You should use the -S# option to define a smaller default stack size. Start with -S64 and go up from there if needed.
  • To use on the Cortex-M0 version of the mbed (LPC11U24), you MUST include the TARGET=3 command-line option as well, so the pin names are properly defined. In the future this may be handled on the native code side.

Known Issues:

  • At the moment it appears the kbhit() function is not working right - at least on my mac. Will continue testing on Windows. Working fine.

Todo:

  • Add more wrappers for the mbed peripherals
  • Add Pawn overlay support, to allow much larger scripts to run (even on the LPC11U24)
Committer:
Lobo
Date:
Fri May 24 17:49:26 2013 +0000
Revision:
3:185fdbb7ccf0
Parent:
0:3ab1d2d14eb3
Now includes AnalogIn and AnalogOut functions

Who changed what in which revision?

UserRevisionLine numberNew contents of line
tylerwilson 0:3ab1d2d14eb3 1 /**
tylerwilson 0:3ab1d2d14eb3 2 * Include file for the interface to mbed from Pawn interpreter.
tylerwilson 0:3ab1d2d14eb3 3 *
tylerwilson 0:3ab1d2d14eb3 4 * Copyright 2011 Pulse-Robotics, Inc.
tylerwilson 0:3ab1d2d14eb3 5 * Author: Tyler Wilson
tylerwilson 0:3ab1d2d14eb3 6 */
tylerwilson 0:3ab1d2d14eb3 7
tylerwilson 0:3ab1d2d14eb3 8 #ifndef _AMXMBED_H
tylerwilson 0:3ab1d2d14eb3 9 #define _AMXMBED_H
tylerwilson 0:3ab1d2d14eb3 10
tylerwilson 0:3ab1d2d14eb3 11 //#include "mbed.h"
tylerwilson 0:3ab1d2d14eb3 12
tylerwilson 0:3ab1d2d14eb3 13 //void mbed_set_serial(Serial* serial);
tylerwilson 0:3ab1d2d14eb3 14
tylerwilson 0:3ab1d2d14eb3 15 #ifdef __cplusplus
tylerwilson 0:3ab1d2d14eb3 16 extern "C" {
tylerwilson 0:3ab1d2d14eb3 17 #endif
tylerwilson 0:3ab1d2d14eb3 18
tylerwilson 0:3ab1d2d14eb3 19 // from amxcons.c. need to declare them as extrn "C" so we build correctly
tylerwilson 0:3ab1d2d14eb3 20 int amx_putstr(const char *);
tylerwilson 0:3ab1d2d14eb3 21 int amx_putchar(int);
tylerwilson 0:3ab1d2d14eb3 22 int amx_fflush(void);
tylerwilson 0:3ab1d2d14eb3 23 int amx_getch(void);
tylerwilson 0:3ab1d2d14eb3 24 char* amx_gets(char* ,int);
tylerwilson 0:3ab1d2d14eb3 25 int amx_termctl(int,int);
tylerwilson 0:3ab1d2d14eb3 26 void amx_clrscr(void);
tylerwilson 0:3ab1d2d14eb3 27 void amx_clreol(void);
tylerwilson 0:3ab1d2d14eb3 28 int amx_gotoxy(int x,int y);
tylerwilson 0:3ab1d2d14eb3 29 void amx_wherexy(int *x,int *y);
tylerwilson 0:3ab1d2d14eb3 30 unsigned int amx_setattr(int foregr,int backgr,int highlight);
tylerwilson 0:3ab1d2d14eb3 31 void amx_console(int columns, int lines, int flags);
tylerwilson 0:3ab1d2d14eb3 32 void amx_viewsize(int *width,int *height);
tylerwilson 0:3ab1d2d14eb3 33 int amx_kbhit(void);
tylerwilson 0:3ab1d2d14eb3 34
tylerwilson 0:3ab1d2d14eb3 35 //int mbed_getc(void);
tylerwilson 0:3ab1d2d14eb3 36 //int mbed_putc(int character);
tylerwilson 0:3ab1d2d14eb3 37 //int mbed_puts(const char* str);
tylerwilson 0:3ab1d2d14eb3 38 //int mbed_kbhit(void);
tylerwilson 0:3ab1d2d14eb3 39
tylerwilson 0:3ab1d2d14eb3 40 #ifdef __cplusplus
tylerwilson 0:3ab1d2d14eb3 41 }
tylerwilson 0:3ab1d2d14eb3 42 #endif
tylerwilson 0:3ab1d2d14eb3 43
tylerwilson 0:3ab1d2d14eb3 44 #endif /* _AMXMBED_H */