Bye Bye Moore

PoCソルジャーな零細事業主が作業メモを残すブログ

uLispでSDカードをつかう その1:準備と書き込み

実際のところ

まず、

// Compile options

// #define resetautorun
#define printfreespace
#define serialmonitor
// #define printgcs
// #define sdcardsupport
// #define lisplibrary

これの"#define sdcardsupport"を有効にします。

// Compile options

// #define resetautorun
#define printfreespace
#define serialmonitor
// #define printgcs
#define sdcardsupport
// #define lisplibrary

各種変数はesp32の場合、"ulisp-esp.ino"に以下のように定義されています。

#elif defined(ESP32)
  #define WORKSPACESIZE 8000-SDSIZE       /* Cells (8*bytes) */
  #define EEPROMSIZE 4096                 /* Bytes available for EEPROM */
  #define SYMBOLTABLESIZE 1024            /* Bytes */
  #define analogWrite(x,y) dacWrite((x),(y))
  #define SDCARD_SS_PIN 13
  uint8_t _end;
  typedef int BitOrder;

#endif

あとは、適切なSDカードシールドが必要ですね。

使い方

Greeting.txtに単純な文字列を書き込む場合

(with-sd-card (str "Greeting.txt" 2)
  (print "Hello" str))