Migrate missed references

Migrated PB5 references to PB0, that were left over from a previous commit. This also fixes the false lock status OK reporting bug.
This commit is contained in:
Marco Vitchi Thulin 2024-03-10 18:08:04 +01:00
parent 660dd4e8de
commit 088864e670

14
main.c
View file

@ -5,7 +5,7 @@
// PB2 - SCK to ADF4350 CLK
// PB1 - DO (MOSI) to ADF4350 DATA
// PB0 - ADF4350 LD
// PB4 - Status LED
// PB4 - Lock Status LED
void Delay(uint32_t);
uint8_t SendReceiveSPIData(uint8_t);
@ -45,11 +45,11 @@ int main()
// set PB3 (LE) low
PORTB &= ~(1 << PORTB3);
// set direction of PB5 (LD Input) as input
// set direction of PB0 (LD Input) as input
DDRB &= ~(1 << DDB0);
// enable pull-up resistor on PB5
PORTB |= (1 << PORTB5);
// enable pull-up resistor on PB0
PORTB |= (1 << PORTB0);
// flash the Status LED (PB4) to show that everything works
PORTB |= (1 << PORTB4);
@ -60,10 +60,10 @@ int main()
// enter loop waiting for frequency lock to be achieved
while (1)
{
// read the state of LD (PB5)
uint8_t ldState = PINB & (1 << PINB5);
// read the state of LD (PB0)
uint8_t ldState = PINB & (1 << PINB0);
// if LD is low, turn on the LED (PB4)
// if LD (PB0) is low, turn on the LED (PB4)
if (ldState == 0)
PORTB |= (1 << PORTB4); // Turn on the LED
else