Added the ability to invert SD_DETECT for cardholders with a normally open contact to determine the presence of a card.

This commit is contained in:
Dmitriy Logachov 2021-01-13 15:10:59 +05:00
parent 596539f0cd
commit 7f8dfae211
5 changed files with 28 additions and 3 deletions

View file

@ -16,12 +16,13 @@
#include "diskio.h"
#include "device.h"
#include "hardware/LED.h"
#include "util/Config.h"
/* Port controls (Platform dependent) */
#define CS_LOW() SD_CS_PORT &= ~(_BV(SD_CS_PIN)) /* CS=low */
#define CS_HIGH() SD_CS_PORT |= _BV(SD_CS_PIN) /* CS=high */
#define MMC_CD ((SD_DETECT_INPUT & _BV(SD_DETECT_PIN))) /* Card detected. yes:true, no:false, default:true */
#define MMC_CD (config_invert_sddetect == false ? (SD_DETECT_INPUT & _BV(SD_DETECT_PIN)) : (SD_DETECT_INPUT & ~_BV(SD_DETECT_PIN))) /* Card detected. yes:true, no:false, default:true */
#define MMC_WP (false) /* Write protected. yes:true, no:false, default:false */
#define FCLK_SLOW() SPCR = 0x52 /* Set slow clock (F_CPU / 64) */
#define FCLK_FAST() SPCR = 0x50 /* Set fast clock (F_CPU / 2) */