本文整理汇总了C++中gpio::pinWrite方法的典型用法代码示例。如果您正苦于以下问题:C++ gpio::pinWrite方法的具体用法?C++ gpio::pinWrite怎么用?C++ gpio::pinWrite使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类gpio
的用法示例。
在下文中一共展示了gpio::pinWrite方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: begin
/** \brief Initialization of edOLED Library.
Setup IO pins for SPI port then send initialization commands to the
SSD1306 controller inside the OLED.
*/
void edOLED::begin()
{
// default 5x7 font
setFontType(0);
setColor(WHITE);
setDrawMode(NORM);
setCursor(0,0);
spiSetup();
RST_PIN.pinWrite(HIGH); //(digitalWrite(rstPin, HIGH);
usleep(5000); // VDD (3.3V) goes high at start, lets just chill for 5 ms
RST_PIN.pinWrite(LOW); // bring reset low
usleep(10000); // wait 10ms
RST_PIN.pinWrite(HIGH); //digitalWrite(rstPin, HIGH);
// Init sequence for 64x48 OLED module
command(DISPLAYOFF); // 0xAE
command(SETDISPLAYCLOCKDIV); // 0xD5
command(0x80); // the suggested ratio 0x80
command(SETMULTIPLEX); // 0xA8
command(0x2F);
command(SETDISPLAYOFFSET); // 0xD3
command(0x0); // no offset
command(SETSTARTLINE | 0x0); // line #0
command(CHARGEPUMP); // enable charge pump
command(0x14);
command(NORMALDISPLAY); // 0xA6
command(DISPLAYALLONRESUME); // 0xA4
command(SEGREMAP | 0x1);
command(COMSCANDEC);
command(SETCOMPINS); // 0xDA
command(0x12);
command(SETCONTRAST); // 0x81
command(0x8F);
command(SETPRECHARGE); // 0xd9
command(0xF1);
command(SETVCOMDESELECT); // 0xDB
command(0x40);
command(DISPLAYON); //--turn on oled panel
clear(ALL); // Erase hardware memory inside the OLED
}
示例2: data
/** \brief SPI data.
Setup DC and SS pins, then send data via SPI to SSD1306 controller.
*/
void edOLED::data(unsigned char c)
{
DC_PIN.pinWrite(HIGH); // DC HIGH
spiTransfer(c);
}
示例3: command
/** \brief SPI command.
Setup DC and SS pins, then send command via SPI to SSD1306 controller.
*/
void edOLED::command(unsigned char c)
{
DC_PIN.pinWrite(LOW); // DC pin LOW
spiTransfer(c);
}