Skip to content

File SR_4021.cpp

FileList > examples > SR_4021 > SR_4021.cpp

Go to the source code of this file

  • #include "daisy_seed.h"

Public Types

Type Name
typedef daisy::ShiftRegister4021< 1, 1 > ButtonSr

Public Attributes

Type Name
uint8_t btn_data
uint32_t btn_rising_edge_time
ButtonSr btn_shiftreg
daisy::GPIO callback_pin
daisy::DaisySeed hw

Public Static Attributes

Type Name
constexpr daisy::Pin kCallbackPin = daisy::seed::D23
constexpr daisy::Pin kPinSrClk = daisy::seed::D7
constexpr daisy::Pin kPinSrData = daisy::seed::D19
constexpr daisy::Pin kPinSrLatch = daisy::seed::D21
constexpr uint32_t kUsbPrintPeriod = 250

Public Functions

Type Name
void AudioCallback (daisy::AudioHandle::InputBuffer in, daisy::AudioHandle::OutputBuffer out, size_t size)
int main (void)

Public Types Documentation

typedef ButtonSr

using ButtonSr =  daisy::ShiftRegister4021<1, 1>;

SR 4021 Example This demonstrates the use of an CD4021 input shift register to read 8 buttons. Some auxillary code is included to debounce, and time the length presses.

The AudioCallback is utilized to read the buttons at 1kHz. Values are output via the USB Micro port.


Public Attributes Documentation

variable btn_data

uint8_t btn_data[8];

variable btn_rising_edge_time

uint32_t btn_rising_edge_time[8];

variable btn_shiftreg

ButtonSr btn_shiftreg;

variable callback_pin

daisy::GPIO callback_pin;

variable hw

daisy::DaisySeed hw;

Public Static Attributes Documentation

variable kCallbackPin

constexpr daisy::Pin kCallbackPin;

variable kPinSrClk

constexpr daisy::Pin kPinSrClk;

variable kPinSrData

constexpr daisy::Pin kPinSrData;

variable kPinSrLatch

constexpr daisy::Pin kPinSrLatch;

variable kUsbPrintPeriod

constexpr uint32_t kUsbPrintPeriod;

Public Functions Documentation

function AudioCallback

void AudioCallback (
    daisy::AudioHandle::InputBuffer in,
    daisy::AudioHandle::OutputBuffer out,
    size_t size
) 

function main

int main (
    void
) 


The documentation for this class was generated from the following file external-docs/libDaisy/examples/SR_4021/SR_4021.cpp