STM32 core 3.0.1-dev
Arduino core for STM32 based boards: API reference
← STM32duino documentation
Loading...
Searching...
No Matches
wiring_shift.c File Reference

Bit-banged serial shift functions: shiftIn() and shiftOut(). More...

#include "Arduino.h"

Functions

uint8_t shiftIn (pin_size_t dataPin, pin_size_t clockPin, BitOrder bitOrder)
 Shift in a byte of data one bit at a time.
 
void shiftOut (pin_size_t dataPin, pin_size_t clockPin, BitOrder bitOrder, uint8_t val)
 Shift out a byte of data one bit at a time.
 

Detailed Description

Bit-banged serial shift functions: shiftIn() and shiftOut().

Function Documentation

◆ shiftIn()

uint8_t shiftIn ( pin_size_t  dataPin,
pin_size_t  clockPin,
BitOrder  bitOrder 
)

Shift in a byte of data one bit at a time.

Each bit is read while the clock is HIGH, then the clock is set back to LOW.

Parameters
dataPinPin number to read the data from.
clockPinPin number to clock the data on.
bitOrderLSBFIRST or MSBFIRST.
Returns
The byte read.

◆ shiftOut()

void shiftOut ( pin_size_t  dataPin,
pin_size_t  clockPin,
BitOrder  bitOrder,
uint8_t  val 
)

Shift out a byte of data one bit at a time.

Each bit is written to the data pin, then the clock is pulsed HIGH then LOW.

Parameters
dataPinPin number to write the data to.
clockPinPin number to clock the data on.
bitOrderLSBFIRST or MSBFIRST.
valByte to shift out.