forked from vjval1974/Brew-Machine-MkIV
/
stir.c
56 lines (44 loc) · 987 Bytes
/
stir.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
/*
* stir.c
*
* Created on: Aug 24, 2013
* Author: brad
*/
//-------------------------------------------------------------------------
// Included Libraries
//-------------------------------------------------------------------------
#include <stdint.h>
#include <stdio.h>
#include "stm32f10x.h"
#include "FreeRTOS.h"
#include "lcd.h"
#include "task.h"
#include "adc.h"
#include "leds.h"
#include "semphr.h"
#include "I2C-IO.h"
#include "stir.h"
#include "stirApplet.h"
volatile StirState xStirState;
void vStirInit(void){
// The stirrer motor is on the i2c output board.
vPCF_ResetBits(STIR_PIN, STIR_PORT); //pull low
xStirState = STIR_STOPPED;
vSemaphoreCreateBinary(xStirAppletRunningSemaphore);
}
void vStir( StirState state )
{
if (state == STIR_DRIVING)
{
vPCF_SetBits(STIR_PIN, STIR_PORT);
}
else
{
vPCF_ResetBits(STIR_PIN, STIR_PORT);
}
xStirState = state;
}
StirState xGetStirState(void)
{
return xStirState;
}