add files for spooling motion

master
Eggert Jung 4 years ago
parent 8a759f7f21
commit f590396e0c

@ -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);

@ -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;
}
}

@ -0,0 +1,7 @@
#ifndef _SPULE_H_
#define _SPULE_H_
void timer5_init(void);
void do_spule(void);
#endif