Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Diff: main.cpp
- Revision:
- 0:e0b964252a05
- Child:
- 1:d5452e398b76
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp Wed May 19 12:39:18 2010 +0000
@@ -0,0 +1,113 @@
+/*******************************************************************************
+
+Just4Trionic by Just4pLeisure
+*****************************
+
+Whilst I have written this program myself I could not have done it without
+a lot of help and the original ideas and programs written by:
+Dilemma - Author of the Trionic Suite software programs and general Guru
+http://trionic.mobixs.eu/ and http://www.ecuproject.com.
+General Failure - Author of the T5CANlib software and regular contributor at
+http://www.ecuproject.com.
+Tomi Liljemark - Lots of information and programs about the Saab CAN bus
+http://pikkupossu.1g.fi/tomi/projects/projects.html.
+Scott Howard - Author of the BDM software.
+Plus inspiration and ideas from many others, including johnc.
+
+Sophie x
+
+********************************************************************************
+
+WARNING: Use at your own risk, sadly this software comes with no guarantees.
+This software is provided 'free' and in good faith, but the author does not
+accept liability for any damage arising from its use.
+
+********************************************************************************
+
+Version 1 (04/2010)- The basic functions are working, but not very easy to use
+
+I have decided to 'release' this software somewhat prematurely because the FLASH
+chips in my spare ECU have 'died' and I don't know when I will be able to do
+carry on improving and 'polishing' it. This way others will be able to use and
+enhance it without having to wait for me.
+
+For now, only option '5' Trionic ECU CAN interface is working. BDM and Lawicell
+CAN232 functions are dummies. The intention is to build a complete suite of CAN
+software for Trionic5, 7 and 8 ECU types as well as adding a BDM interface to
+make an 'all-in-one' USB programming tool.
+
+To make this you will need an mbed system and the CAN circuit from this page:
+http://mbed.org/projects/cookbook/wiki/CanBusExample1
+
+Some ideas for the truly creative and adventurous of you is to make a gizmo that
+doesn't even need to be connected to a laptop or PC to use, maybe even a self-
+contained vesion of Dilemma's CarPC using ideas from this pages:
+
+http://mbed.org/projects/cookbook/wiki/PS2Keyboard
+http://mbed.org/projects/cookbook/wiki/PS2Mouse
+http://mbed.org/projects/cookbook/wiki/MobileLCD
+http://mbed.org/projects/cookbook/wiki/SDCard
+
+*******************************************************************************/
+
+#include "mbed.h"
+
+#include "strings.h"
+#include "BDM.h"
+#include "CAN232.h"
+#include "Trionic5.h"
+
+Serial pc(USBTX, USBRX); // tx, rx
+
+#define CR 0x0D
+#define NL 0x0A
+#define BELL 0x07
+
+#define TRUE 1
+#define FALSE 0
+
+void ShowHelp();
+
+int main() {
+ // fast serial speed
+// pc.baud(921600);
+ pc.baud(115200);
+ // make plenty of space for command from RS232
+ char command[5];
+ ShowHelp();
+ while (1) {
+// Only get 2 characters, the command and \r
+// For now I cannot work out how to use gets() so only single characters
+// can be used for commands :-(
+//
+// At the moment only option '5' does anything - the Trionic5 functions
+//
+ pc.gets(command,2);
+ int len = strlen(command);
+ if (len != 1)
+ printf ("\a");
+ else if (ToUpper(command[0]) == 'B')
+ BDM();
+ else if (ToUpper(command[0]) == 'O')
+ CAN232();
+ else if (ToUpper(command[0]) == '5')
+ Trionic5();
+ else if (ToUpper(command[0]) == 'H')
+ ShowHelp();
+// Unrecognised so ring the BELL :(
+ else
+ printf ("\a");
+ }
+}
+
+void ShowHelp() {
+ printf("Just4Trionic Command Menu\r\n");
+ printf("=========================\r\n");
+ printf("b/B - Start BDM interface (NOT DONE)\r\n");
+ printf("o/O - Open Lawicel CAN232 type interface (NOT DONE)\r\n");
+ printf("5 - Start Trionic5 ECU CAN interface\r\n");
+ printf("\r\n");
+ printf("h/H - show this help menu\r\n");
+ return;
+}
+