mirror of
https://github.com/nasa/fprime.git
synced 2025-12-11 23:38:06 -06:00
92 lines
2.6 KiB
C++
92 lines
2.6 KiB
C++
// ======================================================================
|
|
// \title SignalGen.hpp
|
|
// \author bocchino
|
|
// \brief hpp file for SequenceFileLoader component implementation class
|
|
//
|
|
// \copyright
|
|
// Copyright (C) 2009-2016 California Institute of Technology.
|
|
// ALL RIGHTS RESERVED. United States Government Sponsorship
|
|
// acknowledged. Any commercial use must be negotiated with the Office
|
|
// of Technology Transfer at the California Institute of Technology.
|
|
//
|
|
// This software may be subject to U.S. export control laws and
|
|
// regulations. By accepting this document, the user agrees to comply
|
|
// with all U.S. export laws and regulations. User has the
|
|
// responsibility to obtain export licenses, or other export authority
|
|
// as may be required before exporting such information to foreign
|
|
// countries or providing access to foreign persons.
|
|
// ======================================================================
|
|
|
|
#ifndef Svc_SignalGen_HPP
|
|
#define Svc_SignalGen_HPP
|
|
|
|
#include <Fw/Types/ByteArray.hpp>
|
|
#include <Fw/Types/ConstByteArray.hpp>
|
|
#include <Os/File.hpp>
|
|
#include <Os/ValidateFile.hpp>
|
|
#include <Ref/SignalGen/SignalGenComponentAc.hpp>
|
|
#include <cmath>
|
|
|
|
namespace Ref {
|
|
|
|
class SignalGen :
|
|
public SignalGenComponentBase
|
|
{
|
|
|
|
typedef enum { TRIANGLE, SQUARE, SINE, NOISE } Signal;
|
|
|
|
private:
|
|
|
|
void schedIn_handler(
|
|
NATIVE_INT_TYPE portNum, /*!< The port number*/
|
|
NATIVE_UINT_TYPE context /*!< The call order*/
|
|
);
|
|
|
|
void SignalGen_Settings_cmdHandler(
|
|
FwOpcodeType opCode, /*!< The opcode*/
|
|
U32 cmdSeq, /*!< The command sequence number*/
|
|
U32 Frequency,
|
|
U32 Amplitude,
|
|
U32 Phase
|
|
);
|
|
|
|
void SignalGen_Toggle_cmdHandler(
|
|
FwOpcodeType opCode, /*!< The opcode*/
|
|
U32 cmdSeq /*!< The command sequence number*/
|
|
);
|
|
void SignalGen_Skip_cmdHandler(
|
|
FwOpcodeType opCode, /*!< The opcode*/
|
|
U32 cmdSeq /*!< The command sequence number*/
|
|
);
|
|
|
|
public:
|
|
//! Construct a SignalGen
|
|
SignalGen(
|
|
const char* compName //!< The component name
|
|
);
|
|
|
|
|
|
|
|
//! Initialize a SignalGen
|
|
void init(
|
|
const NATIVE_INT_TYPE queueDepth, //!< The queue depth
|
|
const NATIVE_INT_TYPE instance //!< The instance number
|
|
);
|
|
|
|
//! Destroy a SignalGen
|
|
~SignalGen(void);
|
|
|
|
private:
|
|
bool RUNNING;
|
|
bool SKIP_NEXT;
|
|
U32 sampleFrequency;
|
|
U32 signalFrequency;
|
|
U32 signalAmplitude;
|
|
U32 signalPhase;
|
|
U32 sample;
|
|
Signal SignalType;
|
|
|
|
};
|
|
};
|
|
#endif
|