Commit 42164a25 authored by Achim Morschhauser's avatar Achim Morschhauser
Browse files

Makefile

parent 19917dd2
......@@ -4,8 +4,10 @@
.settings/
*.anjuta*
bin/*
lib/*
.cproject
.project
PRIVATE/
CHANGELOG
DataLogger
!*/.gitkeep
SRC_DIR=src/
OBJ_DIR=lib/
HDR_DIR=include/
LIB_DIR=/usr/lib/
LIB_DIR=./lib/
USR_DIR=usr/
BIN_DIR=bin/
......@@ -30,8 +30,8 @@ all: $(USR_TARGET:%=$(BIN_DIR)%)
$(BIN_DIR)%: $(USR_DIR)%.cpp $(LIB_DIR)libLogger.so
# $(CC) $(CCFLAGS) $< -o $@ -I$(HDR_DIR) -L$(LIB_DIR) -Wl,-rpath,"\$$ORIGIN/../$(LIB_DIR)" -lLogger
$(CC) $(CCFLAGS) $< -o $@ -I$(HDR_DIR) -L$(LIB_DIR) -lLogger
$(CC) $(CCFLAGS) -no-pie $< -o $@ -I$(HDR_DIR) -L$(LIB_DIR) -Wl,-rpath,"\$$ORIGIN/../$(LIB_DIR)" -lLogger
# $(CC) $(CCFLAGS) $< -o $@ -I$(HDR_DIR) -L$(LIB_DIR) -lLogger
$(OBJ_DIR)%.o: $(SRC_DIR)%.cpp
$(CC) $(CCFLAGS) -fPIC -c -o $@ $< -I$(HDR_DIR)
......
/*
* Driver_Obs_Serial.h
*
* Created on: May 12, 2016
* Author: mors
*/
#ifndef INCLUDE_DRIVER_OBS_SERIAL_HPP_
#define INCLUDE_DRIVER_OBS_SERIAL_HPP_
#include <driver_serial_emulate.hpp>
//#include <driver_serial.hpp>
#include <driver_obs.hpp>
class Driver_Obs_Serial: protected driver_obs {
//
// Private class variables
//
/** The serial driver to use */
private: driver_serial_emulate serial;
//private: driver_serial serial;
//
// Constructors
//
public:
/** Constructor with baud rate */
Driver_Obs_Serial(std::string port, buffer_obs* buffer);
/**
* Constructors of derived classes must call set_term(term,termlen)
* and set_baud(const char* init_char) or set_baud(int baud).
*/
//
// Public Methods
//
/** Take a single measurement. An object data_obs with the timestamp is returned.
This method must be implemented as specified in the abstract class driver_obs */
public: virtual int get(data_obs* data)=0;
/** Take continuous measurement in triggered mode */
public: virtual int run(int freq)=0;
/** Take continuous measurement in freerun mode */
public: virtual int freerun(int freq)=0;
/** Stop continuous measurements */
public: virtual int stop()=0;
//
// Private Methods
//
protected:
/** Receive raw from serial port without time information. */
virtual int receive_raw(char *buf, int buflen, double timeout);
/** Receive from serial port without time information. */
virtual int receive(char *buf, int buflen, double timeout);
/** Receive from serial port with time information. */
virtual int receive(char *buf, int buflen, double timeout,
struct timespec *recv_time);
/** Send a command to the serial port. */
virtual int send(const char* cmd);
/** Send a command to the serial port. */
virtual int send(char* cmd);
/** Flush the buffer of the serial port. */
virtual int flush();
/** Initialize the instrument with automatic determination of the baud rate */
virtual int set_baud(const char* init_char);
/** Initialize the instrument with given baud rate */
virtual int set_baud(int baud);
/** Set the termination characters. */
virtual int set_term(const char* term,int termlen);
};
#endif /* INCLUDE_DRIVER_OBS_SERIAL_HPP_ */
/********************************************************************************
* WRITTEN BY ACHIM MORSCHHAUSER, GFZ POTSDAM, April 2016 *
* mors//gfz-potsdam.de *
* *
* This class provides the driver for an OBSDAQ ADC. *
* *
* It is based on the abstract observatory driver class driver_obs. *
* *
********************************************************************************/
#ifndef _DRIVER_OBS_OBSDAQ_H
#define _DRIVER_OBS_OBSDAQ_H
#include <string>
#include <Driver_Obs_Serial.hpp>
#include <data_obs_vector.hpp>
#include <data_obs.hpp>
#include <buffer_obs.hpp>
class driver_obs_obsdaq : protected Driver_Obs_Serial
{
//
// Private class variables
//
private:
/** The address to use (RS-485) */
int RS485_addr;
std::string RS485_addrstr;
/** The quartz crystal frequency */
int quartz_freq;
//
// Constructors
//
/** Standard constructor */
public: driver_obs_obsdaq(std::string port, buffer_obs* buffer);
/** Standard constructor */
public: driver_obs_obsdaq(std::string port, buffer_obs* buffer, int addr);
/** Standard constructor */
public: driver_obs_obsdaq(std::string port, buffer_obs* buffer, int baud, int addr);
//
// Public Methods
//
public:
/** Take a single measurement. An object data_obs with the timestamp is returned.
This method must be implemented as specified in the abstract class driver_obs */
int get(data_obs* data);
/** Take a single measurement and return all data */
int get(data_obs_vector* data);
/** Take continuous measurement in triggered mode */
int run(int freq);
/** Take continuous measurement in freerun mode */
int freerun(int freq);
/** Stop continuous measurements */
int stop();
//
// Private Methods
//
private:
/** Send an OBSDAQ-type command to address of RS-485 serial port */
int send(const char* cmd);
/** Send an OBSDAQ-type command to address of RS-485 serial port, check and get response */
int checked_send(const char* cmd, const char* reply, int digits, double timeout,
std::string* recv);
/** Send an OBSDAQ-type command to address of RS-485 serial port and check response */
int checked_send(const char* cmd, const char* reply, int digits, double timeout);
/** Initialize the instrument */
int init();
protected:
/** Set the termination characters for serial comm. */
int set_term();
};
#endif /* _DRIVER_OBS_OBSDAQ_H */
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment