You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

77 lines
1.7 KiB

#include <ControlStates.h>
ControlDateState::ControlDateState(DS3231 &_ds3231)
{
ds3231 = _ds3231;
}
void ControlDateState::leftPressed(ViewStates &viewState, ControlStates &controlState)
{
switch (controlState)
{
case ControlStates::DATE_YEAR:
controlState = ControlStates::DATE_MONTH;
break;
case ControlStates::DATE_MONTH:
controlState = ControlStates::DATE_DATE;
break;
case ControlStates::DATE_DATE:
controlState = ControlStates::DATE_YEAR;
break;
}
};
void ControlDateState::rightPressed(ViewStates &viewState, ControlStates &controlState)
{
switch (controlState)
{
case ControlStates::DATE_DATE:
controlState = ControlStates::DATE_MONTH;
break;
case ControlStates::DATE_MONTH:
controlState = ControlStates::DATE_YEAR;
break;
case ControlStates::DATE_YEAR:
controlState = ControlStates::DATE_DATE;
break;
}
};
void ControlDateState::enterPressed(ViewStates &viewState, ControlStates &controlState)
{
controlState = ControlStates::VIEW;
};
void ControlDateState::decrementPressed(ViewStates &viewState, ControlStates &controlState)
{
switch (controlState)
{
case ControlStates::DATE_DATE:
ds3231.decrementDate();
break;
case ControlStates::DATE_MONTH:
ds3231.decrementMonth();
break;
case ControlStates::DATE_YEAR:
ds3231.decrementYear();
break;
}
};
void ControlDateState::incrementPressed(ViewStates &viewState, ControlStates &controlState)
{
switch (controlState)
{
case ControlStates::DATE_DATE:
ds3231.incrementDate();
break;
case ControlStates::DATE_MONTH:
ds3231.incrementMonth();
break;
case ControlStates::DATE_YEAR:
ds3231.incrementYear();
break;
}
};