GR-SAKURAが発売されたのは2011年末頃で、その当時はWebコンパイラかRenesasのe2 studioあたりを使うしかなかった。 Arduino類似のライブラリが公開されていなかったため、ローカルでビルド環境を整えるのは面倒であったが、 Arduinoから派生したIDE4GRという簡単な開発環境が作られ、ローカルでArduinoと同じ使用感で開発出来るようになった。 このIDE4GRの最新バージョンには、GR-PEACH(RZ/A1H (R7S721001VCBG, 外部FLASH 8MB/内蔵RAM 10MB)及びGR-LYCHEE(RZ/A1LU (R7S721030VCFP), 外部FLASH 8MB/内蔵RAM3MB) 向けのOpenCVライブラリが統合されており、これらのマイコン単体ではOpenCVによる画像処理ができる。
SW3がRUN側の時、初めの電源ONで、書き込まれたファームウエアが開始し、一回リセットするとUSB Mass storageでファームウエア書き込み可能なモードになる。 ここで書き込むと、書き込んだファームウエアが自動的に開始される。SW3がRUNと反対側の時はGeneric Boot Deviceで、RenesasのFDTでファームウエア・ブート路だ書き込みができる。
ボード上の4つあるLEDは使用できる。サンプルの初期コードはGR-KURUMI用にled = 23になっているが、GR-SAKURAではPIN_LED0、PIN_LED1、PIN_LED2、PIN_LED3で 定義されている。
/*
Blink
Turns on an LED on for one second, then off for one second, repeatedly.
This example code is in the public domain.
*/
// Pin 23 has an green LED connected on most KURUMI boards.
// give it a name:
int led = PIN_LED0;
// the setup routine runs once when you press reset:
void setup() {
// initialize the digital pin as an output.
pinMode(led, OUTPUT);
}
// the loop routine runs over and over again forever:
void loop() {
digitalWrite(led, HIGH); // turn the LED on (HIGH is the voltage level)
delay(1000); // wait for a second
digitalWrite(led, LOW); // turn the LED off by making the voltage LOW
delay(1000); // wait for a second
}
Ethernetについては、執筆時点のIDE4GR 1.03では、 GR-KURUMIはWIZ550ioモジュールを使用した上での対応、GR-SAKURA(RX63N)のみ内蔵ペリフェラル対応となっており、GR-KAEDE(RX64M)、GR-PEACH(RZ/A1H)については未対応のようであり、 IDE4GRで開発する時は、ネットワーク・画像処理等の用途によって使い分けるのが良いだろう。あるいは以前通りWebコンパイラかe2 studioを使うことになる。 GR-SAKURAのEthernetライブラリには、Renesasのスタックが組み込まれているので、ArduinoのEthernetシールドを使う要領で使用できるが、もちろんシールドは必要ない。 シリアルは、CDCのVCOMドライバを入れる必要があり、配布されているinfを使ってインストールすると良い。 このファイルは特殊電子回路謹製であるが、そのサイトによると、RX621のEthernetは100Mbpsだが、 スループットはそれほど良くなく、せいぜい40Mbpsとのことである。 COMポートを表示しながらサンプルのWebServerを走らせると、シリアルが遅いため応答に詰まりが見られる。
Hain't we got all the fools in town on our side? And hain't that a big
enough majority in any town?
-- Mark Twain, "Huckleberry Finn"
<jrockway> btw, feel free to LOL:
http://stackoverflow.com/questions/605641/how-to-use-classarrayobjects
<jrockway> wow, such concise code
<jrockway> and i can FEEL THE SPEED from using arrays
<rjbs> bowl full of mush
<rindolf> jrockway: there was a discussion about using arrays as
objects in module-authors.
<jrockway> i read it and laughed
<jrockway> (yeah, someone is wrong on the internet, but i don't
really care)
<rjbs> I use JSON strings as my objects, and define my classes
in terms of regexps that pull out the right attributes.
<rjbs> It makes the code portable to JavaScript, except the
methods.
<jrockway> great plan!
<jrockway> regexps are fast in perl, because perl is designed for
parsing text
<rjbs> tx, can I add "endorsed by jon rockway" to my precis?
<jrockway> oh yeah
<jrockway> i recommend you reverse the JSON first, though, to
provide better encapsulation
<jrockway> otherwise people could read the objects... and that
breaks encapsulation, dontchaknow
<rjbs> I use UTF-16 and rot4096.
<jrockway> UTF-16 IS TOO SLOW!
<rindolf> Heh.
<jrockway> i can't believe we are even having this conversation...
utf-16...
<jrockway> i am never speaking to you again!
* rindolf wonders how one can combine JSON with inside-out
objects.
<rjbs> jrockway: no, no, WITHOUT the bom
<rjbs> BOM is what makes it slow.
<rjbs> rindolf: sub id { my $self = shift; $json_parser_for{
$self }->decode($json_for{ $self })->{id} }
<rindolf> rjbs: LOL.
<rindolf> rjbs++
<Dylan> unicode: somebody set us up the BOM
<ilmari> BOM-de-ada
<rindolf> Where's the BOM? There was supposed to be an
earth-shattering Ka-BOM!
<rjbs> I think Iran has it.
<perigrin> if it doesn't ... Sen. McCain will introduce a bill to
provide them with one
<rjbs> give the bom bom bom, bom to Iran
<rjbs> funnier if you pronounce Iran properly
<perigrin> iran ... iran so far away ...
<rindolf> iRack - http://www.youtube.com/watch?v=rw2nkoGLhrE
<autarch> someone set us up the BOM
<jnapiorkowski> I thought all our base waz ownzed or something like that
* confound is the king of BOM
<rjbs> who's the BOM king?
<confound> I'm the BOM king!
<ubu> "once i was the King of BOM"
<rjbs> hear me now
-- Lightning Fast Objects
-- #moose, irc.perl.org