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.
LT1446.cpp
- Committer:
- vitlog
- Date:
- 2020-06-22
- Revision:
- 0:4ca9c83d7e14
File content as of revision 0:4ca9c83d7e14:
#include "LT1446.h"
//повторное объявление из-за использования внешней переменной и ошибки множественного объявления
LT1446_MEM_t LT1446_MEM;
//экземпляр по умолчанию
LT1446_t LT1446_0;
void LT1446_CalibrateCh(LT1446_Calibr_t *dac,float k, float b)
{
dac->k=k;
dac->b=b;
}
//Вычислить значение для передачи в ЦАП
void LT1446_CalculateCh(LT1446_Calibr_t *dac)
{
dac->Code=(uint16_t)(dac->k*dac->Volts+dac->b);
if (dac->Code>4095) dac->Code=4095;
}
void LT1446_Write(LT1446_t *chip)
{
LT1446_MEM.DACA=chip->dacA.Code;
LT1446_MEM.DACB=chip->dacB.Code;
Cs=0;
TED2.write(LT1446_MEM.b3);
TED2.write(LT1446_MEM.b2);
TED2.write(LT1446_MEM.b1);
Cs=1;
}