Skip to content

Commit

Permalink
Merge pull request #30 from dhebbeker/feature/misc-cleanup-to-main
Browse files Browse the repository at this point in the history
Miscellaneous cleaup of `main.cpp`
  • Loading branch information
FiveTeethless authored May 22, 2023
2 parents c7df8b7 + 1b07d38 commit dfad1e6
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,23 +2,23 @@
#include "board_pins.hpp"
#include "display.h"
#include "pitches.hpp"
//#include <ESP32Tone.h>
#include <Arduino.h>
#include <RoxMux.h>
#include <ShiftRegister74HC595.h>
#include <cmath>
#include <cstdint>

/**
* Output shift registers with most significant bit first.
*/
ShiftRegister74HC595<1U> outputShiftRegister(board::osr::pin::data, board::osr::pin::clock, board::osr::pin::latch);

/**
* Input shift register.
*/
Rox74HC165<1U> inputShiftRegister;

/**
*
* @return 1-8 or 0 in case of no event
* @returns 1-8 or 0 in case of no event
*/
static std::uint8_t getEvent()
{
Expand Down Expand Up @@ -49,7 +49,6 @@ namespace main
{
void setup(char const *programIdentificationString)
{
// put your setup code here, to run once:
pinMode(board::buzzer::pin::on_off, OUTPUT);
inputShiftRegister.begin(board::isr::pin::data, board::isr::pin::latch, board::isr::pin::clock);
setup_display();
Expand All @@ -64,6 +63,7 @@ void loop()
const auto event = getEvent();
if (event)
{
Serial.printf("Process event '%u'.\n", event);
constexpr std::uint16_t notes[] = {note::c3, note::d3, note::e3, note::f3, note::g3, note::a3, note::b3, note::c4};
const std::uint8_t newRegisterValue = 1 << (8 - event);
outputShiftRegister.setAll(&newRegisterValue);
Expand Down

0 comments on commit dfad1e6

Please sign in to comment.