You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
55 lines
1.8 KiB
55 lines
1.8 KiB
7 years ago
|
//----------------------------------------------------------------------------------------------------------------------------
|
||
|
// Project: Uppsense
|
||
|
// Name: excitation_light.cpp
|
||
|
// Author: Maximilian Stiefel
|
||
|
// Date: 09.08.2017
|
||
|
//
|
||
|
// Description:
|
||
|
//
|
||
|
//----------------------------------------------------------------------------------------------------------------------------
|
||
|
|
||
|
//-------------------------------------Libraries------------------------------------------------------------------------------
|
||
|
#include "excitation_light.h"
|
||
|
#include "hardware.h"
|
||
|
#include <SmingCore/SmingCore.h>
|
||
|
|
||
|
//-------------------------------------Namespaces-----------------------------------------------------------------------------
|
||
|
namespace rijnfel {
|
||
|
namespace light {
|
||
|
|
||
|
//-------------------------------------Constructor----------------------------------------------------------------------------
|
||
|
cExcitationLight::cExcitationLight():
|
||
|
m_rectangleStatus(0), m_DAC_Rect_High(0)
|
||
|
{
|
||
|
m_DAC = new dac::cDAC101C085(1, DAC1_ADDRESS);
|
||
|
}
|
||
|
|
||
|
//-------------------------------------Destructor-----------------------------------------------------------------------------
|
||
|
cExcitationLight::~cExcitationLight()
|
||
|
{
|
||
|
delete m_DAC;
|
||
|
}
|
||
|
|
||
|
//-------------------------------------setCurrent-----------------------------------------------------------------------------
|
||
|
uint8_t cExcitationLight::setCurrent(uint16_t microamp)
|
||
|
{
|
||
|
if(microamp < CURR_MAX_UAMP)
|
||
|
{
|
||
|
m_DAC_Rect_High = R_SENSE * microamp;
|
||
|
return 1;
|
||
|
}
|
||
|
else
|
||
|
return 0;
|
||
|
}
|
||
|
|
||
|
//-------------------------------------rectangleUpdate------------------------------------------------------------------------
|
||
|
uint8_t cExcitationLight::rectangleUpdate()
|
||
|
{
|
||
|
m_rectangleStatus ? m_DAC->ChangeSettings(dac::eOpMode::NORMAL, 0) : m_DAC->ChangeSettings(dac::eOpMode::NORMAL, m_DAC_Rect_High);
|
||
|
rectangle_Status ^= 0xFF;
|
||
|
}
|
||
|
|
||
|
|
||
|
}
|
||
|
}
|