Skip to content

Commit

Permalink
Merge pull request #74 from amperka/tolikivanov-patch-1
Browse files Browse the repository at this point in the history
Update card-reader.js
  • Loading branch information
tolikivanov authored Mar 22, 2019
2 parents 8fe3d95 + 7fcf3f9 commit bcd2c24
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions modules/@amperka/card-reader.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@


var CardReader = function(opts) {
var CardReader = function(opts) {
this._fs = require('fs');
if (typeof opts === 'number') {
SPI2.setup({mosi: B15, miso: B14, sck: B13});
E.connectSDCard(SPI2, opts);
} else {
E.connectSDCard(opts.spi, opts.cs);
}
// Некоторые модели SD-карт начинают рагировать только со
// второго запроса. Делаем холостой перебор корневой директории,
// чтобы “прогреть” карту в таких случаях
this._fs.readdirSync();
};

CardReader.prototype.isDirectory = function(fileName) {
Expand Down

0 comments on commit bcd2c24

Please sign in to comment.