21 lines
462 B
C
21 lines
462 B
C
|
#include "spi.h"
|
||
|
|
||
|
/*
|
||
|
#define nWR 7 //bit aktywacja zapisu do rejestru przetwornika
|
||
|
#define DC 6 //bit nieużywany (Don't Care)
|
||
|
#define GA 5 //bit wyboru wzmocnienia
|
||
|
#define SHDN 4 //bit aktywacji wyjścia
|
||
|
|
||
|
#define GAIN_X1 1
|
||
|
#define GAIN_X2 0
|
||
|
*/
|
||
|
|
||
|
#define CONF1 0b00110000 //gain x1
|
||
|
#define CONF2 0b00010000 //gain x2
|
||
|
|
||
|
void analogWrite(uint8_t data){
|
||
|
SS_LOW;
|
||
|
spiTransfer(CONF1 | (data>>4));
|
||
|
spiTransfer(data<<4);
|
||
|
SS_HIGH;
|
||
|
}
|