mirror of
https://github.com/RobTillaart/Arduino.git
synced 2024-09-19 16:46:11 -04:00
0.1.2 shiftOutSlow
This commit is contained in:
parent
a77e4b2772
commit
5ba1bc47d5
@ -2,6 +2,10 @@ compile:
|
||||
# Choosing to run compilation tests on 2 different Arduino platforms
|
||||
platforms:
|
||||
- uno
|
||||
- leonardo
|
||||
- due
|
||||
- zero
|
||||
# - due
|
||||
# - zero
|
||||
# - leonardo
|
||||
- m4
|
||||
- esp32
|
||||
# - esp8266
|
||||
# - mega2560
|
||||
|
@ -4,10 +4,14 @@ name: Arduino CI
|
||||
on: [push, pull_request]
|
||||
|
||||
jobs:
|
||||
arduino_ci:
|
||||
runTest:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: Arduino-CI/action@master
|
||||
# Arduino-CI/action@v0.1.1
|
||||
- uses: ruby/setup-ruby@v1
|
||||
with:
|
||||
ruby-version: 2.6
|
||||
- run: |
|
||||
gem install arduino_ci
|
||||
arduino_ci.rb
|
||||
|
@ -1,6 +1,6 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2021-2021 Rob Tillaart
|
||||
Copyright (c) 2021-2022 Rob Tillaart
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
|
@ -1,14 +1,18 @@
|
||||
|
||||
[![Arduino CI](https://github.com/RobTillaart/ShiftOutSlow/workflows/Arduino%20CI/badge.svg)](https://github.com/marketplace/actions/arduino_ci)
|
||||
[![Arduino-lint](https://github.com/RobTillaart/ShiftOutSlow/actions/workflows/arduino-lint.yml/badge.svg)](https://github.com/RobTillaart/ShiftOutSlow/actions/workflows/arduino-lint.yml)
|
||||
[![JSON check](https://github.com/RobTillaart/ShiftOutSlow/actions/workflows/jsoncheck.yml/badge.svg)](https://github.com/RobTillaart/ShiftOutSlow/actions/workflows/jsoncheck.yml)
|
||||
[![License: MIT](https://img.shields.io/badge/license-MIT-green.svg)](https://github.com/RobTillaart/ShiftOutSlow/blob/master/LICENSE)
|
||||
[![GitHub release](https://img.shields.io/github/release/RobTillaart/ShiftOutSlow.svg?maxAge=3600)](https://github.com/RobTillaart/ShiftOutSlow/releases)
|
||||
|
||||
|
||||
# ShiftOutSlow
|
||||
|
||||
Arduino library for shiftOut with build-in delay - e.g. for 74HC595
|
||||
|
||||
A library for shiftInSlow also exist.
|
||||
|
||||
|
||||
## Description
|
||||
|
||||
|
||||
@ -33,7 +37,7 @@ resulting in "better" pulses.
|
||||
|
||||
The interface exists of the following functions:
|
||||
|
||||
- **ShiftOutSlow(dataPin, clockPin, bitOrder = LSBFIRST)** constructor.
|
||||
- **ShiftOutSlow(uint8_t dataPin, uint8_t clockPin, uint8_t bitOrder = LSBFIRST)** constructor.
|
||||
- **size_t write(uint8_t data)** writes a new value. Returns the bytes written.
|
||||
- **size_t write(const uint8_t \*buffer, size_t size)** writes an array of size over shift out. Uses **write(uint8_t)** so expect about equal performance. Returns the bytes written.
|
||||
- **uint8_t lastWritten()** returns last value written.
|
||||
@ -41,8 +45,8 @@ The interface exists of the following functions:
|
||||
Note that the delay is not the time per bit but an additional time per bit.
|
||||
Note: the delay can be set runtime per write / print call.
|
||||
- **uint16_t getDelay()** returns the set delay in microseconds.
|
||||
- **bool setBitOrder(bitOrder)** set LSBFIRST or MSBFIRST. Returns false for other values.
|
||||
Note: bitorder can be changed runtime per write / print call.
|
||||
- **bool setBitOrder(uint8_t bitOrder)** set LSBFIRST or MSBFIRST. Returns false for other values.
|
||||
Note: bit order can be changed runtime per write / print call.
|
||||
- **uint8_t getBitOrder(void)** returns LSBFIRST or MSBFIRST (typical 0 and 1).
|
||||
|
||||
|
||||
@ -62,4 +66,14 @@ See examples.
|
||||
## Future
|
||||
|
||||
- Add a select pin to be more SPI alike?
|
||||
- improve documentation
|
||||
- add examples
|
||||
- increase max delay uint32_t ?
|
||||
- set delay in terms of frequency - delay is 'wave length'
|
||||
- set delay in terms of max total time the read may cost.
|
||||
- set default delay = 0, is no delay ?
|
||||
- adaptive speed example?
|
||||
- get set dutyCycle(0 .. 99%)
|
||||
- optimize the place to yield() ?
|
||||
- create releaseNotes.md
|
||||
|
||||
|
@ -1,15 +1,16 @@
|
||||
//
|
||||
// FILE: ShiftOutSlow.cpp
|
||||
// AUTHOR: Rob Tillaart
|
||||
// VERSION: 0.1.1
|
||||
// VERSION: 0.1.2
|
||||
// PURPOSE: Arduino library for shiftOut with build-in delay
|
||||
// DATE: 2021-05-11
|
||||
// URL: https://github.com/RobTillaart/ShiftOutSlow
|
||||
|
||||
//
|
||||
// HISTORY
|
||||
// 0.1.0 2021-05-11 initial version
|
||||
// 0.1.1 2021-08-16 add write(buffer, size) = print interface.
|
||||
// improve delay math; update readme.md
|
||||
// 0.1.2 2021-12-28 update library.json, readme, license, minor edits"
|
||||
|
||||
|
||||
#include "ShiftOutSlow.h"
|
||||
@ -73,4 +74,6 @@ bool ShiftOutSlow::setBitOrder(const uint8_t bitOrder)
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
// -- END OF FILE --
|
||||
|
||||
|
@ -2,7 +2,7 @@
|
||||
//
|
||||
// FILE: ShiftOutSlow.h
|
||||
// AUTHOR: Rob Tillaart
|
||||
// VERSION: 0.1.1
|
||||
// VERSION: 0.1.2
|
||||
// PURPOSE: Arduino library for shiftOut with build-in delay
|
||||
// DATE: 2021-05-11
|
||||
// URL: https://github.com/RobTillaart/ShiftOutSlow
|
||||
@ -12,13 +12,13 @@
|
||||
#include "Arduino.h"
|
||||
|
||||
|
||||
#define SHIFTOUTSLOW_LIB_VERSION (F("0.1.1"))
|
||||
#define SHIFTOUTSLOW_LIB_VERSION (F("0.1.2"))
|
||||
|
||||
|
||||
class ShiftOutSlow : public Print
|
||||
{
|
||||
public:
|
||||
// bitorder = { LSBFIRST, MSBFIRST };
|
||||
// bitOrder = { LSBFIRST, MSBFIRST };
|
||||
ShiftOutSlow(const uint8_t dataPin, const uint8_t clockPin, const uint8_t bitOrder = LSBFIRST);
|
||||
|
||||
// PRINT INTERFACE
|
||||
@ -36,11 +36,13 @@ public:
|
||||
|
||||
|
||||
private:
|
||||
uint8_t _clockPin = 0 ;
|
||||
uint8_t _clockPin = 0;
|
||||
uint8_t _dataPin = 0;
|
||||
uint8_t _bitOrder = LSBFIRST;
|
||||
uint16_t _delay = 0;
|
||||
uint8_t _value = 0;
|
||||
};
|
||||
|
||||
|
||||
// -- END OF FILE --
|
||||
|
||||
|
@ -1,10 +1,8 @@
|
||||
//
|
||||
// FILE: shiftOutSlow_demo.ino
|
||||
// AUTHOR: Rob Tillaart
|
||||
// VERSION: 0.1.0
|
||||
// PURPOSE: test sketch
|
||||
// URL: https://github.com/RobTillaart/ShiftOutSlow
|
||||
//
|
||||
|
||||
|
||||
#include "ShiftOutSlow.h"
|
||||
@ -14,6 +12,7 @@ ShiftOutSlow SOS(12, 13, LSBFIRST);
|
||||
|
||||
volatile int x = 0;
|
||||
|
||||
|
||||
void setup()
|
||||
{
|
||||
Serial.begin(115200);
|
||||
@ -35,8 +34,11 @@ void setup()
|
||||
Serial.println("done...");
|
||||
}
|
||||
|
||||
|
||||
void loop()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
// -- END OF FILE --
|
||||
|
||||
|
@ -1,10 +1,8 @@
|
||||
//
|
||||
// FILE: shiftOutSlow_print.ino
|
||||
// AUTHOR: Rob Tillaart
|
||||
// VERSION: 0.1.0
|
||||
// PURPOSE: test sketch for print interface
|
||||
// URL: https://github.com/RobTillaart/ShiftOutSlow
|
||||
//
|
||||
|
||||
|
||||
#include "ShiftOutSlow.h"
|
||||
@ -14,6 +12,7 @@ ShiftOutSlow SOS(12, 13, LSBFIRST);
|
||||
|
||||
volatile int x = 0;
|
||||
|
||||
|
||||
void setup()
|
||||
{
|
||||
Serial.begin(115200);
|
||||
@ -85,14 +84,16 @@ void setup()
|
||||
delay(10);
|
||||
}
|
||||
|
||||
|
||||
Serial.println(LSBFIRST);
|
||||
Serial.println(MSBFIRST);
|
||||
Serial.println("done...");
|
||||
}
|
||||
|
||||
|
||||
void loop()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
// -- END OF FILE --
|
||||
|
||||
|
@ -1,14 +1,17 @@
|
||||
# Syntax Coloring Map For ShiftOutSlow
|
||||
# Syntax Colouring Map For ShiftOutSlow
|
||||
|
||||
# Datatypes (KEYWORD1)
|
||||
|
||||
# Data types (KEYWORD1)
|
||||
ShiftOutSlow KEYWORD1
|
||||
|
||||
|
||||
# Methods and Functions (KEYWORD2)
|
||||
read KEYWORD2
|
||||
lastRead KEYWORD2
|
||||
lastWriiten KEYWORD2
|
||||
|
||||
setBitOrder KEYWORD2
|
||||
getBitOrder KEYWORD2
|
||||
|
||||
setDelay KEYWORD2
|
||||
getDelay KEYWORD2
|
||||
|
||||
|
@ -15,8 +15,9 @@
|
||||
"type": "git",
|
||||
"url": "https://github.com/RobTillaart/ShiftOutSlow.git"
|
||||
},
|
||||
"version": "0.1.1",
|
||||
"version": "0.1.2",
|
||||
"license": "MIT",
|
||||
"frameworks": "arduino",
|
||||
"platforms": "*"
|
||||
"platforms": "*",
|
||||
"headers": "ShiftOutSlow.h"
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
name=ShiftOutSlow
|
||||
version=0.1.1
|
||||
version=0.1.2
|
||||
author=Rob Tillaart <rob.tillaart@gmail.com>
|
||||
maintainer=Rob Tillaart <rob.tillaart@gmail.com>
|
||||
sentence=Arduino library for shiftOut with build-in delay - e.g. for 74HC165
|
||||
|
@ -37,6 +37,7 @@
|
||||
|
||||
unittest_setup()
|
||||
{
|
||||
fprintf(stderr, "SHIFTOUTSLOW_LIB_VERSION:\t%s\n", (char *) SHIFTOUTSLOW_LIB_VERSION);
|
||||
}
|
||||
|
||||
unittest_teardown()
|
||||
@ -48,7 +49,6 @@ unittest(test_constructor)
|
||||
{
|
||||
ShiftOutSlow SOS(12, 13);
|
||||
|
||||
fprintf(stderr, "VERSION:\t%s\n", SHIFTOUTSLOW_LIB_VERSION);
|
||||
assertEqual(1, SOS.write(65));
|
||||
assertEqual(65, SOS.lastWritten());
|
||||
assertEqual(LSBFIRST, SOS.getBitOrder());
|
||||
@ -62,7 +62,6 @@ unittest(test_constructor_LSB)
|
||||
{
|
||||
ShiftOutSlow SOS(12, 13, LSBFIRST);
|
||||
|
||||
fprintf(stderr, "VERSION:\t%s\n", SHIFTOUTSLOW_LIB_VERSION);
|
||||
assertEqual(1, SOS.write(65));
|
||||
assertEqual(65, SOS.lastWritten());
|
||||
assertEqual(LSBFIRST, SOS.getBitOrder());
|
||||
@ -76,7 +75,6 @@ unittest(test_constructor_MSB)
|
||||
{
|
||||
ShiftOutSlow SOS(12, 13, MSBFIRST);
|
||||
|
||||
fprintf(stderr, "VERSION:\t%s\n", SHIFTOUTSLOW_LIB_VERSION);
|
||||
assertEqual(1, SOS.write(65));
|
||||
assertEqual(65, SOS.lastWritten());
|
||||
assertEqual(MSBFIRST, SOS.getBitOrder());
|
||||
@ -90,7 +88,6 @@ unittest(test_setDelay)
|
||||
{
|
||||
ShiftOutSlow SOS(12, 13);
|
||||
|
||||
fprintf(stderr, "VERSION:\t%s\n", SHIFTOUTSLOW_LIB_VERSION);
|
||||
for (uint16_t d = 0; d < 1000; d += 100)
|
||||
{
|
||||
SOS.setDelay(d);
|
||||
@ -103,7 +100,6 @@ unittest(test_print_interface)
|
||||
{
|
||||
ShiftOutSlow SOS(12, 13);
|
||||
|
||||
fprintf(stderr, "VERSION:\t%s\n", SHIFTOUTSLOW_LIB_VERSION);
|
||||
int x = SOS.print("hello world");
|
||||
assertEqual(11, x);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user