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.
CtrlBridge.h
00001 /** 00002 * @file CtrlBridge.h 00003 * @brief Cette classe est le modele des 3 taches de controle. 00004 * @author Salco 00005 * @version 2.00 00006 * @date 11 mars 2015 00007 */ 00008 #ifndef CTRLBRIDGE_H 00009 #define CTRLBRIDGE_H 00010 00011 #define DEBUG_INITMODULE /*1*/0 00012 #define DEBUF_FINDMODULE 0 00013 #define DEBUF_SEND /*1*/0 00014 00015 #define SPI_HIGH_MISO PB_14 00016 #define SPI_HIGH_MOSI PB_15 00017 #define SPI_HIGH_SCK PB_13 00018 #define SPI_HIGH_CS A1 00019 #define SPI_HIGH_DEMUXA PC_0 00020 #define SPI_HIGH_DEMUXB PC_1 00021 #define SPI_HIGH_DEMUXC PC_2 00022 #define SPI_HIGH_DEMUXD PC_3 00023 00024 #define SPI_LOW_MISO PA_6 00025 #define SPI_LOW_MOSI PA_7 00026 #define SPI_LOW_SCK PA_5 00027 #define SPI_LOW_CS A0 00028 #define SPI_LOW_DEMUXA PC_4 00029 #define SPI_LOW_DEMUXB PC_5 00030 #define SPI_LOW_DEMUXC PC_6 00031 #define SPI_LOW_DEMUXD PC_7 00032 00033 #include "mbed.h" 00034 #include <string> 00035 #include "OSNAPprotocoleDefine.h" 00036 //#include <algorithm> // std::for_each 00037 #include "debug.h" 00038 #include "ComSpi.h" //utiliser pour comuniquer avec les module 00039 #include "MemRegistre.h" //enregistrer les info 00040 #include "Module.h " 00041 class CtrlBridge 00042 { 00043 static CtrlBridge *uniqueInstance; 00044 //pc = new Serial(SERIAL_TX, SERIAL_RX); 00045 //ssc32= new Serial(PA_9, PA_10); 00046 int m_regPortUse; // set in the init 00047 int m_regPortLost;// flag 1 si lost 00048 MemRegistre m_Memory; 00049 00050 /** 00051 * @brief Constructeur priver appler par la fonction getInstance() 00052 */ 00053 CtrlBridge(); 00054 ~CtrlBridge(); 00055 00056 private: 00057 Serial ssc32; 00058 ComSpi spiLowSpeed, spiHighSpeed; 00059 00060 public: 00061 Serial pc; 00062 inline string getFlagUpdate(const unsigned char &adresse) { 00063 string flag,data; 00064 flag.clear(); 00065 data.clear(); 00066 flag.append(1,7); 00067 send(adresse,flag,data); 00068 return flag; 00069 } 00070 inline string getDataUpdate(const unsigned char &adresse) { 00071 string flag,data; 00072 flag.clear(); 00073 data.clear(); 00074 flag.append(1,7); 00075 send(adresse,flag,data); 00076 return data; 00077 } 00078 bool send( const unsigned char &adresse, string &flag, string &data); 00079 00080 /*string findModule(const typeModue &t); 00081 string findModule(const sousType_Actionneur &st); 00082 string findModule(const sousType_Memoire &st); 00083 string findModule(const sousType_Capteur &st); 00084 string findModule(const positionSpatial &p); 00085 00086 string findModule(const typeModue &t, const sousType_Actionneur &st); 00087 string findModule(const typeModue &t, const sousType_Memoire &st); 00088 string findModule(const typeModue &t, const sousType_Capteur &st); 00089 string findModule(const typeModue &t, const positionSpatial &p);*/ //complex pour le moment on le fera en temps voulue 00090 00091 string findModule(const char &peripheriqueID, const char &type, const char &sousType, const char &posSpatial); 00092 00093 int size(const char &peripheriqueID, const char &type, const char &sousType, const char &posSpatial); 00094 /** 00095 * @brief Methode permetant une seul instance de la classe 00096 * @return Retourne l'unique instance de la classe 00097 */ 00098 static CtrlBridge *getInstance(); 00099 00100 bool initCom(void); 00101 00102 bool isValide(char portID) { 00103 return (m_regPortUse & (1<<portID))?true:false; 00104 }; 00105 bool tryComPort(char portID);//just faire le sync et crc pour voire si lautre est la 00106 00107 void clearALL (void) { 00108 m_Memory.remAllActioneur(); 00109 m_Memory.remAllCapteur(); 00110 m_Memory.remAllMemoire(); 00111 }; 00112 00113 //fonction quelquonque pour communiquer avec les module 00114 //fonction quelquonque pour faire des recherche dans les module dispo 00115 //autre fonction pour jouer avec MemRegistre 00116 00117 }; 00118 #endif // CTRLBRIDGE_H
Generated on Tue Jul 12 2022 19:04:21 by
1.7.2