demo new haven display

Dependencies:   LCD Menu ButtonCtrl TimeManagement EventLog AddressMap emic2

ESCM 2000 Control and Display application provides interface for the LPC1768 processor boards with the ECSM 2000 system.

This application implements SW interface : - RX 485 Receive from physical system - RX 485 Interface to send toECOM / ESCM board - CAN Interface to send to ECOM / ESCM board - 4x40 LCD with menu controls - RTC configuration -EMIC2 Sound Card - GPIO Extender to push buttons etc

ESCMControlApp.h

Committer:
foxbrianr
Date:
2019-09-12
Revision:
5:65f21c0b6b79
Parent:
3:ecaf9963341b
Child:
6:010ceb99f7b0

File content as of revision 5:65f21c0b6b79:

#ifndef _ESCM_CONTROL_APP_
#define _ESCM_CONTROL_APP_


#include "mbed.h"
#include "Menu.h"
#include "LCD.h"
#include "AddressMap.h"
#include "EventLog.h"
#include "TimeUtilities.h"

#include "emic2.h"


#define LIMIT(x,low,high) x = ((x<=low)? low    : ((x>=high) ? high : x ));
#define WRAP (x,low,high) ((x<low)?(high-1):((x>high)?0:x));

typedef struct {
    int    event;
} event_t;

typedef struct {
    char   message[64];
} playbackMessage_t;


extern LCD   lcd;

extern AddressMap addressMap;

extern ESCM_EventLog escmEventLog;

extern RealTimeClock rtc;

extern Serial rs485port1;
extern DigitalOut rs485port1mode; 

extern Serial rs485port2; 
extern DigitalOut rs485port2mode; 

extern CAN canport;       
extern DigitalOut canportmode; 

extern emic2 speaker;


extern CircularBuffer<event_t, 64> message_queue;

extern CircularBuffer<event_t, 64> event_queue;

extern CircularBuffer<playbackMessage_t, 10> playback_queue;


class ESCMControlApp 
{
    
    public:
        
        void init(void);
        void update(void);
        void processMessageQueue ();
        void processSoundQueue ();
        
        //void rx485Message();
        void tx485Message(int address); 
        void txCanMessage501 (int address);
        void txCanMessage502 (int address);
        void txCanMessage580 (int address);

        static void say (char *format, ...);
        static void refresh_display (void);
        
        static void getTime(char *timeBuffer);
        static void setTime(int hours, int mins, int sec, int months, int days, int years );
        
        static void postEvent (uint16_t address);
        static void postEvent (uint16_t address, uint16_t source);
     
        int cur_address;
        
        char fault[4];
        
        int dataRxCnt;
        int dataTxCnt;
        
        Mutex event_ctrl ;
        Mutex emic_ctrl ;
        Mutex can_ctrl  ;
        Mutex rs485_ctrl;
};

extern ESCMControlApp escmController;

#endif