Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Diff: ws2812B.cpp
- Revision:
- 4:874beb47b375
- Parent:
- 3:e09aafc9cabe
--- a/ws2812B.cpp Mon Sep 26 02:05:50 2016 +0000 +++ b/ws2812B.cpp Mon Nov 21 09:28:49 2016 +0000 @@ -2,21 +2,23 @@ // SPI を使って WS2812B を点灯するためのクラス // サポートするボード: Nucleo-F401RE, Nucleo-F446RE // -// 2016/09/26, Copyright (c) 2016 MIKAMI, Naoki +// 2016/11/21, Copyright (c) 2016 MIKAMI, Naoki //-------------------------------------------------------- #include "ws2812B.hpp" +#include "PeripheralPins.h" // for pinmap_peripheral() namespace Mikami { WS2812B::WS2812B(PinName pin, bool inv) - : SPI(pin, NC, NC), mySpi_((SPI_TypeDef *)_spi.spi) + : spi_(pin, NC, NC), + mySpi_((SPI_TypeDef *)pinmap_peripheral(pin, PinMap_SPI_MOSI)) { - format(8, 0); + spi_.format(8, 0); // クロックを 23 MHz 以下で最大の値に設定 // F401RE: 21.0 MHz // F446RE: 22.5 MHz - frequency(23000000); + spi_.frequency(23000000); if (!inv) fp = &WS2812B::SendByteNorm; else fp = &WS2812B::SendByteInv;