add files for spooling motion
This commit is contained in:
2
main.c
2
main.c
@@ -23,6 +23,7 @@
|
||||
#include "kraftsensor.h"
|
||||
#include "taenzer.h"
|
||||
#include "abzug.h"
|
||||
#include "spule.h"
|
||||
|
||||
Client mqtt_client;
|
||||
|
||||
@@ -199,6 +200,7 @@ int main()
|
||||
do_notaus();
|
||||
do_abzug();
|
||||
do_taenzer();
|
||||
do_spule();
|
||||
|
||||
#if PLC_MQTT_ENABLED
|
||||
ioHelperSetBit(outStates, LED_BUS_OK, 1);
|
||||
|
||||
30
spule.c
Normal file
30
spule.c
Normal file
@@ -0,0 +1,30 @@
|
||||
#include <avr/io.h>
|
||||
#include "avrIOhelper/io-helper.h"
|
||||
|
||||
void timer5_init()
|
||||
{
|
||||
TCCR5A |= (1<<COM5C1);
|
||||
TCCR5B |= _BV(WGM53);
|
||||
|
||||
ICR5 = 500;
|
||||
OCR5C = 250;
|
||||
|
||||
DDRL |= 1 << 5;
|
||||
}
|
||||
|
||||
void do_spule(){
|
||||
if (read_Input(BTN_WICKELN_EIN, RISING)) {
|
||||
TCCR5B |= _BV(CS51); //TURN ON
|
||||
}
|
||||
if (read_Input(BTN_WICKELN_AUS, RISING)) {
|
||||
TCCR5B &= ~(_BV(CS51));
|
||||
}
|
||||
if (read_Input(BTN_TAENZER_START, RISING)) {
|
||||
ICR5-=15;
|
||||
OCR5C = ICR5/2;
|
||||
}
|
||||
if (read_Input(BTN_SPULENWECHSEL, RISING)) {
|
||||
ICR5+=15;
|
||||
OCR5C = ICR5/2;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user