From ea0faf27c5544d11778b54ad23244d94aa71135d Mon Sep 17 00:00:00 2001 From: Marco Vitchi Thulin Date: Tue, 23 Jan 2024 13:14:19 +0100 Subject: [PATCH] Finished first revision --- main.c | 109 ++++++++++++++++++++++++++++++++------------------------- 1 file changed, 62 insertions(+), 47 deletions(-) diff --git a/main.c b/main.c index babc512..8f957d8 100644 --- a/main.c +++ b/main.c @@ -1,27 +1,16 @@ #include #include "common.h" -// XXX - ADF4350 LE +// PB3 - ADF4350 LE // PB2 - SCK to ADF4350 CLK // PB1 - DO (MOSI) to ADF4350 DATA -// XXX - ADF4350 LD - -String tosend="Test"; +// PB5 - ADF4350 LD +// PB4 - Status LED void Delay(uint32_t); uint8_t SendReceiveSPIData(uint8_t); void SendSPIDataADF4350 (uint32_t); -void spi_setup() -{ - // set direction of PB1 (DO) and PB2 (USCK) as output - DDRB=(1<> 16; + ///uint16_t lowWord = outval & 0x0000ffff; + // send these to the ADF4350 via SPI + ///SendReceiveSPIData (highWord); + ///SendReceiveSPIData (lowWord); + + // delay so the clock has gone low before LE is taken high Delay(10); - // Take LE high to load the data into the register - *(uint32_t *)(GPIOA_BASE + 0x10) = BIT_2; - // Short delay while LE is high (minimum of 20ns) + // pull LE high to load the data into the ADF4350 register + PORTB |= (1 << PORTB3); + // short delay while LE is high (minimum of 20ns) Delay(30); - // Take LE low again - *(uint32_t *)(GPIOA_BASE + 0x14) = BIT_2; + // pull LE low again + PORTB &= ~(1 << PORTB3); } \ No newline at end of file