Skip to content
Snippets Groups Projects
Commit 563f471a authored by Erik Strand's avatar Erik Strand
Browse files

Verify that card detect pin is working

parent c6dac168
No related branches found
No related tags found
No related merge requests found
......@@ -54,6 +54,14 @@
#define MISO_pin (1 << PA5)
#define MISO_pins PINA
#define DETECT_port PORTA
#define DETECT_direction DDRA
#define DETECT_pin (1 << PA7)
#define led_port PORTB
#define led_direction DDRB
#define led_pin (1 << PB2)
//
// put_char
// send character in txchar
......@@ -299,6 +307,19 @@ int main(void) {
//
// main
//
// Debug loop to verify we can detect when the card is inserted
// Configure DETECT_pin as an input and led_pin as an output
DETECT_direction &= ~DETECT_pin;
led_direction |= led_pin;
while (1) {
if (PINA & DETECT_pin) {
led_port &= ~led_pin;
} else {
led_port |= led_pin;
}
}
static uint8_t count,sectors_per_cluster,FATs,attribute,result[8],buffer[50];
static uint16_t bytes_per_sector,reserved_sectors,offset,
file_cluster_low,file_cluster_hi,buffer_length,sector_count;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment