Starting attiny84 porting

This commit is contained in:
Tropicananass 2020-03-08 23:33:53 +01:00
parent 6c8e3f8c4a
commit 62c2b2af07
4 changed files with 61 additions and 55 deletions

View File

@ -1 +1,7 @@
#include "button.hpp" #include "button.hpp"
#include <Arduino.h>
bool Button::is_button_pressed(void) {
return (analogRead(0) > 950);
}

View File

@ -1,11 +1,10 @@
#ifndef __BUTTON_HPP__ #ifndef __BUTTON_HPP__
#define __BUTTON_HPP__ #define __BUTTON_HPP__
#include "pins.hpp"
class Button { class Button {
public: public:
Button(unsigned analogPin = BTN_ANALOGPIN, int vRef = BTN_VREF) : _aPin{analogPin}, _vRef{vRef} {}; Button(unsigned analogPin, int vRef) : _aPin{analogPin}, _vRef{vRef} {};
bool is_button_pressed(void);
private: private:
unsigned _aPin; unsigned _aPin;
int _vRef; int _vRef;

View File

@ -12,6 +12,7 @@ int RotaryEncoder::value_select(Display &display) {
_currentValue = newEncVal; _currentValue = newEncVal;
if (-4 >= _shift || _shift >= 4) { if (-4 >= _shift || _shift >= 4) {
/* todo make real comp : int size is target dependant */
int sign = _shift >> 2; int sign = _shift >> 2;
if (seconds < 60) { if (seconds < 60) {