This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
While(1) | |
{ | |
if(GetTimeSinceLastOn() ≥ 30) | |
{ | |
TurnPumpOn(); | |
} | |
if(GetTimeSinceLastToggle() ≥ 5) | |
{ | |
ToggleLights(); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
volatile uint8_t au8Arr[1024] __attribute__((section (".noinit"))); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* Creating a non initialized RAM section: */ | |
.noinit (NOLOAD): | |
{ | |
KEEP(*(.noinit)) /* keep my variable even if not referenced */ | |
} > RAM |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Test Name | P-Value | Status | |
---|---|---|---|
monobit_test | 0.323382809013 | PASS | |
frequency_within_block_test | 0.438787706963 | PASS | |
runs_test | 0.662321968913 | PASS | |
longest_run_ones_in_a_block_test | 0.0732778344642 | PASS | |
binary_matrix_rank_test | 0.751087894492 | PASS | |
dft_test | 0.653862901226 | PASS | |
non_overlapping_template_matching_test | 1.00000018173 | PASS | |
overlapping_template_matching_test | 0.10066003874 | PASS | |
maurers_universal_test | 0.568838019321 | PASS |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "stdio.h" | |
typedef void (*ptStateFunc)(void); | |
/// Define all events | |
typedef enum eEvent { | |
EVT_NO_EVENT, | |
EVT_BUTTON_PRESSED, | |
EVT_BEAN_CRUSHED, | |
EVT_MILK_HEATED, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void StateMachineHandler() | |
{ | |
int idx = 0; | |
if(EVT_NO_EVENT != eCurrentEvent) | |
{ | |
for(;idx < sizeof(stStm)/sizeof(stStmRow); idx++) | |
{ | |
if( (stStm[idx].pSrcState == stCurrentState) && | |
(stStm[idx].eEvt == eCurrentEvent)) | |
{ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
stStmRow stStm = { | |
{stateIdle , EVT_BUTTON_PRESSED, stateCrushBean }, | |
{stateCrushBean, EVT_BEAN_CRUSHED , stateHeatMilk }, | |
{stateCrushBean, EVT_NO_BEAN , stateError }, | |
{stateHeatMilk , EVT_MILK_HEATED , stateMixWater }, | |
{stateHeatMilk , EVT_NO_MILK , stateError }, | |
{stateMixWater , EVT_WATER_MIXED , stateDispenseCofee}, | |
{stateMixWater , EVT_NO_WATER , stateError } | |
}; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
typedef enum eState { | |
EVT_BUTTON_PRESSED, | |
EVT_BEAN_CRUSHED, | |
EVT_WATER_MIXED, | |
STATE_MIX_WATER, | |
STATE_DISPENSE_COFEE, | |
EVT_ERROR_NOTIFIED | |
} eState; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void stateIdle(); | |
void stateCrushBean(); | |
void stateHeatMilk(); | |
void stateMixWater(); | |
void stateDispenseCofee(); | |
void stateError(); | |
void stateCrushBean(void) | |
{ | |
if(bIsStateFirstEntry) |
NewerOlder