7,166
edits
(6 intermediate revisions by the same user not shown) | |||
Line 47: | Line 47: | ||
ソフトウェアの情報は LLC に合わせている。 | ソフトウェアの情報は LLC に合わせている。 | ||
Arduino Yun の面白さ(逆に難しさ) | Arduino Yun の面白さ(逆に難しさ)はマイコン屋の知識と、UNIX屋・ネットワーク屋の知識と、Web屋の知識がすべて必要なところ。それぞれの専門家からみたら他方はブラックボックスに見えて理解の妨げになっているようだ。Arduino Yun の使い方・付き合い方は多方面から見てあげることが大切だ。 | ||
= 導入 = | = 導入 = | ||
Line 528: | Line 528: | ||
[http://xx-prime.hatenablog.com/entry/2015/04/26/224618 Arduino yunで放射線センサのデータをxivelyとM2Xにアップロードする - XX-Prime's blog] | [http://xx-prime.hatenablog.com/entry/2015/04/26/224618 Arduino yunで放射線センサのデータをxivelyとM2Xにアップロードする - XX-Prime's blog] | ||
[http://qiita.com/kassy_kz/items/ebeda9bcda444cf401a0 IFTTTを用いてArduinoからツイートする | [http://qiita.com/kassy_kz/items/ebeda9bcda444cf401a0 IFTTTを用いてArduinoからツイートする] | ||
[https://github.com/itman83/ArduinoYun https://github.com/itman83/ArduinoYun] | [https://github.com/itman83/ArduinoYun https://github.com/itman83/ArduinoYun] | ||
Line 575: | Line 575: | ||
{ | { | ||
uint8_t sreg = SREG; | uint8_t sreg = SREG; | ||
noInterrupts(); // Protect from a scheduler and prevent transactionBegin | noInterrupts(); // Protect from a scheduler and prevent transactionBegin | ||
if (!initialized) { | if (!initialized) { | ||
// Set SS to high so a connected chip will be "deselected" by default | // Set SS to high so a connected chip will be "deselected" by default | ||
uint8_t port = digitalPinToPort(SS); | uint8_t port = digitalPinToPort(SS); | ||
uint8_t bit = digitalPinToBitMask(SS); | uint8_t bit = digitalPinToBitMask(SS); | ||
volatile uint8_t *reg = portModeRegister(port); | volatile uint8_t *reg = portModeRegister(port); | ||
// if the SS pin is not already configured as an output | // if the SS pin is not already configured as an output | ||
// then set it high (to enable the internal pull-up resistor) | // then set it high (to enable the internal pull-up resistor) | ||
if(!(*reg & bit)){ | if(!(*reg & bit)){ | ||
digitalWrite(SS, HIGH); | digitalWrite(SS, HIGH); | ||
} | } | ||
// When the SS pin is set as OUTPUT, it can be used as | // When the SS pin is set as OUTPUT, it can be used as | ||
// a general purpose output port (it doesn't influence | // a general purpose output port (it doesn't influence | ||
// SPI operations). | // SPI operations). | ||
pinMode(SS, OUTPUT); | pinMode(SS, OUTPUT); | ||
// Warning: if the SS pin ever becomes a LOW INPUT then SPI | // Warning: if the SS pin ever becomes a LOW INPUT then SPI | ||
// automatically switches to Slave, so the data direction of | // automatically switches to Slave, so the data direction of | ||
// the SS pin MUST be kept as OUTPUT. | // the SS pin MUST be kept as OUTPUT. | ||
SPCR |= _BV(MSTR); | SPCR |= _BV(MSTR); | ||
SPCR |= _BV(SPE); | SPCR |= _BV(SPE); | ||
Line 1,114: | Line 1,114: | ||
= Arduino Yún LininoOS 差分 = | = Arduino Yún LininoOS 差分 = | ||
* Arduino LLC 版 Arduino IDE で「ライブラリを管理...」から MCU 側の Ciao Library がインストールできるようになっていた。 | *Arduino LLC 版 Arduino IDE で「ライブラリを管理...」から MCU 側の Ciao Library がインストールできるようになっていた。 | ||
* Bridge Library か Ciao Library かは選択可能のように記述されている。(どちらか推奨があるわけではないみたい) | *Bridge Library か Ciao Library かは選択可能のように記述されている。(どちらか推奨があるわけではないみたい) | ||
* luci-app-arduino-webpanel (Linino 版) と Arduino-OS (arduinoos) かはこれも様子見っぽい。Arduino-OS は野心的なので安定するまでは様子見したほうがよさげ。 | *luci-app-arduino-webpanel (Linino 版) と Arduino-OS (arduinoos) かはこれも様子見っぽい。Arduino-OS は野心的なので安定するまでは様子見したほうがよさげ。 | ||
* LininoIO はまだ水面下っぽい。(MCUIO driver 系) コンセプトは素晴らしいが、vanilla kernel に取り込まれる勢いで OpenWrt / LEDE に入らないと将来はあやしい。 | *LininoIO はまだ水面下っぽい。(MCUIO driver 系) コンセプトは素晴らしいが、vanilla kernel に取り込まれる勢いで OpenWrt / LEDE に入らないと将来はあやしい。 | ||
**こんなのあるんだ。これを拡張するのかな [https://www.kernel.org/doc/html/latest/driver-api/iio/index.html Industrial I/O (IIO)] | |||
* | *公式版 LininoOS (LininoIO 版) は Barrier Breaker(14.07) ベース。 (/etc/linino_version には attitude_adjustment とあるが)(あかん..) | ||
*Chaos Calmer(15.05) ベースの LininoOS もあることはある。 | |||
* Chaos Calmer(15.05) ベースの LininoOS もあることはある。 | |||
= link = | = link = |