Code Monkey home page Code Monkey logo

74hc595's Introduction

74HC595

STM32 LL(Low-Layer) shift register library. A shift register allows to expand the number of I/O pins you can use from any microcontroller.

Features

  • No limit in register count
  • Easy bit manipulation
  • Small code footprint

image

Add as CPM project dependency

How to add CPM to the project, check the link

CPMAddPackage(
        NAME 74HC595
        GITHUB_REPOSITORY ximtech/74HC595
        GIT_TAG origin/main)

Project configuration

  1. Start project with STM32CubeMX:
  2. Select: Project Manager -> Advanced Settings -> SPI -> LL
  3. Generate Code
  4. Add sources to project:
add_subdirectory(${STM32_CORE_SOURCE_DIR}/SPI/Polling)  # add SPI to project

include_directories(${74HC595_DIRECTORY})   # source directories
file(GLOB_RECURSE SOURCES ${74HC595_SOURCES})    # source files
  1. Then Build -> Clean -> Rebuild Project

Wiring

  • image
  • image
  • image

Usage

#include "74HC595.h"

#define SHIFT_REGISTER_COUNT 2
#define DELAY 50

int main() {
    
    ShiftRegister shiftRegister = initShiftRegister(SPI1, CHIP_SELECT_GPIO_Port, CHIP_SELECT_Pin, SHIFT_REGISTER_COUNT, REG_RESET_GPIO_Port, REG_RESET_Pin);
    uint16_t binaryCounter = 0;
    
    while (1) {
        sendU16ToShiftRegister(&shiftRegister, binaryCounter);
        latchShiftRegister(&shiftRegister);
        binaryCounter++;
        delay_ms(DELAY);
    }
}

74hc595's People

Contributors

ximtech avatar

Stargazers

 avatar  avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.