4 #include "ReadWriteBits.h"
6 typedef uint8_t
volatile *
const uspi_ptr;
7 typedef uint16_t
volatile *
const uspi_ptr16;
8 typedef uint8_t
const uspi_pin;
9 typedef uint8_t
const uspi_bit;
14 extern uspi_ptr UartSpi_ddr;
15 extern uspi_ptr UartSpi_port;
16 extern uspi_ptr UartSpi_UCSR0A;
17 extern uspi_ptr UartSpi_UCSR0B;
18 extern uspi_ptr UartSpi_UCSR0C;
19 extern uspi_ptr UartSpi_UDR0;
20 extern uspi_ptr16 UartSpi_UBRR0;
22 extern uspi_pin UartSpi_Miso;
23 extern uspi_pin UartSpi_AdcConv;
24 extern uspi_pin UartSpi_Sck;
26 extern uspi_bit UartSpi_UMSEL00;
27 extern uspi_bit UartSpi_UMSEL01;
28 extern uspi_bit UartSpi_RXEN0;
29 extern uspi_bit UartSpi_TXEN0;
30 extern uspi_bit UartSpi_UCPOL0;
31 extern uspi_bit UartSpi_UCPHA0;
32 extern uspi_bit UartSpi_UDORD0;
33 extern uspi_bit UartSpi_UDRE0;
34 extern uspi_bit UartSpi_RXC0;
53 SetBit(UartSpi_ddr, UartSpi_Sck);
57 inline void AdcConvIdleLow(
void)
59 ClearBit(UartSpi_port, UartSpi_AdcConv);
70 SetBit(UartSpi_ddr, UartSpi_AdcConv);
74 inline void EnableAtmega328UsartInSpiMasterMode(
void)
76 SetBit(UartSpi_UCSR0C, UartSpi_UMSEL00);
77 SetBit(UartSpi_UCSR0C, UartSpi_UMSEL01);
103 SetBit(UartSpi_UCSR0C, UartSpi_UCPOL0);
104 SetBit(UartSpi_UCSR0C, UartSpi_UCPHA0);
120 ClearBit(UartSpi_UCSR0C, UartSpi_UDORD0);
135 SetBit(UartSpi_UCSR0B, UartSpi_RXEN0);
136 SetBit(UartSpi_UCSR0B, UartSpi_TXEN0);
151 inline void SpiMasterCfg(
void)
153 EnableAtmega328UsartInSpiMasterMode();
184 inline void StartAdcConversion(
void)
186 SetBit(UartSpi_port, UartSpi_AdcConv);
190 inline void StartAdcReadout(
void)
192 ClearBit(UartSpi_port, UartSpi_AdcConv);
194 *UartSpi_UDR0 = 0x00; *UartSpi_UDR0 = 0x00;
void CfgSpiToTransferMsbFirst(void)
void SetAdcConvAsOutput(void)
void UseSpiDataModeCpol1CPha1(void)
void SetSckAsOutput(void)
void GiveSpiControlOverMisoAndMosiPins(void)