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.
Dependencies: mbed bloc_io mbed-rtos html EthernetInterface
Revision 0:e30c9ba95bd4, committed 2015-08-22
- Comitter:
- superphil06
- Date:
- Sat Aug 22 15:51:59 2015 +0000
- Child:
- 1:fbf189951c5e
- Commit message:
- squelette programme ERS3
Changed in this revision
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/EthernetInterface.lib Sat Aug 22 15:51:59 2015 +0000 @@ -0,0 +1,1 @@ +https://developer.mbed.org/users/superphil06/code/EthernetInterface/#4b1f024da5b7
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/bloc_io.lib Sat Aug 22 15:51:59 2015 +0000 @@ -0,0 +1,1 @@ +https://developer.mbed.org/users/superphil06/code/bloc_io/#7b4e6771a530
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/html.lib Sat Aug 22 15:51:59 2015 +0000 @@ -0,0 +1,1 @@ +https://developer.mbed.org/users/superphil06/code/html/#ba608856b208
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp Sat Aug 22 15:51:59 2015 +0000
@@ -0,0 +1,169 @@
+
+
+//#include "EthernetInterface.h"
+#include <stdlib.h>
+#include <string.h>
+#include "mbed.h"
+#include "rtos.h" // need for main thread sleep
+#include "html.h" // need for html patch working with web server
+#include "bloc_io.h"
+#define RADIUS 0.2F // wheel size
+#define NBPOLES 8 // magnetic pole number
+#define DELTA_T 0.1F // speed measurement counting period
+
+
+Bloc_IO MyPLD(p25,p26,p5,p6,p7,p8,p9,p10,p23,p24);// instantiate object needed to communicate with PLD
+ // analog input connected to mbed
+ // valid pmw mbed pin
+Serial pc(USBTX, USBRX); // tx, rx
+ // Top_Hall Pin
+
+
+
+
+/************ persistent file parameters section *****************/
+LocalFileSystem local("local"); // Create the local filesystem under the name "local"
+
+
+
+
+
+
+
+/********************* web server section **********************************/
+
+var_field_t tab_balise[10]; //une balise est présente dans le squelette
+int giCounter=0;// acces counting
+
+
+/*********************** can bus section ************/
+ // determine message ID used to send Gaz ref over can bus
+#define _CAN_DEBUG // used to debug can bus activity
+//#define USE_CAN_REF // uncomment to receive gaz ref over can_bus
+CAN can_port (p30, p29); // initialisation du Bus CAN sur les broches 30 (rd) et 29(td) for lpc1768 + mbed shield
+bool bCan_Active=false;
+
+
+
+DigitalOut led1(LED1); //initialisation des Leds présentes sur le micro-controleur Mbed*/
+DigitalOut led2(LED2);
+DigitalOut led3(LED3); // blink when can message is sent
+DigitalOut led4(LED4); // blink when can message is received
+
+
+
+
+
+//************ local function prototypes *******************
+
+
+
+
+
+
+
+/**************** Read persistent data from text file located on local file system ****************/
+
+
+
+/**************** write persitant data to text file located on local file system ****************/
+
+
+
+
+
+
+//************** calibation gaz function needed to record min_gaz and max_gaz value to persistent text file ******************
+
+
+// ************top hall counting interrupt needed for speed measurement
+
+
+//********************** timer interrupt for speed measurement each 100ms *************************
+
+
+
+
+
+
+//********************* Timer Interrupt for gaz ref management each 10ms ********************
+
+
+
+/********* main cgi function used to patch data to the web server thread **********************************/
+void CGI_Function(void) // cgi function that patch web data to empty web page
+{ char ma_chaine4[20]={};// needed to form html response
+
+}
+
+
+ /*********************** CAN BUS SECTION **********************/
+
+
+
+void CAN_REC_THREAD(void const *args)
+{ int iCount,iError;
+
+ while (bCan_Active)
+ {Thread::wait(100);// wait 100ms
+ // code todo
+
+ }
+
+}
+
+
+
+//*************************** main function *****************************************
+int main() {
+char cChoix=0;
+
+
+
+
+
+//***************************************** web section ********************************************/
+//Init_Web_Server(&CGI_Function); // create and initialize tcp server socket and pass function pointer to local CGI function
+//Thread WebThread(Web_Server_Thread);// create and launch web server thread
+/********* main cgi function used to patch data to the web server thread **********************************/
+
+//******************************************* end web section ************************************* /
+
+
+
+
+pc.printf(" programme scooter mbed \n");
+
+
+
+//********************* can bus section initialisation *******************************************
+//bCan_Active=true;// needed to lauchn CAN thread
+//Thread CanThread(CAN_REC_THREAD);// create and launch can receiver thread
+//********************* end can bus section *****************************************************
+
+
+while(cChoix!='q' and cChoix!='Q')
+{pc.printf(" veuillez saisir un choix parmi la liste proposee: \n");
+ pc.printf(" a:saisie consigne pwm \n");
+ pc.printf(" q:quitter \n");
+
+ /************* multithreading : main thread need to sleep in order to allow web response */
+ while (pc.readable()==0) // determine if char availabler
+ {Thread::wait(10);} // wait 10 until char available on serial input
+ /************* end of main thread sleep ****************/
+
+ pc.scanf(" %c",&cChoix);
+ switch (cChoix){
+ case 'a':
+ break;
+ case 'q':
+ break;
+ }
+} // end while
+
+ //************** thread deinit *********************
+ //DeInit_Web_Server();
+ //bCan_Active=false;
+ //CanThread=false;// close can received thread
+ pc.printf(" fin programme scooter mbed \n");
+} // end main
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed-rtos.lib Sat Aug 22 15:51:59 2015 +0000 @@ -0,0 +1,1 @@ +http://developer.mbed.org/users/mbed_official/code/mbed-rtos/#5aed8bae1001
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Sat Aug 22 15:51:59 2015 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/mbed_official/code/mbed/builds/b9ad9a133dc7 \ No newline at end of file