mirror of
https://github.com/eddyem/scorpio.git
synced 2025-12-06 10:45:15 +03:00
Add firmware for atmega8535 based driver of SCORPIO base platform module
This commit is contained in:
parent
715da979f1
commit
c975836b2c
79
avr/scorpio1_module/Makefile
Normal file
79
avr/scorpio1_module/Makefile
Normal file
@ -0,0 +1,79 @@
|
|||||||
|
## FUSES: l:0xFF h:0xC9
|
||||||
|
## avrdude -v -pm8535 -cusbasp -Pusb -b19200 -U hfuse:w:0xc9:m -U lfuse:w:0xff:m
|
||||||
|
|
||||||
|
|
||||||
|
NAME = scorpio_p1
|
||||||
|
|
||||||
|
OBJCOPY = avr-objcopy
|
||||||
|
OBJDUMP = avr-objdump
|
||||||
|
CC = avr-gcc
|
||||||
|
OPTIMIZE= -Os
|
||||||
|
DEFS = -DBAUD=9600
|
||||||
|
#DEFS += -DEBUG
|
||||||
|
LIBS =
|
||||||
|
|
||||||
|
# controller
|
||||||
|
DEVICE = atmega8535
|
||||||
|
# Clock 8 MHz
|
||||||
|
CLOCK = 8000000
|
||||||
|
# partno (for avrdude)
|
||||||
|
PARTNO = m8535
|
||||||
|
|
||||||
|
CFLAGS = -g -Wall $(OPTIMIZE) $(DEFS)
|
||||||
|
LDFLAGS = -Wl,-Map,$(NAME).map
|
||||||
|
|
||||||
|
# programmer (for avrdude)
|
||||||
|
PROGRAMMER = usbasp
|
||||||
|
|
||||||
|
# serial port device (for avrdude)
|
||||||
|
SERPORT = usb
|
||||||
|
|
||||||
|
SRC=$(wildcard *.c)
|
||||||
|
HEX = $(NAME).hex
|
||||||
|
ELF = $(NAME).elf
|
||||||
|
OBJECTS = $(SRC:%.c=%.o)
|
||||||
|
|
||||||
|
# avrdude command from arduino IDE
|
||||||
|
AVRDUDE = avrdude -v -p$(PARTNO) -c$(PROGRAMMER) -P$(SERPORT) -b19200
|
||||||
|
|
||||||
|
COMPILE = $(CC) $(CFLAGS) -mmcu=$(DEVICE) -DF_CPU=$(CLOCK)
|
||||||
|
|
||||||
|
all: $(HEX) lst
|
||||||
|
|
||||||
|
$(ELF): $(OBJECTS)
|
||||||
|
@echo "ELF"
|
||||||
|
@$(COMPILE) $(LDFLAGS) -o $(ELF) $(OBJECTS) $(LIBS)
|
||||||
|
|
||||||
|
$(HEX): $(ELF)
|
||||||
|
@echo "HEX"
|
||||||
|
@rm -f $(HEX)
|
||||||
|
@$(OBJCOPY) -j .text -j .data -O ihex $(ELF) $(HEX)
|
||||||
|
@avr-size $(ELF)
|
||||||
|
|
||||||
|
.c.o:
|
||||||
|
@$(COMPILE) -c $< -o $@
|
||||||
|
|
||||||
|
.S.o:
|
||||||
|
@$(COMPILE) -x assembler-with-cpp -c $< -o $@
|
||||||
|
|
||||||
|
.c.s:
|
||||||
|
@$(COMPILE) -S $< -o $@
|
||||||
|
|
||||||
|
lst: $(NAME).lst
|
||||||
|
|
||||||
|
%.lst: %.elf
|
||||||
|
@echo "Make listing"
|
||||||
|
@$(OBJDUMP) -h -S $< > $@
|
||||||
|
|
||||||
|
flash: all
|
||||||
|
@echo "Flash"
|
||||||
|
$(AVRDUDE) -U flash:w:$(HEX):i
|
||||||
|
|
||||||
|
clean:
|
||||||
|
@echo "Clean"
|
||||||
|
@rm -f $(ELF) $(OBJECTS) *.lst *.map
|
||||||
|
|
||||||
|
gentags:
|
||||||
|
CFLAGS="$(CFLAGS) -I/usr/avr/include" geany -g $(NAME).c.tags *.[hc] 2>/dev/null
|
||||||
|
|
||||||
|
.PHONY: gentags clean
|
||||||
70
avr/scorpio1_module/Readme.md
Normal file
70
avr/scorpio1_module/Readme.md
Normal file
@ -0,0 +1,70 @@
|
|||||||
|
SCORPIO main controller
|
||||||
|
============================
|
||||||
|
|
||||||
|
### Based on atmega8535
|
||||||
|
|
||||||
|
## PINS description
|
||||||
|
|
||||||
|
* A0 - endswitch "+"
|
||||||
|
* A1 - endswitch "-"
|
||||||
|
* B0 - polarisator magnet
|
||||||
|
* B1 - caret relay
|
||||||
|
* B2 - analisator/disperser relay + wheel end-switch 2 turn off
|
||||||
|
|
||||||
|
* C0..C3 - stepper phases
|
||||||
|
* C4 - select collimator
|
||||||
|
* C5 - select analisator
|
||||||
|
* C6 - select turret No2
|
||||||
|
* C7 - select turret No1
|
||||||
|
|
||||||
|
* D0 - USART Rx
|
||||||
|
* D1 - USART Tx
|
||||||
|
|
||||||
|
## Commands protocol
|
||||||
|
All commands should be in **square brackets**. Spaces between parts inside command ignored.
|
||||||
|
|
||||||
|
As heritage, The device have number "1", so it would parse only commands with format **"[1 Xxx]\n"**.
|
||||||
|
If all OK the answer echoes input command or send some other data, in case of error there's nothing
|
||||||
|
in answer.
|
||||||
|
|
||||||
|
All commands of motors' moving have an option -- end-switches check. To do this just ask to move for
|
||||||
|
0 steps. Answer have format like **[1 x ST=y]** where x is motor number and y is end-switch position
|
||||||
|
(1 for "-", 2 for "+" and 3 for intermediate position).
|
||||||
|
|
||||||
|
## List of commands:
|
||||||
|
|
||||||
|
* **[1 0]** -- *(new behaviour, old was "restart")* -- stop all motors, due to working watchdog there's no need to make full system restart.
|
||||||
|
This command have an answer: "Scorpio_0".
|
||||||
|
|
||||||
|
* **[1 1 xxx]** -- move focuser (approx. 100 steps per millimeter).
|
||||||
|
|
||||||
|
* **[1 2 xxx]** -- move polariser motor.
|
||||||
|
|
||||||
|
* **[1 3 xxx]** -- rotate turret 2.
|
||||||
|
|
||||||
|
* **[1 4 xxx]** -- rotate turret 1.
|
||||||
|
|
||||||
|
* **[1 6 x]** -- turn on (x==1) or off (x==0) relay of analysator magnet and turrets end-switch1 off/on.
|
||||||
|
|
||||||
|
* **[1 7 x]** -- move disperser motor to position x (1 - IFP, 0 - Grizm).
|
||||||
|
|
||||||
|
* **[1 8 x]** -- change end-switches check between analiser (x==1) and disperser (x==0).
|
||||||
|
|
||||||
|
* **[1 9 xxx]** -- change motor's speed. Motor period = 8 * 65535/(xxx + 10) microseconds.
|
||||||
|
|
||||||
|
* **[1 b x]** -- change value of PB0..PB3 to x.
|
||||||
|
|
||||||
|
* **[1 l]** -- tell amount of steps left.
|
||||||
|
|
||||||
|
* **[1 t]** -- show approx. time from start.
|
||||||
|
|
||||||
|
* **[1 w x]** -- change stepper diagram to x (x=0..7).
|
||||||
|
|
||||||
|
## How to change turret's position
|
||||||
|
|
||||||
|
First you should move turrets to zero-position end-switch: **[1 x 5000]** (here and later: x==3 for
|
||||||
|
turrer No2 and x==4 for turret No1). The "zero" position lays between first and last filters.
|
||||||
|
To move into first position just do **[1 x -300]**. Turret will move to end-switch of stable position.
|
||||||
|
To move further you should turn off intermediate end-switches: **[1 6 1]**. After that move from
|
||||||
|
end-switch: **[1 x -20]**, turn on end-switches: **[1 6 0]** and move to next position: **[1 x 300]**.
|
||||||
|
|
||||||
87
avr/scorpio1_module/includes.h
Normal file
87
avr/scorpio1_module/includes.h
Normal file
@ -0,0 +1,87 @@
|
|||||||
|
/*
|
||||||
|
* geany_encoding=koi8-r
|
||||||
|
* includes.h
|
||||||
|
*
|
||||||
|
* Copyright 2017 Edward V. Emelianov <eddy@sao.ru, edward.emelianoff@gmail.com>
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation; either version 2 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
||||||
|
* MA 02110-1301, USA.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
#ifndef __INCLUDES_H__
|
||||||
|
#define __INCLUDES_H__
|
||||||
|
|
||||||
|
#include <avr/io.h> // IO ports
|
||||||
|
#include <avr/wdt.h> // WDT
|
||||||
|
#include <avr/interrupt.h>
|
||||||
|
#include <avr/io.h> // IO ports
|
||||||
|
#include <stdint.h> // int types
|
||||||
|
#include <util/setbaud.h> // baudrate calculation helper
|
||||||
|
|
||||||
|
#include "proto.h"
|
||||||
|
#include "uart.h"
|
||||||
|
#include "stepper.h"
|
||||||
|
|
||||||
|
#ifdef EBUG
|
||||||
|
#define DBG(x) usart_send(x)
|
||||||
|
#else
|
||||||
|
#define DBG(x)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// module 1
|
||||||
|
#define MODULEID '1'
|
||||||
|
|
||||||
|
#define STPRS_OFF() do{PORTC = 0;}while(0)
|
||||||
|
|
||||||
|
// #define () do{}while(0)
|
||||||
|
/*
|
||||||
|
// original MCU
|
||||||
|
#define STPRS_OFF() do{PORTD |= 0xfc; PORTC |= 0x0f;}while(0)
|
||||||
|
#define DDRAB DDRA
|
||||||
|
#define PORTAB PORTA
|
||||||
|
// 8535 have common irq register for all timers
|
||||||
|
#define TIMSK0 TIMSK
|
||||||
|
#define TIMSK1 TIMSK
|
||||||
|
#define UCSR0A UCSRA
|
||||||
|
#define UCSR0B UCSRB
|
||||||
|
#define UCSR0C UCSRC
|
||||||
|
#define UDRIE0 UDRIE
|
||||||
|
#define FE0 FE
|
||||||
|
#define UPE0 PE
|
||||||
|
#define DOR0 DOR
|
||||||
|
#define UDRIE0 UDRIE
|
||||||
|
#define UDR0 UDR
|
||||||
|
#define UBRR0H UBRRH
|
||||||
|
#define UBRR0L UBRRL
|
||||||
|
#define U2X0 U2X
|
||||||
|
#define UCSZ01 UCSZ1
|
||||||
|
#define UCSZ00 UCSZ0
|
||||||
|
#define RXEN0 RXEN
|
||||||
|
#define TXEN0 TXEN
|
||||||
|
#define RXCIE0 RXCIE
|
||||||
|
|
||||||
|
#define LED1_PIN (_BV(0))
|
||||||
|
#define LED2_PIN (_BV(1))
|
||||||
|
#define LED3_PIN (_BV(2))
|
||||||
|
#define FLAT_PIN (_BV(5))
|
||||||
|
#define NEON_PIN (_BV(6))
|
||||||
|
#define SHTR_PIN (_BV(7))
|
||||||
|
*/
|
||||||
|
|
||||||
|
//#define PORTA_PINS (FLAT_PIN | NEON_PIN | SHTR_PIN | LED1_PIN | LED2_PIN | LED3_PIN)
|
||||||
|
|
||||||
|
#endif // __INCLUDES_H__
|
||||||
95
avr/scorpio1_module/main.c
Normal file
95
avr/scorpio1_module/main.c
Normal file
@ -0,0 +1,95 @@
|
|||||||
|
/*
|
||||||
|
* geany_encoding=koi8-r
|
||||||
|
* main.c
|
||||||
|
*
|
||||||
|
* Copyright 2017 Edward V. Emelianov <eddy@sao.ru, edward.emelianoff@gmail.com>
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation; either version 2 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
||||||
|
* MA 02110-1301, USA.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "includes.h"
|
||||||
|
|
||||||
|
volatile uint16_t Milliseconds = 0, Seconds = 0, days = 0;
|
||||||
|
volatile uint8_t tick_ctr = 0, hours = 0;
|
||||||
|
|
||||||
|
|
||||||
|
void print_time(){
|
||||||
|
printUint((uint8_t*)&days, 2);
|
||||||
|
usart_send("d");
|
||||||
|
printUint((uint8_t*)&hours, 1);
|
||||||
|
usart_send("h");
|
||||||
|
printUint((uint8_t*)&Seconds, 2);
|
||||||
|
usart_send("s");
|
||||||
|
printUint((uint8_t*)&Milliseconds, 2);
|
||||||
|
usart_send("ms\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
int main() {
|
||||||
|
DDRC = 0xff; // steppers diagram & stepper select
|
||||||
|
DDRB = 0x07; // PB0..PB2 - pol/caret management etc
|
||||||
|
STPRS_OFF(); // turn off steppers before configuring to output
|
||||||
|
PORTB |= _BV(1);
|
||||||
|
|
||||||
|
/** USART config **/
|
||||||
|
// set baudrate
|
||||||
|
UCSRA = 0;
|
||||||
|
UCSRC = _BV(UCSZ1) | _BV(UCSZ0); // 8-bit data
|
||||||
|
UCSRB = _BV(RXEN) | _BV(TXEN) | _BV(RXCIE); // Enable RX and TX, enable RX interrupt
|
||||||
|
UBRRH = 0; // 9600
|
||||||
|
UBRRL = 51;
|
||||||
|
|
||||||
|
/** setup timer 0 - system timer **/
|
||||||
|
// set prescaler to 8 and start the timer (1MHz*256 = 0.256ms period)
|
||||||
|
TCCR0 |= _BV(CS01);
|
||||||
|
TIMSK |= _BV(TOIE0);
|
||||||
|
|
||||||
|
stepper_setup();
|
||||||
|
|
||||||
|
sei(); // enable interrupts
|
||||||
|
|
||||||
|
wdt_enable(WDTO_2S); // start watchdog
|
||||||
|
#ifdef EBUG
|
||||||
|
usart_send("Scorpio module1 ready\n");
|
||||||
|
#endif
|
||||||
|
while(1){
|
||||||
|
wdt_reset();
|
||||||
|
if(stepper_pulse) stepper_process();
|
||||||
|
if(usart_flags & U_RX_COMPLETE)
|
||||||
|
process_string();
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
uint8_t LEDs[3] = {20,20,20}; // LEDs shining time
|
||||||
|
|
||||||
|
ISR(TIMER0_OVF_vect){
|
||||||
|
//static uint8_t shi_counter = 0;
|
||||||
|
TCNT0 += 6; // -> 0.250ms period
|
||||||
|
if(++tick_ctr == 4){
|
||||||
|
tick_ctr = 0;
|
||||||
|
if(++Milliseconds == 1000){
|
||||||
|
Milliseconds = 0;
|
||||||
|
if(++Seconds == 3600){
|
||||||
|
Seconds = 0;
|
||||||
|
if(++hours == 24){
|
||||||
|
hours = 0;
|
||||||
|
++days;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
165
avr/scorpio1_module/proto.c
Normal file
165
avr/scorpio1_module/proto.c
Normal file
@ -0,0 +1,165 @@
|
|||||||
|
/*
|
||||||
|
* geany_encoding=koi8-r
|
||||||
|
* proto.c - base protocol definitions
|
||||||
|
*
|
||||||
|
* Copyright 2017 Edward V. Emelianov <eddy@sao.ru, edward.emelianoff@gmail.com>
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation; either version 2 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
||||||
|
* MA 02110-1301, USA.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "includes.h"
|
||||||
|
|
||||||
|
extern void print_time();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Move motor for given amount of steps, cmd should be 'N nnnn any other symbols',
|
||||||
|
* N - motor number,
|
||||||
|
* nnnn - steps (-32768...32768)
|
||||||
|
* @return 1 if all OK
|
||||||
|
*/
|
||||||
|
uint8_t move_motor(uint8_t N, char *cmd){
|
||||||
|
N -= '0';
|
||||||
|
int16_t steps;
|
||||||
|
if(!readInt(cmd, &steps)) return 1;
|
||||||
|
#ifdef EBUG
|
||||||
|
usart_send("Move motor ");
|
||||||
|
printUint((uint8_t*)&N, 1);
|
||||||
|
usart_send(" for ");
|
||||||
|
print_long((uint32_t)steps);
|
||||||
|
usart_send("steps\n");
|
||||||
|
#endif
|
||||||
|
return stepper_move(N, steps);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* process commands from user buffer
|
||||||
|
* @return 0 if there's need to echo input cmdline
|
||||||
|
*/
|
||||||
|
uint8_t process_commands(char *cmd){
|
||||||
|
cmd = omit_whitespace(cmd + 1);
|
||||||
|
char s = *cmd;
|
||||||
|
cmd = omit_whitespace(cmd + 1);
|
||||||
|
int16_t port;
|
||||||
|
switch(s){
|
||||||
|
case '0': // stop motors
|
||||||
|
DBG("restart");
|
||||||
|
stop_motors();
|
||||||
|
usart_send("Scorpio_0\n");
|
||||||
|
return 1;
|
||||||
|
break;
|
||||||
|
case '1': // move focus motor
|
||||||
|
DBG("focus");
|
||||||
|
return move_motor(s, cmd);
|
||||||
|
break;
|
||||||
|
case '2':
|
||||||
|
DBG("polar");
|
||||||
|
return move_motor(s, cmd);
|
||||||
|
break;
|
||||||
|
case '3':
|
||||||
|
DBG("turr2");
|
||||||
|
return move_motor(s, cmd);
|
||||||
|
break;
|
||||||
|
case '4':
|
||||||
|
DBG("turr1");
|
||||||
|
return move_motor(s, cmd);
|
||||||
|
break;
|
||||||
|
case '5':
|
||||||
|
DBG("temper");
|
||||||
|
return 1;
|
||||||
|
break;
|
||||||
|
case '6':
|
||||||
|
DBG("pol. magnet");
|
||||||
|
if(*cmd == '1') PORTB |= _BV(0);
|
||||||
|
else PORTB &= ~_BV(0);
|
||||||
|
break;
|
||||||
|
case '7':
|
||||||
|
DBG("dispenser");
|
||||||
|
if(*cmd == '1'){ // IFP
|
||||||
|
PORTB |= _BV(1);
|
||||||
|
}else{ // Grizm
|
||||||
|
PORTB &= ~_BV(1);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case '8':
|
||||||
|
DBG("an/disp");
|
||||||
|
if(*cmd == '1'){ // analisator
|
||||||
|
PORTB |= _BV(2);
|
||||||
|
}else{ // disperser
|
||||||
|
PORTB &= ~_BV(2);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case '9':
|
||||||
|
DBG("set spd");
|
||||||
|
return stepper_ch_speed(cmd);
|
||||||
|
break;
|
||||||
|
case 'b': // set PB value
|
||||||
|
if(!readInt(cmd, &port) || port < 0 || port > 7) return 1;
|
||||||
|
usart_send("set portb to");
|
||||||
|
printUint((uint8_t*)&port, 2);
|
||||||
|
usart_send("\n");
|
||||||
|
PORTB = port;
|
||||||
|
break;
|
||||||
|
case 'l': // return Steps_left
|
||||||
|
usart_send("[1 left=");
|
||||||
|
printUint((uint8_t*) &Steps_left, 2);
|
||||||
|
usart_send("]\n");
|
||||||
|
return 1;
|
||||||
|
break;
|
||||||
|
case 't': // show approx. time from start
|
||||||
|
print_time();
|
||||||
|
break;
|
||||||
|
case 'w':
|
||||||
|
return chk_stpr_cmd(*cmd);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
void process_string(){
|
||||||
|
if((usart_flags & U_RX_COMPLETE) == 0) return;
|
||||||
|
uint8_t noerr = 1, oldflags = usart_flags;
|
||||||
|
usart_flags &= ~(U_RX_COMPLETE | U_RX_OVERFL | U_RX_ERROR);
|
||||||
|
if(oldflags & U_RX_OVERFL){
|
||||||
|
DBG("Input buffer overflow\n");
|
||||||
|
noerr = 0;
|
||||||
|
}
|
||||||
|
if(oldflags & U_RX_ERROR){
|
||||||
|
DBG("Rx error\n");
|
||||||
|
noerr = 0;
|
||||||
|
}
|
||||||
|
if(rx_bufsize < 3 || rx_buffer[0] != '[' || rx_buffer[rx_bufsize - 2] != ']'){
|
||||||
|
rx_bufsize = 0;
|
||||||
|
rx_buffer[0] = 0;
|
||||||
|
noerr = 0;
|
||||||
|
}
|
||||||
|
if(noerr){ // echo back given string & process command
|
||||||
|
rx_buffer[rx_bufsize] = 0;
|
||||||
|
char *cmd = omit_whitespace(&rx_buffer[1]);
|
||||||
|
uint8_t rbs = rx_bufsize;
|
||||||
|
rx_bufsize = 0;
|
||||||
|
if(*cmd == MODULEID){
|
||||||
|
char *c = rx_copy, *o = rx_buffer;
|
||||||
|
do{ *c++ = *o; }while(*o++);
|
||||||
|
rx_buffer[rbs - 2] = 0;
|
||||||
|
if(!process_commands(cmd)) usart_send(rx_copy);;
|
||||||
|
}else{
|
||||||
|
rx_buffer[0] = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
30
avr/scorpio1_module/proto.h
Normal file
30
avr/scorpio1_module/proto.h
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
/*
|
||||||
|
* geany_encoding=koi8-r
|
||||||
|
* proto.h
|
||||||
|
*
|
||||||
|
* Copyright 2017 Edward V. Emelianov <eddy@sao.ru, edward.emelianoff@gmail.com>
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation; either version 2 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
||||||
|
* MA 02110-1301, USA.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
#ifndef __PROTO_H__
|
||||||
|
#define __PROTO_H__
|
||||||
|
|
||||||
|
void process_string();
|
||||||
|
uint8_t move_motor(uint8_t num, char *cmd);
|
||||||
|
#endif // __PROTO_H__
|
||||||
549
avr/scorpio1_module/scorpio_p1.c.tags
Normal file
549
avr/scorpio1_module/scorpio_p1.c.tags
Normal file
@ -0,0 +1,549 @@
|
|||||||
|
# format=tagmanager
|
||||||
|
AVR_STACK_POINTER_ADDRÌ65536Ö0
|
||||||
|
AVR_STACK_POINTER_LO_ADDRÌ65536Ö0
|
||||||
|
AVR_STACK_POINTER_LO_REGÌ65536Ö0
|
||||||
|
AVR_STACK_POINTER_REGÌ65536Ö0
|
||||||
|
AVR_STATUS_ADDRÌ65536Ö0
|
||||||
|
AVR_STATUS_REGÌ65536Ö0
|
||||||
|
BADISR_vectÌ65536Ö0
|
||||||
|
BAUDÌ65536Ö0
|
||||||
|
BAUD_TOLÌ65536Ö0
|
||||||
|
DBGÌ131072Í(x)Ö0
|
||||||
|
DD0Ì65536Ö0
|
||||||
|
DD1Ì65536Ö0
|
||||||
|
DD2Ì65536Ö0
|
||||||
|
DD3Ì65536Ö0
|
||||||
|
DD4Ì65536Ö0
|
||||||
|
DD5Ì65536Ö0
|
||||||
|
DD6Ì65536Ö0
|
||||||
|
DD7Ì65536Ö0
|
||||||
|
EMPTY_INTERRUPTÌ131072Í(vector)Ö0
|
||||||
|
FUSEMEMÌ65536Ö0
|
||||||
|
FUSESÌ65536Ö0
|
||||||
|
INT16_CÌ131072Í(c)Ö0
|
||||||
|
INT32_CÌ131072Í(c)Ö0
|
||||||
|
INT64_CÌ131072Í(c)Ö0
|
||||||
|
INT8_CÌ131072Í(c)Ö0
|
||||||
|
INTMAX_CÌ131072Í(c)Ö0
|
||||||
|
ISRÌ131072Í(vector,...)Ö0
|
||||||
|
ISR_ALIASÌ131072Í(vector,tgt)Ö0
|
||||||
|
ISR_ALIASOFÌ131072Í(v)Ö0
|
||||||
|
ISR_BLOCKÌ65536Ö0
|
||||||
|
ISR_NAKEDÌ65536Ö0
|
||||||
|
ISR_NOBLOCKÌ65536Ö0
|
||||||
|
LEDsÌ16384Ö0Ïuint8_t
|
||||||
|
LOCKBITSÌ65536Ö0
|
||||||
|
LOCKBITS_DEFAULTÌ65536Ö0
|
||||||
|
LOCKMEMÌ65536Ö0
|
||||||
|
MODULEIDÌ65536Ö0
|
||||||
|
MillisecondsÌ16384Ö0Ïvolatile uint16_t
|
||||||
|
PIN0Ì65536Ö0
|
||||||
|
PIN1Ì65536Ö0
|
||||||
|
PIN2Ì65536Ö0
|
||||||
|
PIN3Ì65536Ö0
|
||||||
|
PIN4Ì65536Ö0
|
||||||
|
PIN5Ì65536Ö0
|
||||||
|
PIN6Ì65536Ö0
|
||||||
|
PIN7Ì65536Ö0
|
||||||
|
PORT0Ì65536Ö0
|
||||||
|
PORT1Ì65536Ö0
|
||||||
|
PORT2Ì65536Ö0
|
||||||
|
PORT3Ì65536Ö0
|
||||||
|
PORT4Ì65536Ö0
|
||||||
|
PORT5Ì65536Ö0
|
||||||
|
PORT6Ì65536Ö0
|
||||||
|
PORT7Ì65536Ö0
|
||||||
|
RX_BUFFER_SIZEÌ65536Ö0
|
||||||
|
SIGNALÌ131072Í(vector)Ö0
|
||||||
|
SPÌ65536Ö0
|
||||||
|
SPLÌ65536Ö0
|
||||||
|
SREGÌ65536Ö0
|
||||||
|
SREG_CÌ65536Ö0
|
||||||
|
SREG_HÌ65536Ö0
|
||||||
|
SREG_IÌ65536Ö0
|
||||||
|
SREG_NÌ65536Ö0
|
||||||
|
SREG_SÌ65536Ö0
|
||||||
|
SREG_TÌ65536Ö0
|
||||||
|
SREG_VÌ65536Ö0
|
||||||
|
SREG_ZÌ65536Ö0
|
||||||
|
STPRS_OFFÌ131072Í()Ö0
|
||||||
|
SecondsÌ16384Ö0Ïuint16_t
|
||||||
|
Steps_leftÌ16384Ö0Ïuint16_t
|
||||||
|
Steps_leftÌ32768Ö0Ïuint16_t
|
||||||
|
TIMER0_OVF_vectÌ16Í(void)Ö0Ïvoid
|
||||||
|
TIMER0_OVF_vectÌ1024Í(void)Ö0ÏÓ void
|
||||||
|
TIMER1_COMPA_vectÌ16Í(void)Ö0Ïvoid
|
||||||
|
TIMER1_COMPA_vectÌ1024Í(void)Ö0ÏÓ void
|
||||||
|
TX_BUFFER_SIZEÌ65536Ö0
|
||||||
|
UBRRH_VALUEÌ65536Ö0
|
||||||
|
UBRRL_VALUEÌ65536Ö0
|
||||||
|
UBRR_VALUEÌ65536Ö0
|
||||||
|
UINT16_CÌ131072Í(c)Ö0
|
||||||
|
UINT32_CÌ131072Í(c)Ö0
|
||||||
|
UINT64_CÌ131072Í(c)Ö0
|
||||||
|
UINT8_CÌ131072Í(c)Ö0
|
||||||
|
UINTMAX_CÌ131072Í(c)Ö0
|
||||||
|
USART_RX_vectÌ16Í(void)Ö0Ïvoid
|
||||||
|
USART_RX_vectÌ1024Í(void)Ö0ÏÓ void
|
||||||
|
USART_UDRE_vectÌ16Í(void)Ö0Ïvoid
|
||||||
|
USART_UDRE_vectÌ1024Í(void)Ö0ÏÓ void
|
||||||
|
USE_2XÌ65536Ö0
|
||||||
|
U_RX_COMPLETEÌ65536Ö0
|
||||||
|
U_RX_ERRORÌ65536Ö0
|
||||||
|
U_RX_OVERFLÌ65536Ö0
|
||||||
|
U_TX_COMPLETEÌ65536Ö0
|
||||||
|
U_TX_ERRORÌ65536Ö0
|
||||||
|
UstepÌ16384Ö0Ïint8_t
|
||||||
|
WDTO_120MSÌ65536Ö0
|
||||||
|
WDTO_15MSÌ65536Ö0
|
||||||
|
WDTO_1SÌ65536Ö0
|
||||||
|
WDTO_250MSÌ65536Ö0
|
||||||
|
WDTO_2SÌ65536Ö0
|
||||||
|
WDTO_30MSÌ65536Ö0
|
||||||
|
WDTO_500MSÌ65536Ö0
|
||||||
|
WDTO_60MSÌ65536Ö0
|
||||||
|
XHÌ65536Ö0
|
||||||
|
XLÌ65536Ö0
|
||||||
|
YHÌ65536Ö0
|
||||||
|
YLÌ65536Ö0
|
||||||
|
ZHÌ65536Ö0
|
||||||
|
ZLÌ65536Ö0
|
||||||
|
_AVR_COMMON_HÌ65536Ö0
|
||||||
|
_AVR_FUSE_H_Ì65536Ö0
|
||||||
|
_AVR_INTERRUPT_H_Ì65536Ö0
|
||||||
|
_AVR_IO_H_Ì65536Ö0
|
||||||
|
_AVR_LOCK_H_Ì65536Ö0
|
||||||
|
_AVR_PORTPINS_H_Ì65536Ö0
|
||||||
|
_AVR_SFR_DEFS_H_Ì65536Ö0
|
||||||
|
_AVR_VERSION_H_Ì65536Ö0
|
||||||
|
_AVR_WDT_H_Ì65536Ö0
|
||||||
|
_BVÌ131072Í(bit)Ö0
|
||||||
|
_FORTIFY_SOURCEÌ65536Ö0
|
||||||
|
_GNU_SOURCEÌ65536Ö0
|
||||||
|
_LP64Ì65536Ö0
|
||||||
|
_MMIO_BYTEÌ131072Í(mem_addr)Ö0
|
||||||
|
_MMIO_DWORDÌ131072Í(mem_addr)Ö0
|
||||||
|
_MMIO_WORDÌ131072Í(mem_addr)Ö0
|
||||||
|
_SFR_ADDRÌ131072Í(sfr)Ö0
|
||||||
|
_SFR_ASM_COMPATÌ65536Ö0
|
||||||
|
_SFR_BYTEÌ131072Í(sfr)Ö0
|
||||||
|
_SFR_DWORDÌ131072Í(sfr)Ö0
|
||||||
|
_SFR_IO16Ì131072Í(io_addr)Ö0
|
||||||
|
_SFR_IO8Ì131072Í(io_addr)Ö0
|
||||||
|
_SFR_IO_ADDRÌ131072Í(sfr)Ö0
|
||||||
|
_SFR_IO_REG_PÌ131072Í(sfr)Ö0
|
||||||
|
_SFR_MEM16Ì131072Í(mem_addr)Ö0
|
||||||
|
_SFR_MEM32Ì131072Í(mem_addr)Ö0
|
||||||
|
_SFR_MEM8Ì131072Í(mem_addr)Ö0
|
||||||
|
_SFR_MEM_ADDRÌ131072Í(sfr)Ö0
|
||||||
|
_SFR_WORDÌ131072Í(sfr)Ö0
|
||||||
|
_STDC_PREDEF_HÌ65536Ö0
|
||||||
|
_VECTORÌ131072Í(N)Ö0
|
||||||
|
_WD_CHANGE_BITÌ65536Ö0
|
||||||
|
_WD_CONTROL_REGÌ65536Ö0
|
||||||
|
_WD_PS3_MASKÌ65536Ö0
|
||||||
|
__ATOMIC_ACQUIREÌ65536Ö0
|
||||||
|
__ATOMIC_ACQ_RELÌ65536Ö0
|
||||||
|
__ATOMIC_CONSUMEÌ65536Ö0
|
||||||
|
__ATOMIC_HLE_ACQUIREÌ65536Ö0
|
||||||
|
__ATOMIC_HLE_RELEASEÌ65536Ö0
|
||||||
|
__ATOMIC_RELAXEDÌ65536Ö0
|
||||||
|
__ATOMIC_RELEASEÌ65536Ö0
|
||||||
|
__ATOMIC_SEQ_CSTÌ65536Ö0
|
||||||
|
__AVR_LIBC_DATE_Ì65536Ö0
|
||||||
|
__AVR_LIBC_DATE_STRING__Ì65536Ö0
|
||||||
|
__AVR_LIBC_MAJOR__Ì65536Ö0
|
||||||
|
__AVR_LIBC_MINOR__Ì65536Ö0
|
||||||
|
__AVR_LIBC_REVISION__Ì65536Ö0
|
||||||
|
__AVR_LIBC_VERSION_STRING__Ì65536Ö0
|
||||||
|
__AVR_LIBC_VERSION__Ì65536Ö0
|
||||||
|
__BIGGEST_ALIGNMENT__Ì65536Ö0
|
||||||
|
__BYTE_ORDER__Ì65536Ö0
|
||||||
|
__CHAR16_TYPE__Ì65536Ö0
|
||||||
|
__CHAR32_TYPE__Ì65536Ö0
|
||||||
|
__CHAR_BIT__Ì65536Ö0
|
||||||
|
__CONCATÌ131072Í(left,right)Ö0
|
||||||
|
__CONCATenateÌ131072Í(left,right)Ö0
|
||||||
|
__DBL_DECIMAL_DIG__Ì65536Ö0
|
||||||
|
__DBL_DENORM_MIN__Ì65536Ö0
|
||||||
|
__DBL_DIG__Ì65536Ö0
|
||||||
|
__DBL_EPSILON__Ì65536Ö0
|
||||||
|
__DBL_HAS_DENORM__Ì65536Ö0
|
||||||
|
__DBL_HAS_INFINITY__Ì65536Ö0
|
||||||
|
__DBL_HAS_QUIET_NAN__Ì65536Ö0
|
||||||
|
__DBL_MANT_DIG__Ì65536Ö0
|
||||||
|
__DBL_MAX_10_EXP__Ì65536Ö0
|
||||||
|
__DBL_MAX_EXP__Ì65536Ö0
|
||||||
|
__DBL_MAX__Ì65536Ö0
|
||||||
|
__DBL_MIN_10_EXP__Ì65536Ö0
|
||||||
|
__DBL_MIN_EXP__Ì65536Ö0
|
||||||
|
__DBL_MIN__Ì65536Ö0
|
||||||
|
__DEC128_EPSILON__Ì65536Ö0
|
||||||
|
__DEC128_MANT_DIG__Ì65536Ö0
|
||||||
|
__DEC128_MAX_EXP__Ì65536Ö0
|
||||||
|
__DEC128_MAX__Ì65536Ö0
|
||||||
|
__DEC128_MIN_EXP__Ì65536Ö0
|
||||||
|
__DEC128_MIN__Ì65536Ö0
|
||||||
|
__DEC128_SUBNORMAL_MIN__Ì65536Ö0
|
||||||
|
__DEC32_EPSILON__Ì65536Ö0
|
||||||
|
__DEC32_MANT_DIG__Ì65536Ö0
|
||||||
|
__DEC32_MAX_EXP__Ì65536Ö0
|
||||||
|
__DEC32_MAX__Ì65536Ö0
|
||||||
|
__DEC32_MIN_EXP__Ì65536Ö0
|
||||||
|
__DEC32_MIN__Ì65536Ö0
|
||||||
|
__DEC32_SUBNORMAL_MIN__Ì65536Ö0
|
||||||
|
__DEC64_EPSILON__Ì65536Ö0
|
||||||
|
__DEC64_MANT_DIG__Ì65536Ö0
|
||||||
|
__DEC64_MAX_EXP__Ì65536Ö0
|
||||||
|
__DEC64_MAX__Ì65536Ö0
|
||||||
|
__DEC64_MIN_EXP__Ì65536Ö0
|
||||||
|
__DEC64_MIN__Ì65536Ö0
|
||||||
|
__DEC64_SUBNORMAL_MIN__Ì65536Ö0
|
||||||
|
__DECIMAL_BID_FORMAT__Ì65536Ö0
|
||||||
|
__DECIMAL_DIG__Ì65536Ö0
|
||||||
|
__DEC_EVAL_METHOD__Ì65536Ö0
|
||||||
|
__DEPRECATEDÌ65536Ö0
|
||||||
|
__ELF__Ì65536Ö0
|
||||||
|
__EXCEPTIONSÌ65536Ö0
|
||||||
|
__FINITE_MATH_ONLY__Ì65536Ö0
|
||||||
|
__FLOAT_WORD_ORDER__Ì65536Ö0
|
||||||
|
__FLT_DECIMAL_DIG__Ì65536Ö0
|
||||||
|
__FLT_DENORM_MIN__Ì65536Ö0
|
||||||
|
__FLT_DIG__Ì65536Ö0
|
||||||
|
__FLT_EPSILON__Ì65536Ö0
|
||||||
|
__FLT_EVAL_METHOD__Ì65536Ö0
|
||||||
|
__FLT_HAS_DENORM__Ì65536Ö0
|
||||||
|
__FLT_HAS_INFINITY__Ì65536Ö0
|
||||||
|
__FLT_HAS_QUIET_NAN__Ì65536Ö0
|
||||||
|
__FLT_MANT_DIG__Ì65536Ö0
|
||||||
|
__FLT_MAX_10_EXP__Ì65536Ö0
|
||||||
|
__FLT_MAX_EXP__Ì65536Ö0
|
||||||
|
__FLT_MAX__Ì65536Ö0
|
||||||
|
__FLT_MIN_10_EXP__Ì65536Ö0
|
||||||
|
__FLT_MIN_EXP__Ì65536Ö0
|
||||||
|
__FLT_MIN__Ì65536Ö0
|
||||||
|
__FLT_RADIX__Ì65536Ö0
|
||||||
|
__FXSR__Ì65536Ö0
|
||||||
|
__GCC_ASM_FLAG_OUTPUTS__Ì65536Ö0
|
||||||
|
__GCC_ATOMIC_BOOL_LOCK_FREEÌ65536Ö0
|
||||||
|
__GCC_ATOMIC_CHAR16_T_LOCK_FREEÌ65536Ö0
|
||||||
|
__GCC_ATOMIC_CHAR32_T_LOCK_FREEÌ65536Ö0
|
||||||
|
__GCC_ATOMIC_CHAR_LOCK_FREEÌ65536Ö0
|
||||||
|
__GCC_ATOMIC_INT_LOCK_FREEÌ65536Ö0
|
||||||
|
__GCC_ATOMIC_LLONG_LOCK_FREEÌ65536Ö0
|
||||||
|
__GCC_ATOMIC_LONG_LOCK_FREEÌ65536Ö0
|
||||||
|
__GCC_ATOMIC_POINTER_LOCK_FREEÌ65536Ö0
|
||||||
|
__GCC_ATOMIC_SHORT_LOCK_FREEÌ65536Ö0
|
||||||
|
__GCC_ATOMIC_TEST_AND_SET_TRUEVALÌ65536Ö0
|
||||||
|
__GCC_ATOMIC_WCHAR_T_LOCK_FREEÌ65536Ö0
|
||||||
|
__GCC_HAVE_DWARF2_CFI_ASMÌ65536Ö0
|
||||||
|
__GCC_HAVE_SYNC_COMPARE_AND_SWAP_1Ì65536Ö0
|
||||||
|
__GCC_HAVE_SYNC_COMPARE_AND_SWAP_2Ì65536Ö0
|
||||||
|
__GCC_HAVE_SYNC_COMPARE_AND_SWAP_4Ì65536Ö0
|
||||||
|
__GCC_HAVE_SYNC_COMPARE_AND_SWAP_8Ì65536Ö0
|
||||||
|
__GCC_IEC_559Ì65536Ö0
|
||||||
|
__GCC_IEC_559_COMPLEXÌ65536Ö0
|
||||||
|
__GLIBCXX_BITSIZE_INT_N_0Ì65536Ö0
|
||||||
|
__GLIBCXX_TYPE_INT_N_0Ì65536Ö0
|
||||||
|
__GNUC_MINOR__Ì65536Ö0
|
||||||
|
__GNUC_PATCHLEVEL__Ì65536Ö0
|
||||||
|
__GNUC_STDC_INLINE__Ì65536Ö0
|
||||||
|
__GNUC__Ì65536Ö0
|
||||||
|
__GNUG__Ì65536Ö0
|
||||||
|
__GXX_ABI_VERSIONÌ65536Ö0
|
||||||
|
__GXX_EXPERIMENTAL_CXX0X__Ì65536Ö0
|
||||||
|
__GXX_RTTIÌ65536Ö0
|
||||||
|
__GXX_WEAK__Ì65536Ö0
|
||||||
|
__INCLUDES_H__Ì65536Ö0
|
||||||
|
__INT16_CÌ131072Í(c)Ö0
|
||||||
|
__INT16_MAX__Ì65536Ö0
|
||||||
|
__INT16_TYPE__Ì65536Ö0
|
||||||
|
__INT32_CÌ131072Í(c)Ö0
|
||||||
|
__INT32_MAX__Ì65536Ö0
|
||||||
|
__INT32_TYPE__Ì65536Ö0
|
||||||
|
__INT64_CÌ131072Í(c)Ö0
|
||||||
|
__INT64_MAX__Ì65536Ö0
|
||||||
|
__INT64_TYPE__Ì65536Ö0
|
||||||
|
__INT8_CÌ131072Í(c)Ö0
|
||||||
|
__INT8_MAX__Ì65536Ö0
|
||||||
|
__INT8_TYPE__Ì65536Ö0
|
||||||
|
__INTMAX_CÌ131072Í(c)Ö0
|
||||||
|
__INTMAX_MAX__Ì65536Ö0
|
||||||
|
__INTMAX_TYPE__Ì65536Ö0
|
||||||
|
__INTPTR_MAX__Ì65536Ö0
|
||||||
|
__INTPTR_TYPE__Ì65536Ö0
|
||||||
|
__INTR_ATTRSÌ65536Ö0
|
||||||
|
__INTTYPES_H_Ì65536Ö0
|
||||||
|
__INT_FAST16_MAX__Ì65536Ö0
|
||||||
|
__INT_FAST16_TYPE__Ì65536Ö0
|
||||||
|
__INT_FAST32_MAX__Ì65536Ö0
|
||||||
|
__INT_FAST32_TYPE__Ì65536Ö0
|
||||||
|
__INT_FAST64_MAX__Ì65536Ö0
|
||||||
|
__INT_FAST64_TYPE__Ì65536Ö0
|
||||||
|
__INT_FAST8_MAX__Ì65536Ö0
|
||||||
|
__INT_FAST8_TYPE__Ì65536Ö0
|
||||||
|
__INT_LEAST16_MAX__Ì65536Ö0
|
||||||
|
__INT_LEAST16_TYPE__Ì65536Ö0
|
||||||
|
__INT_LEAST32_MAX__Ì65536Ö0
|
||||||
|
__INT_LEAST32_TYPE__Ì65536Ö0
|
||||||
|
__INT_LEAST64_MAX__Ì65536Ö0
|
||||||
|
__INT_LEAST64_TYPE__Ì65536Ö0
|
||||||
|
__INT_LEAST8_MAX__Ì65536Ö0
|
||||||
|
__INT_LEAST8_TYPE__Ì65536Ö0
|
||||||
|
__INT_MAX__Ì65536Ö0
|
||||||
|
__LDBL_DENORM_MIN__Ì65536Ö0
|
||||||
|
__LDBL_DIG__Ì65536Ö0
|
||||||
|
__LDBL_EPSILON__Ì65536Ö0
|
||||||
|
__LDBL_HAS_DENORM__Ì65536Ö0
|
||||||
|
__LDBL_HAS_INFINITY__Ì65536Ö0
|
||||||
|
__LDBL_HAS_QUIET_NAN__Ì65536Ö0
|
||||||
|
__LDBL_MANT_DIG__Ì65536Ö0
|
||||||
|
__LDBL_MAX_10_EXP__Ì65536Ö0
|
||||||
|
__LDBL_MAX_EXP__Ì65536Ö0
|
||||||
|
__LDBL_MAX__Ì65536Ö0
|
||||||
|
__LDBL_MIN_10_EXP__Ì65536Ö0
|
||||||
|
__LDBL_MIN_EXP__Ì65536Ö0
|
||||||
|
__LDBL_MIN__Ì65536Ö0
|
||||||
|
__LONG_LONG_MAX__Ì65536Ö0
|
||||||
|
__LONG_MAX__Ì65536Ö0
|
||||||
|
__LP64__Ì65536Ö0
|
||||||
|
__MMX__Ì65536Ö0
|
||||||
|
__OPTIMIZE_SIZE__Ì65536Ö0
|
||||||
|
__OPTIMIZE__Ì65536Ö0
|
||||||
|
__ORDER_BIG_ENDIAN__Ì65536Ö0
|
||||||
|
__ORDER_LITTLE_ENDIAN__Ì65536Ö0
|
||||||
|
__ORDER_PDP_ENDIAN__Ì65536Ö0
|
||||||
|
__PIC__Ì65536Ö0
|
||||||
|
__PIE__Ì65536Ö0
|
||||||
|
__PRAGMA_REDEFINE_EXTNAMEÌ65536Ö0
|
||||||
|
__PROTO_H__Ì65536Ö0
|
||||||
|
__PTRDIFF_MAX__Ì65536Ö0
|
||||||
|
__PTRDIFF_TYPE__Ì65536Ö0
|
||||||
|
__REGISTER_PREFIX__Ì65536Ö0
|
||||||
|
__SCHAR_MAX__Ì65536Ö0
|
||||||
|
__SEG_FSÌ65536Ö0
|
||||||
|
__SEG_GSÌ65536Ö0
|
||||||
|
__SFR_OFFSETÌ65536Ö0
|
||||||
|
__SHRT_MAX__Ì65536Ö0
|
||||||
|
__SIG_ATOMIC_MAX__Ì65536Ö0
|
||||||
|
__SIG_ATOMIC_MIN__Ì65536Ö0
|
||||||
|
__SIG_ATOMIC_TYPE__Ì65536Ö0
|
||||||
|
__SIZEOF_DOUBLE__Ì65536Ö0
|
||||||
|
__SIZEOF_FLOAT128__Ì65536Ö0
|
||||||
|
__SIZEOF_FLOAT80__Ì65536Ö0
|
||||||
|
__SIZEOF_FLOAT__Ì65536Ö0
|
||||||
|
__SIZEOF_INT128__Ì65536Ö0
|
||||||
|
__SIZEOF_INT__Ì65536Ö0
|
||||||
|
__SIZEOF_LONG_DOUBLE__Ì65536Ö0
|
||||||
|
__SIZEOF_LONG_LONG__Ì65536Ö0
|
||||||
|
__SIZEOF_LONG__Ì65536Ö0
|
||||||
|
__SIZEOF_POINTER__Ì65536Ö0
|
||||||
|
__SIZEOF_PTRDIFF_T__Ì65536Ö0
|
||||||
|
__SIZEOF_SHORT__Ì65536Ö0
|
||||||
|
__SIZEOF_SIZE_T__Ì65536Ö0
|
||||||
|
__SIZEOF_WCHAR_T__Ì65536Ö0
|
||||||
|
__SIZEOF_WINT_T__Ì65536Ö0
|
||||||
|
__SIZE_MAX__Ì65536Ö0
|
||||||
|
__SIZE_TYPE__Ì65536Ö0
|
||||||
|
__SSE2_MATH__Ì65536Ö0
|
||||||
|
__SSE2__Ì65536Ö0
|
||||||
|
__SSE_MATH__Ì65536Ö0
|
||||||
|
__SSE__Ì65536Ö0
|
||||||
|
__SSP_STRONG__Ì65536Ö0
|
||||||
|
__STDC_HOSTED__Ì65536Ö0
|
||||||
|
__STDC_IEC_559_COMPLEX__Ì65536Ö0
|
||||||
|
__STDC_IEC_559__Ì65536Ö0
|
||||||
|
__STDC_ISO_10646__Ì65536Ö0
|
||||||
|
__STDC_NO_THREADS__Ì65536Ö0
|
||||||
|
__STDC_UTF_16__Ì65536Ö0
|
||||||
|
__STDC_UTF_32__Ì65536Ö0
|
||||||
|
__STDC__Ì65536Ö0
|
||||||
|
__STDINT_H_Ì65536Ö0
|
||||||
|
__STEPPER_H__Ì65536Ö0
|
||||||
|
__STRINGIFYÌ131072Í(x)Ö0
|
||||||
|
__UART_H__Ì65536Ö0
|
||||||
|
__UINT16_CÌ131072Í(c)Ö0
|
||||||
|
__UINT16_MAX__Ì65536Ö0
|
||||||
|
__UINT16_TYPE__Ì65536Ö0
|
||||||
|
__UINT32_CÌ131072Í(c)Ö0
|
||||||
|
__UINT32_MAX__Ì65536Ö0
|
||||||
|
__UINT32_TYPE__Ì65536Ö0
|
||||||
|
__UINT64_CÌ131072Í(c)Ö0
|
||||||
|
__UINT64_MAX__Ì65536Ö0
|
||||||
|
__UINT64_TYPE__Ì65536Ö0
|
||||||
|
__UINT8_CÌ131072Í(c)Ö0
|
||||||
|
__UINT8_MAX__Ì65536Ö0
|
||||||
|
__UINT8_TYPE__Ì65536Ö0
|
||||||
|
__UINTMAX_CÌ131072Í(c)Ö0
|
||||||
|
__UINTMAX_MAX__Ì65536Ö0
|
||||||
|
__UINTMAX_TYPE__Ì65536Ö0
|
||||||
|
__UINTPTR_MAX__Ì65536Ö0
|
||||||
|
__UINTPTR_TYPE__Ì65536Ö0
|
||||||
|
__UINT_FAST16_MAX__Ì65536Ö0
|
||||||
|
__UINT_FAST16_TYPE__Ì65536Ö0
|
||||||
|
__UINT_FAST32_MAX__Ì65536Ö0
|
||||||
|
__UINT_FAST32_TYPE__Ì65536Ö0
|
||||||
|
__UINT_FAST64_MAX__Ì65536Ö0
|
||||||
|
__UINT_FAST64_TYPE__Ì65536Ö0
|
||||||
|
__UINT_FAST8_MAX__Ì65536Ö0
|
||||||
|
__UINT_FAST8_TYPE__Ì65536Ö0
|
||||||
|
__UINT_LEAST16_MAX__Ì65536Ö0
|
||||||
|
__UINT_LEAST16_TYPE__Ì65536Ö0
|
||||||
|
__UINT_LEAST32_MAX__Ì65536Ö0
|
||||||
|
__UINT_LEAST32_TYPE__Ì65536Ö0
|
||||||
|
__UINT_LEAST64_MAX__Ì65536Ö0
|
||||||
|
__UINT_LEAST64_TYPE__Ì65536Ö0
|
||||||
|
__UINT_LEAST8_MAX__Ì65536Ö0
|
||||||
|
__UINT_LEAST8_TYPE__Ì65536Ö0
|
||||||
|
__USER_LABEL_PREFIX__Ì65536Ö0
|
||||||
|
__USING_MINT8Ì65536Ö0
|
||||||
|
__VERSION__Ì65536Ö0
|
||||||
|
__WCHAR_MAX__Ì65536Ö0
|
||||||
|
__WCHAR_MIN__Ì65536Ö0
|
||||||
|
__WCHAR_TYPE__Ì65536Ö0
|
||||||
|
__WINT_MAX__Ì65536Ö0
|
||||||
|
__WINT_MIN__Ì65536Ö0
|
||||||
|
__WINT_TYPE__Ì65536Ö0
|
||||||
|
__amd64Ì65536Ö0
|
||||||
|
__amd64__Ì65536Ö0
|
||||||
|
__code_model_small__Ì65536Ö0
|
||||||
|
__cplusplusÌ65536Ö0
|
||||||
|
__cpp_aggregate_nsdmiÌ65536Ö0
|
||||||
|
__cpp_alias_templatesÌ65536Ö0
|
||||||
|
__cpp_attributesÌ65536Ö0
|
||||||
|
__cpp_binary_literalsÌ65536Ö0
|
||||||
|
__cpp_constexprÌ65536Ö0
|
||||||
|
__cpp_decltypeÌ65536Ö0
|
||||||
|
__cpp_decltype_autoÌ65536Ö0
|
||||||
|
__cpp_delegating_constructorsÌ65536Ö0
|
||||||
|
__cpp_digit_separatorsÌ65536Ö0
|
||||||
|
__cpp_exceptionsÌ65536Ö0
|
||||||
|
__cpp_generic_lambdasÌ65536Ö0
|
||||||
|
__cpp_hex_floatÌ65536Ö0
|
||||||
|
__cpp_inheriting_constructorsÌ65536Ö0
|
||||||
|
__cpp_init_capturesÌ65536Ö0
|
||||||
|
__cpp_initializer_listsÌ65536Ö0
|
||||||
|
__cpp_lambdasÌ65536Ö0
|
||||||
|
__cpp_nsdmiÌ65536Ö0
|
||||||
|
__cpp_range_based_forÌ65536Ö0
|
||||||
|
__cpp_raw_stringsÌ65536Ö0
|
||||||
|
__cpp_ref_qualifiersÌ65536Ö0
|
||||||
|
__cpp_return_type_deductionÌ65536Ö0
|
||||||
|
__cpp_rttiÌ65536Ö0
|
||||||
|
__cpp_runtime_arraysÌ65536Ö0
|
||||||
|
__cpp_rvalue_referenceÌ65536Ö0
|
||||||
|
__cpp_rvalue_referencesÌ65536Ö0
|
||||||
|
__cpp_sized_deallocationÌ65536Ö0
|
||||||
|
__cpp_static_assertÌ65536Ö0
|
||||||
|
__cpp_unicode_charactersÌ65536Ö0
|
||||||
|
__cpp_unicode_literalsÌ65536Ö0
|
||||||
|
__cpp_user_defined_literalsÌ65536Ö0
|
||||||
|
__cpp_variable_templatesÌ65536Ö0
|
||||||
|
__cpp_variadic_templatesÌ65536Ö0
|
||||||
|
__gnu_linux__Ì65536Ö0
|
||||||
|
__has_includeÌ131072Í(STR)Ö0
|
||||||
|
__has_include_nextÌ131072Í(STR)Ö0
|
||||||
|
__k8Ì65536Ö0
|
||||||
|
__k8__Ì65536Ö0
|
||||||
|
__linuxÌ65536Ö0
|
||||||
|
__linux__Ì65536Ö0
|
||||||
|
__pic__Ì65536Ö0
|
||||||
|
__pie__Ì65536Ö0
|
||||||
|
__unixÌ65536Ö0
|
||||||
|
__unix__Ì65536Ö0
|
||||||
|
__x86_64Ì65536Ö0
|
||||||
|
__x86_64__Ì65536Ö0
|
||||||
|
bit_is_clearÌ131072Í(sfr,bit)Ö0
|
||||||
|
bit_is_setÌ131072Í(sfr,bit)Ö0
|
||||||
|
check_endswÌ16Í(uint8_t Nmotor)Ö0Ïuint8_t
|
||||||
|
chk_stpr_cmdÌ16Í(char N)Ö0Ïuint8_t
|
||||||
|
chk_stpr_cmdÌ1024Í(char N)Ö0Ïuint8_t
|
||||||
|
cliÌ131072Í()Ö0
|
||||||
|
cur_motorÌ16384Ö0Ïuint8_t
|
||||||
|
daysÌ16384Ö0Ïuint16_t
|
||||||
|
directionÌ16384Ö0Ïuint8_t
|
||||||
|
hoursÌ16384Ö0Ïuint8_t
|
||||||
|
int16_tÌ4096Ö0Ïsigned int
|
||||||
|
int32_tÌ4096Ö0Ïsigned int
|
||||||
|
int64_tÌ4096Ö0Ïsigned int
|
||||||
|
int8_tÌ4096Ö0Ïsigned int
|
||||||
|
int_farptr_tÌ4096Ö0Ïint32_t
|
||||||
|
int_fast16_tÌ4096Ö0Ïint16_t
|
||||||
|
int_fast32_tÌ4096Ö0Ïint32_t
|
||||||
|
int_fast64_tÌ4096Ö0Ïint64_t
|
||||||
|
int_fast8_tÌ4096Ö0Ïint8_t
|
||||||
|
int_least16_tÌ4096Ö0Ïint16_t
|
||||||
|
int_least32_tÌ4096Ö0Ïint32_t
|
||||||
|
int_least64_tÌ4096Ö0Ïint64_t
|
||||||
|
int_least8_tÌ4096Ö0Ïint8_t
|
||||||
|
intmax_tÌ4096Ö0Ïint64_t
|
||||||
|
intptr_tÌ4096Ö0Ïint16_t
|
||||||
|
linuxÌ65536Ö0
|
||||||
|
loop_until_bit_is_clearÌ131072Í(sfr,bit)Ö0
|
||||||
|
loop_until_bit_is_setÌ131072Í(sfr,bit)Ö0
|
||||||
|
mainÌ16Í()Ö0Ïint
|
||||||
|
move_motorÌ16Í(uint8_t N, char *cmd)Ö0Ïuint8_t
|
||||||
|
move_motorÌ1024Í(uint8_t num, char *cmd)Ö0Ïuint8_t
|
||||||
|
omit_whitespaceÌ16Í(char *str)Ö0Ïchar *
|
||||||
|
omit_whitespaceÌ1024Í(char *str)Ö0Ïchar *
|
||||||
|
printUintÌ16Í(uint8_t *val, uint8_t len)Ö0Ïvoid
|
||||||
|
printUintÌ1024Í(uint8_t *val, uint8_t len)Ö0Ïvoid
|
||||||
|
print_longÌ16Í(int32_t Number)Ö0Ïvoid
|
||||||
|
print_longÌ1024Í(int32_t Number)Ö0Ïvoid
|
||||||
|
print_timeÌ16Í()Ö0Ïvoid
|
||||||
|
print_timeÌ1024Í()Ö0Ïvoid
|
||||||
|
process_commandsÌ16Í(char *cmd)Ö0Ïuint8_t
|
||||||
|
process_stringÌ16Í()Ö0Ïvoid
|
||||||
|
process_stringÌ1024Í()Ö0Ïvoid
|
||||||
|
readIntÌ16Í(char *buff, int16_t *val)Ö0Ïuint8_t
|
||||||
|
readIntÌ1024Í(char *buff, int16_t *val)Ö0Ïuint8_t
|
||||||
|
retiÌ131072Í()Ö0
|
||||||
|
rx_bufferÌ16384Ö0Ïchar
|
||||||
|
rx_bufferÌ32768Ö0Ïchar
|
||||||
|
rx_bufsizeÌ16384Ö0Ïvolatile uint8_t
|
||||||
|
rx_bufsizeÌ32768Ö0Ïvolatile uint8_t
|
||||||
|
rx_copyÌ16384Ö0Ïchar
|
||||||
|
rx_copyÌ32768Ö0Ïchar
|
||||||
|
seiÌ131072Í()Ö0
|
||||||
|
stepper_ch_speedÌ16Í(char *spd)Ö0Ïuint8_t
|
||||||
|
stepper_ch_speedÌ1024Í(char *spd)Ö0Ïuint8_t
|
||||||
|
stepper_get_eswÌ16Í(uint8_t Nmotor)Ö0Ïvoid
|
||||||
|
stepper_moveÌ16Í(uint8_t Nmotor, int16_t Nsteps)Ö0Ïuint8_t
|
||||||
|
stepper_moveÌ1024Í(uint8_t Nmotor, int16_t Nsteps)Ö0Ïuint8_t
|
||||||
|
stepper_processÌ16Í()Ö0Ïvoid
|
||||||
|
stepper_processÌ1024Í()Ö0Ïvoid
|
||||||
|
stepper_pulseÌ16384Ö0Ïvolatile uint8_t
|
||||||
|
stepper_pulseÌ32768Ö0Ïvolatile uint8_t
|
||||||
|
stepper_setupÌ16Í()Ö0Ïvoid
|
||||||
|
stepper_setupÌ1024Í()Ö0Ïvoid
|
||||||
|
stop_motorsÌ16Í()Ö0Ïvoid
|
||||||
|
stop_motorsÌ1024Í()Ö0Ïvoid
|
||||||
|
tick_ctrÌ16384Ö0Ïvolatile uint8_t
|
||||||
|
tx_bufferÌ16384Ö0Ïchar
|
||||||
|
tx_bufsizeÌ16384Ö0Ïvolatile uint8_t
|
||||||
|
tx_idxÌ16384Ö0Ïuint8_t
|
||||||
|
uint16_tÌ4096Ö0Ïunsigned int
|
||||||
|
uint32_tÌ4096Ö0Ïunsigned int
|
||||||
|
uint64_tÌ4096Ö0Ïunsigned int
|
||||||
|
uint8_tÌ4096Ö0Ïunsigned int
|
||||||
|
uint_farptr_tÌ4096Ö0Ïuint32_t
|
||||||
|
uint_fast16_tÌ4096Ö0Ïuint16_t
|
||||||
|
uint_fast32_tÌ4096Ö0Ïuint32_t
|
||||||
|
uint_fast64_tÌ4096Ö0Ïuint64_t
|
||||||
|
uint_fast8_tÌ4096Ö0Ïuint8_t
|
||||||
|
uint_least16_tÌ4096Ö0Ïuint16_t
|
||||||
|
uint_least32_tÌ4096Ö0Ïuint32_t
|
||||||
|
uint_least64_tÌ4096Ö0Ïuint64_t
|
||||||
|
uint_least8_tÌ4096Ö0Ïuint8_t
|
||||||
|
uintmax_tÌ4096Ö0Ïuint64_t
|
||||||
|
uintptr_tÌ4096Ö0Ïuint16_t
|
||||||
|
unixÌ65536Ö0
|
||||||
|
usart_flagsÌ16384Ö0Ïvolatile uint8_t
|
||||||
|
usart_flagsÌ32768Ö0Ïvolatile uint8_t
|
||||||
|
usart_sendÌ16Í(char *Str)Ö0Ïint
|
||||||
|
usart_sendÌ1024Í(char *Str)Ö0Ïint
|
||||||
|
ustepsÌ16384Ö0Ïuint8_t const *
|
||||||
|
usteps_matrixÌ16384Ö0Ïconst uint8_t
|
||||||
|
wdt_disableÌ16Í(void)Ö0Ï__inline__void
|
||||||
|
wdt_enableÌ16Í(const uint8_t value)Ö0Ï__inline__void
|
||||||
|
wdt_resetÌ131072Í()Ö0
|
||||||
175
avr/scorpio1_module/scorpio_p1.hex
Normal file
175
avr/scorpio1_module/scorpio_p1.hex
Normal file
@ -0,0 +1,175 @@
|
|||||||
|
:1000000014C02EC02DC02CC02BC02AC04BC128C08C
|
||||||
|
:1000100027C048C325C0ACC2F7C222C021C020C03F
|
||||||
|
:100020001FC01EC01DC01CC01BC011241FBECFE5B9
|
||||||
|
:10003000D2E0DEBFCDBF10E0A0E6B0E0E4E5FAE03C
|
||||||
|
:1000400002C005900D92AE3DB107D9F721E0AEEDAB
|
||||||
|
:10005000B0E001C01D92A135B207E1F768D4F8C441
|
||||||
|
:10006000CFCF99B390FD04C082E091FF81E0089565
|
||||||
|
:1000700080E0FBCF8EB588608EBD88EE93E09BBD9F
|
||||||
|
:100080008ABD8EB582608EBD89B7806189BF0895B3
|
||||||
|
:10009000CF93DF9300D0CDB7DEB7BE016F5F7F4F48
|
||||||
|
:1000A00025D2882391F069817A81683F8FEF7807A4
|
||||||
|
:1000B0008CF06F3F8FE7780769F0665F7F4F8FEFB7
|
||||||
|
:1000C0009FEF5ED47BBD6ABD80E00F900F90DF9103
|
||||||
|
:1000D000CF91089581E0F9CFCF93DF93CDB7DEB70D
|
||||||
|
:1000E0002C970FB6F894DEBF0FBECDBF9FEF980FD1
|
||||||
|
:1000F0009430A0F49CE0E6EAF0E0DE011196019075
|
||||||
|
:100100000D929A95E1F7805D8C83ABDF811101C080
|
||||||
|
:1001100083E0805D8987CE010196D3D02C960FB6FF
|
||||||
|
:10012000F894DEBF0FBECDBFDF91CF9108958091CF
|
||||||
|
:10013000DF00D2DF15BA89B78F7E89BF1092DE004B
|
||||||
|
:1001400010920E0110920D011092E1001092DF004A
|
||||||
|
:1001500008951F93CF93DF93182FEB018FEF810F3B
|
||||||
|
:100160008430F8F480910D0190910E01892BC9F42F
|
||||||
|
:1001700089B78F7E89BF15BA85B321E030E093E05F
|
||||||
|
:10018000910F01C0220F9A95EAF7822B85BB10933D
|
||||||
|
:10019000DF0067DF209739F4812F9EDF15BA1092B8
|
||||||
|
:1001A000DF0081E01BC08823E9F0813029F41C16B0
|
||||||
|
:1001B0001D06D4F0BCDFF5CFD7FFFCCFD195C1959C
|
||||||
|
:1001C000D10981E08093E000D0930E01C0930D012E
|
||||||
|
:1001D0001DBC1CBC89B7806189BF80E0DF91CF91D5
|
||||||
|
:1001E0001F910895D7FDEACF1092E000EDCF109255
|
||||||
|
:1001F000DE0085B39091E100E0916000F091610034
|
||||||
|
:10020000E90FF11D97FDFA95807F9081892B85BBC1
|
||||||
|
:1002100028DF2091E0009091E1002223B1F091507D
|
||||||
|
:1002200097FD05C09093E1008130B1F480CF97E055
|
||||||
|
:100230009093E10020910D0130910E012150310980
|
||||||
|
:1002400030930E0120930D01EFCF9F5F98305CF447
|
||||||
|
:100250009093E100823051F380910D0190910E0155
|
||||||
|
:10026000892B21F308951092E10020910D01309126
|
||||||
|
:100270000E012150310930930E0120930D01EACF78
|
||||||
|
:1002800090ED980F983060F428E08202C0011124AC
|
||||||
|
:100290008A519140909361008093600080E00895BE
|
||||||
|
:1002A00081E008951F920F920FB60F9211248F9341
|
||||||
|
:1002B00081E08093DE008F910F900FBE0F901F9012
|
||||||
|
:1002C00018952091620020FFFCCF209162002A7FC8
|
||||||
|
:1002D000209362001092E2001092E300DC01809112
|
||||||
|
:1002E000E300803270F08091E3008032C9F4109214
|
||||||
|
:1002F000E3008091620081608093620081E090E081
|
||||||
|
:1003000008958D91882379F3E091E300F0E0EB51BB
|
||||||
|
:10031000FF4F80838091E3008F5F8093E300DFCF06
|
||||||
|
:10032000559A80E090E008958F929F92AF92BF928D
|
||||||
|
:10033000DF92EF92FF920F931F93CF93DF93CDB78E
|
||||||
|
:10034000DEB72C970FB6F894DEBF0FBECDBF1C866C
|
||||||
|
:1003500097FF3FC090958095709561957F4F8F4F27
|
||||||
|
:100360009F4FDD24D3947E012CE0E20EF11C0BE0C4
|
||||||
|
:100370002AE0822E912CA12CB12C1FEF100FA50189
|
||||||
|
:10038000940134D3605DF70162937F01B901CA0122
|
||||||
|
:100390006115710581059105F1F0012F1111EDCF66
|
||||||
|
:1003A00081E090E08C0F9D1F810F911D8ADF2C96BC
|
||||||
|
:1003B0000FB6F894DEBF0FBECDBFDF91CF911F9176
|
||||||
|
:1003C0000F91FF90EF90DF90BF90AF909F908F9034
|
||||||
|
:1003D0000895D12CC8CF112319F3DD2009F31EEFA6
|
||||||
|
:1003E000100FFE01E10FF11D8DE28183D9CF8F92B5
|
||||||
|
:1003F0009F92AF92BF92CF92DF92FF920F931F9383
|
||||||
|
:10040000CF93DF93CDB7DEB72B970FB6F894DEBF4F
|
||||||
|
:100410000FBECDBFDC016330F1F18FEF860F84306A
|
||||||
|
:10042000D0F5FE013196CE010C968F011192E8179E
|
||||||
|
:10043000F907E1F7623009F440C0643009F440C0C4
|
||||||
|
:10044000613009F042C06C9170E080E090E06E0194
|
||||||
|
:100450002BE0C20ED11C29E0F22E3AE0832E912C23
|
||||||
|
:10046000A12CB12CFA94A50194019ED2605DF601F5
|
||||||
|
:1004700062936F01B901CA0161157105810591058A
|
||||||
|
:1004800019F0FFEFFF12EECF8F2DFF0C990B0196A5
|
||||||
|
:10049000800F911F16DF2B960FB6F894DEBF0FBEAC
|
||||||
|
:1004A000CDBFDF91CF911F910F91FF90DF90CF9043
|
||||||
|
:1004B000BF90AF909F908F9008956D917C91C5CF24
|
||||||
|
:1004C0006D917D918D919C91C2CF60E070E0CB01E8
|
||||||
|
:1004D000BECFFC012081203239F037EF320F3230AD
|
||||||
|
:1004E00018F02D3009F008950196F3CF0F931F9364
|
||||||
|
:1004F000CF93DF93EB01FC0120812D3231F5019682
|
||||||
|
:1005000011E0FC0120E030E0A90181E0019190EDD3
|
||||||
|
:10051000900F9A30E0F4AAE0B0E084D29B01AC01E5
|
||||||
|
:10052000200F311D411D511D205331094109510931
|
||||||
|
:1005300080E0211590E83907410551053CF380E042
|
||||||
|
:10054000DF91CF911F910F91089510E0DACF8111C3
|
||||||
|
:10055000F6CF112339F050954095309521953F4FB6
|
||||||
|
:100560004F4F5F4F209711F03983288381E0E8CF08
|
||||||
|
:100570001F920F920FB60F9211248F939F93EF93B8
|
||||||
|
:10058000FF938CB19BB19C71D9F597EF980F923086
|
||||||
|
:1005900020F18D3011F1E091E40091E09E0F9093F5
|
||||||
|
:1005A000E400F0E0E15FFE4F80838D35F9F4809147
|
||||||
|
:1005B0006200826080936200E091E40081E08E0F2F
|
||||||
|
:1005C0008093E400F0E0E15FFE4F8AE08083E091F9
|
||||||
|
:1005D000E400F0E0E15FFE4F1082FF91EF919F9108
|
||||||
|
:1005E0008F910F900FBE0F901F9018958091E4008F
|
||||||
|
:1005F000803299F780916200826180936200EDCF32
|
||||||
|
:10060000809162008A60F9CF1F920F920FB60F920D
|
||||||
|
:1006100011248F939F93EF93FF938091E3008111B7
|
||||||
|
:100620000FC0559880916200816080936200FF91B5
|
||||||
|
:10063000EF919F918F910F900FBE0F901F90189583
|
||||||
|
:10064000E091E20081E08E0F8093E200F0E0EB5158
|
||||||
|
:10065000FF4F80818CB99091E2008091E300981364
|
||||||
|
:10066000E6CF1092E2001092E300DBCF62E087E079
|
||||||
|
:1006700091E0BDDE82EB90E024DE61E085E091E078
|
||||||
|
:10068000B6DE84EB90E01DDE62E089E091E0AFDE53
|
||||||
|
:1006900086EB90E016DE62E08BE091E0A8DE88EB6E
|
||||||
|
:1006A00090E00FCE1F920F920FB60F9211242F934E
|
||||||
|
:1006B0008F939F9382B78A5F82BF809106018F5F7D
|
||||||
|
:1006C000809306018430A1F51092060180910B0100
|
||||||
|
:1006D00090910C01019690930C0180930B01883E40
|
||||||
|
:1006E000934031F510920C0110920B018091090199
|
||||||
|
:1006F00090910A01019690930A018093090180313B
|
||||||
|
:100700009E40B1F410920A011092090180910501F6
|
||||||
|
:100710008F5F80930501883159F410920501809113
|
||||||
|
:1007200007019091080101969093080180930701B9
|
||||||
|
:100730009F918F912F910F900FBE0F901F90189542
|
||||||
|
:100740001F93CF93DF9300D0CDB7DEB7182FCB0127
|
||||||
|
:10075000BE016F5F7F4FCADE882359F069817A81BD
|
||||||
|
:1007600080ED810FF6DC0F900F90DF91CF911F91FC
|
||||||
|
:10077000089581E0F8CF1F93CF93DF9300D0CDB7DA
|
||||||
|
:10078000DEB70196A6DEFC011191CF01A2DE173380
|
||||||
|
:1007900009F44BC0ACF41233E9F134F4103361F1D5
|
||||||
|
:1007A000113379F181E030C01433D1F1B4F1163353
|
||||||
|
:1007B000C9F7FC0180818133B1F5C09A80E024C083
|
||||||
|
:1007C000123609F442C034F41833B9F1193351F731
|
||||||
|
:1007D0005FDC1AC0143709F451C0173709F450C050
|
||||||
|
:1007E0001C3601F784ED90E06CDD62E08DE091E075
|
||||||
|
:1007F000FEDD8FEA90E003C09ADC8CEB90E061DDD7
|
||||||
|
:10080000D1CFBC0181E39CDF0F900F90DF91CF919E
|
||||||
|
:100810001F910895BC0182E3F6CFBC0183E3F3CFBF
|
||||||
|
:10082000BC0184E3F0CFC098C9CFFC018081813343
|
||||||
|
:1008300011F4C19AC3CFC198C1CFFC01808181332B
|
||||||
|
:1008400011F4C29ABBCFC298B9CFBE016F5F7F4F80
|
||||||
|
:100850004DDE882309F4A6CF89819A81089708F094
|
||||||
|
:10086000A1CF87EC90E02DDD62E0CE010196BFDDE7
|
||||||
|
:1008700085EC90E026DD898188BBA0CFF7DE9ECF96
|
||||||
|
:10088000FC018081FDDCC0CFCF93DF9380916200BB
|
||||||
|
:1008900081FF21C08091620090916200957E9093CB
|
||||||
|
:1008A000620083FD1BC08295817091E08927909141
|
||||||
|
:1008B000E400933060F090910F019B3541F4E0919A
|
||||||
|
:1008C000E400F0E0E35FFE4F90819D3549F0109227
|
||||||
|
:1008D000E40010920F01DF91CF91089580E0E7CFFF
|
||||||
|
:1008E0008823C9F3E091E400F0E0E15FFE4F10825D
|
||||||
|
:1008F00080E191E0EEDDE091E4001092E400DC01A3
|
||||||
|
:100900002C91213331F7CFE0D1E0A0E3B1E0299180
|
||||||
|
:100910002D932111FCCFF0E0E35FFE4F10822BDF1F
|
||||||
|
:100920008111D9CF80E391E0DF91CF91CACC8FEFD5
|
||||||
|
:1009300084BB87E087BB15BAC19A1BB886E080BD2F
|
||||||
|
:1009400088E98AB910BC83E389B983B7826083BF21
|
||||||
|
:1009500089B7816089BF8EDB78949FE088E10FB60C
|
||||||
|
:10096000F894A89581BD0FBE91BDA8958091DE0039
|
||||||
|
:1009700081113DDC8091620081FFF7CF85DFF5CFEB
|
||||||
|
:10098000AA1BBB1B51E107C0AA1FBB1FA617B707B5
|
||||||
|
:1009900010F0A61BB70B881F991F5A95A9F78095D1
|
||||||
|
:1009A0009095BC01CD010895A1E21A2EAA1BBB1B94
|
||||||
|
:1009B000FD010DC0AA1FBB1FEE1FFF1FA217B3072B
|
||||||
|
:1009C000E407F50720F0A21BB30BE40BF50B661F41
|
||||||
|
:1009D000771F881F991F1A9469F760957095809505
|
||||||
|
:1009E00090959B01AC01BD01CF010895052E97FBA9
|
||||||
|
:1009F00016F400940FD057FD05D0D6DF07FC02D0C7
|
||||||
|
:100A000046F408C050954095309521953F4F4F4F83
|
||||||
|
:100A10005F4F089590958095709561957F4F8F4FAA
|
||||||
|
:100A20009F4F089509D0A59F900DB49F900DA49F4E
|
||||||
|
:100A3000800D911D11240895A29FB001B39FC001A4
|
||||||
|
:100A4000A39F01D0B29F700D811D1124911D0895A7
|
||||||
|
:040A5000F894FFCF48
|
||||||
|
:100A54006E0001141414080C0406020301090206B2
|
||||||
|
:100A6400040C08090103080901030206040C080A1E
|
||||||
|
:100A740002060405010907030B090D0C0E060D09F6
|
||||||
|
:100A84000B0307060E0C07060E0C0D090B030705D6
|
||||||
|
:100A94000D090B0A0E065B3120302053743D305D86
|
||||||
|
:100AA4000A006400680073006D730A0053636F7278
|
||||||
|
:100AB40070696F5F300A0073657420706F727462BE
|
||||||
|
:0E0AC40020746F005B31206C6566743D00008D
|
||||||
|
:00000001FF
|
||||||
242
avr/scorpio1_module/stepper.c
Normal file
242
avr/scorpio1_module/stepper.c
Normal file
@ -0,0 +1,242 @@
|
|||||||
|
/*
|
||||||
|
* geany_encoding=koi8-r
|
||||||
|
* stepper.c
|
||||||
|
*
|
||||||
|
* Copyright 2017 Edward V. Emelianov <eddy@sao.ru, edward.emelianoff@gmail.com>
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation; either version 2 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
||||||
|
* MA 02110-1301, USA.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "includes.h"
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Half-step mode:
|
||||||
|
* D |----|----| | | | | |----|
|
||||||
|
* D | | |----|----|----|----|----| |
|
||||||
|
* C | |----|----|----| | | | |
|
||||||
|
* C |----| | | |----|----|----|----|
|
||||||
|
* B | | | |----|----|----| | |
|
||||||
|
* B |----|----|----| | | |----|----|
|
||||||
|
* A | | | | | |----|----|----|
|
||||||
|
* A |----|----|----|----|----| | | |
|
||||||
|
*
|
||||||
|
* In full-step mode pulse rises sequentally: D->C->B->A
|
||||||
|
* 0 0000
|
||||||
|
* 1 0001
|
||||||
|
* 2 0010
|
||||||
|
* 3 0011
|
||||||
|
* 4 0100
|
||||||
|
* 5 0101
|
||||||
|
* 6 0110
|
||||||
|
* 7 0111
|
||||||
|
* 8 1000
|
||||||
|
* 9 1001
|
||||||
|
*10 1010
|
||||||
|
*11 1011
|
||||||
|
*12 1100
|
||||||
|
*13 1101
|
||||||
|
*14 1110
|
||||||
|
*15 1111
|
||||||
|
*/
|
||||||
|
// winding1: [13], winding2: [24]
|
||||||
|
// microsteps: [1234] = 1000, 1100, 0100, 0110, 0010, 0011, 0001, 1001 -- for ULN
|
||||||
|
// [1324] = 1000, 1010, 0010, 0110, 0100, 0101, 0001, 1001 - bipolar
|
||||||
|
// 1000, 1010, 0010, 0110, 0100, 0101, 0001, 1001 - half-step
|
||||||
|
// 1010, 0110, 0101, 1001 - full step
|
||||||
|
//static const uint8_t usteps[8] = {8, 12, 4, 6, 2, 3, 1, 9}; // ULN - unipolar, active 1
|
||||||
|
//static const uint8_t usteps[8] = {7, 3, 11, 9, 13, 12, 14, 6}; // unipolar, active is 0
|
||||||
|
static const uint8_t usteps_matrix[8][8] = {
|
||||||
|
{0b1000, 0b1100, 0b0100, 0b0110, 0b0010, 0b0011, 0b0001, 0b1001}, // [1234]
|
||||||
|
{0b0010, 0b0110, 0b0100, 0b1100, 0b1000, 0b1001, 0b0001, 0b0011}, // [3214]
|
||||||
|
{0b1000, 0b1001, 0b0001, 0b0011, 0b0010, 0b0110, 0b0100, 0b1100}, // [1432]
|
||||||
|
{0b1000, 0b1010, 0b0010, 0b0110, 0b0100, 0b0101, 0b0001, 0b1001}, // [1324]
|
||||||
|
// inversion: cat | sed -e 's/0b/x/g' -e 's/0/y/g' -e 's/1/0/g' -e 's/y/1/g' -e s'/x/0b/g'
|
||||||
|
{0b0111, 0b0011, 0b1011, 0b1001, 0b1101, 0b1100, 0b1110, 0b0110}, // [1234]
|
||||||
|
{0b1101, 0b1001, 0b1011, 0b0011, 0b0111, 0b0110, 0b1110, 0b1100}, // [3214]
|
||||||
|
{0b0111, 0b0110, 0b1110, 0b1100, 0b1101, 0b1001, 0b1011, 0b0011}, // [1432]
|
||||||
|
{0b0111, 0b0101, 0b1101, 0b1001, 0b1011, 0b1010, 0b1110, 0b0110}, // [1324]
|
||||||
|
};
|
||||||
|
|
||||||
|
uint8_t const *usteps = usteps_matrix[1];
|
||||||
|
|
||||||
|
static int8_t Ustep = 0; // current microstep count
|
||||||
|
uint16_t Steps_left; // steps left to proceed (absolute value)
|
||||||
|
static uint8_t direction = 0; // ==1 if rotate CCW
|
||||||
|
static uint8_t cur_motor = 0; // current motor number
|
||||||
|
|
||||||
|
volatile uint8_t stepper_pulse = 0; // interrupt flag, used in main.c
|
||||||
|
|
||||||
|
void stepper_setup(){
|
||||||
|
TCCR1B |= _BV(WGM12); // configure timer1 for CTC mode, TOP is OCR1A
|
||||||
|
OCR1A = 1000; // set the CTC compare value - 1kHz (125steps per second)
|
||||||
|
TCCR1B |= _BV(CS11); // start the timer at 8MHz/8 = 1MHz
|
||||||
|
TIMSK |= _BV(OCIE1A); // enable the CTC interrupt
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Change TIM1 speed
|
||||||
|
* Period = 8 * 65535/(spd + 10) microseconds
|
||||||
|
*/
|
||||||
|
uint8_t stepper_ch_speed(char *spd){
|
||||||
|
int16_t newval;
|
||||||
|
if(readInt(spd, &newval)){
|
||||||
|
if(newval > -9 && newval < 0x7fff){
|
||||||
|
uint16_t O = 0xffff / (newval + 10);
|
||||||
|
//TIMSK &= ~_BV(OCIE1A); // disable timer interrupt
|
||||||
|
OCR1A = O;
|
||||||
|
//TCNT1 = 0; // reset counter
|
||||||
|
//TIMSK |= _BV(OCIE1A);
|
||||||
|
}else{
|
||||||
|
DBG("Bad speed value\n");
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Check endswitches
|
||||||
|
* @return 0 if none pressed, 1 if "-", 2 if "+"
|
||||||
|
*/
|
||||||
|
static uint8_t check_endsw(uint8_t Nmotor){
|
||||||
|
// PA1 - "-" - 1, PA0 - "+" - 2
|
||||||
|
uint8_t pc = PINA, sw = 0;
|
||||||
|
// if(0 == (pc & _BV(0))) sw = 1;
|
||||||
|
// if(0 == (pc & _BV(1))) sw = 2;
|
||||||
|
if(0 == (pc & _BV(0))) sw = 2;
|
||||||
|
if(0 == (pc & _BV(1))) sw = 1;
|
||||||
|
return sw;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
Steppers:
|
||||||
|
7 - turret1
|
||||||
|
6 - turret2
|
||||||
|
5 - analisator
|
||||||
|
4 - collimator
|
||||||
|
*/
|
||||||
|
/**
|
||||||
|
* get end-switches state for all motors or only Nth
|
||||||
|
* @param Nmotor - number of given motor
|
||||||
|
*/
|
||||||
|
void stepper_get_esw(uint8_t Nmotor){
|
||||||
|
if(Nmotor < 1 || Nmotor > 4) return; // no running motor
|
||||||
|
// [1 x St=y]
|
||||||
|
char str[] = "[1 0 St=0]\n"; // 3 - motor number, 8 - endswitch (3 if none)
|
||||||
|
str[3] = Nmotor + '0';
|
||||||
|
uint8_t sw = check_endsw(Nmotor);
|
||||||
|
if(sw == 0) sw = 3;
|
||||||
|
str[8] = sw + '0';
|
||||||
|
usart_send(str);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* move stepper number Nmotor by Nsteps steps
|
||||||
|
* @return 0 if all OK, 1 if error occured
|
||||||
|
*/
|
||||||
|
uint8_t stepper_move(uint8_t Nmotor, int16_t Nsteps){
|
||||||
|
if(Nmotor < 1 || Nmotor > 4 || Steps_left) return 1;
|
||||||
|
TIMSK &= ~_BV(OCIE1A); // disable timer interrupt
|
||||||
|
// turn all OFF
|
||||||
|
STPRS_OFF();
|
||||||
|
// turn on the motor we need
|
||||||
|
PORTC |= (1 << (Nmotor+3));
|
||||||
|
cur_motor = Nmotor;
|
||||||
|
uint8_t c = check_endsw(Nmotor);
|
||||||
|
if(!Nsteps){ // check endswitches
|
||||||
|
stepper_get_esw(Nmotor);
|
||||||
|
STPRS_OFF();
|
||||||
|
cur_motor = 0;
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
if(c){
|
||||||
|
if(c == 1){if(Nsteps > 0) c = 0;}
|
||||||
|
else if(Nsteps < 0) c = 0;
|
||||||
|
}
|
||||||
|
if(c){
|
||||||
|
stop_motors();
|
||||||
|
return 1; // already at end-switch in given direction
|
||||||
|
}
|
||||||
|
if(Nsteps < 0){ // CCW
|
||||||
|
Nsteps = -Nsteps;
|
||||||
|
direction = 1;
|
||||||
|
}else direction = 0; // CW
|
||||||
|
Steps_left = Nsteps;
|
||||||
|
TCNT1 = 0; // reset counter
|
||||||
|
TIMSK |= _BV(OCIE1A);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
void stop_motors(){
|
||||||
|
stepper_get_esw(cur_motor);
|
||||||
|
// turn off all pulses to place motor in free state & prevent undesirable behaviour
|
||||||
|
STPRS_OFF();
|
||||||
|
TIMSK &= ~_BV(OCIE1A); // disable timer interrupt
|
||||||
|
stepper_pulse = 0;
|
||||||
|
Steps_left = 0;
|
||||||
|
Ustep = 0;
|
||||||
|
cur_motor = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* process stepper pulses generation @ timer event
|
||||||
|
*/
|
||||||
|
void stepper_process(){
|
||||||
|
stepper_pulse = 0;
|
||||||
|
uint8_t port = PORTC & 0xf0; // save old port state & clear clocking
|
||||||
|
PORTC = port | usteps[Ustep];
|
||||||
|
uint8_t sw = check_endsw(cur_motor); // 1 - "-", 2 - "+", 0 - none
|
||||||
|
if(direction){ // CCW
|
||||||
|
if(--Ustep < 0){
|
||||||
|
Ustep = 7;
|
||||||
|
--Steps_left;
|
||||||
|
}
|
||||||
|
if(sw == 1){
|
||||||
|
stop_motors();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}else{ // CW
|
||||||
|
if(++Ustep > 7){
|
||||||
|
Ustep = 0;
|
||||||
|
--Steps_left;
|
||||||
|
}
|
||||||
|
if(sw == 2){
|
||||||
|
stop_motors();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(Steps_left == 0) stop_motors();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* User can change current stepper phases table
|
||||||
|
* N - position in table from 'a' (0) to 'h' (7)
|
||||||
|
* return 0 if all OK
|
||||||
|
*/
|
||||||
|
uint8_t chk_stpr_cmd(char N){
|
||||||
|
if(N < '0' || N > '7') return 1;
|
||||||
|
usteps = usteps_matrix[N-'0'];
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Timer 1 used to generate stepper pulses
|
||||||
|
*/
|
||||||
|
ISR(TIMER1_COMPA_vect){
|
||||||
|
stepper_pulse = 1; // say that we can generate next microstep
|
||||||
|
}
|
||||||
|
|
||||||
43
avr/scorpio1_module/stepper.h
Normal file
43
avr/scorpio1_module/stepper.h
Normal file
@ -0,0 +1,43 @@
|
|||||||
|
/*
|
||||||
|
* geany_encoding=koi8-r
|
||||||
|
* stepper.h
|
||||||
|
*
|
||||||
|
* Copyright 2017 Edward V. Emelianov <eddy@sao.ru, edward.emelianoff@gmail.com>
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation; either version 2 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
||||||
|
* MA 02110-1301, USA.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
#ifndef __STEPPER_H__
|
||||||
|
#define __STEPPER_H__
|
||||||
|
|
||||||
|
#include <stdint.h>
|
||||||
|
|
||||||
|
extern volatile uint8_t stepper_pulse;
|
||||||
|
extern uint16_t Steps_left;
|
||||||
|
|
||||||
|
// setup timer
|
||||||
|
void stepper_setup();
|
||||||
|
void stepper_process();
|
||||||
|
|
||||||
|
uint8_t stepper_ch_speed(char *spd);
|
||||||
|
uint8_t stepper_move(uint8_t Nmotor, int16_t Nsteps);
|
||||||
|
void stop_motors();
|
||||||
|
|
||||||
|
uint8_t chk_stpr_cmd(char N);
|
||||||
|
|
||||||
|
#endif // __STEPPER_H__
|
||||||
172
avr/scorpio1_module/uart.c
Normal file
172
avr/scorpio1_module/uart.c
Normal file
@ -0,0 +1,172 @@
|
|||||||
|
/*
|
||||||
|
* geany_encoding=koi8-r
|
||||||
|
* uart.c
|
||||||
|
*
|
||||||
|
* Copyright 2017 Edward V. Emelianov <eddy@sao.ru, edward.emelianoff@gmail.com>
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation; either version 2 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
||||||
|
* MA 02110-1301, USA.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "includes.h"
|
||||||
|
|
||||||
|
char rx_buffer[RX_BUFFER_SIZE + 1];
|
||||||
|
char rx_copy[RX_BUFFER_SIZE + 1];
|
||||||
|
volatile uint8_t rx_bufsize = 0;
|
||||||
|
static char tx_buffer[TX_BUFFER_SIZE];
|
||||||
|
volatile uint8_t tx_bufsize = 0, tx_idx = 0;
|
||||||
|
|
||||||
|
volatile uint8_t usart_flags = U_TX_COMPLETE;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Send zero-terminated string using USART
|
||||||
|
* if length of string (excluding 0) > TX_BUFFER_SIZE return 1
|
||||||
|
* if all OK return 0
|
||||||
|
*/
|
||||||
|
int usart_send(char *Str){
|
||||||
|
while((usart_flags & U_TX_COMPLETE) == 0);
|
||||||
|
usart_flags &= ~(U_TX_COMPLETE | U_TX_ERROR);
|
||||||
|
tx_idx = 0;
|
||||||
|
for(tx_bufsize = 0; tx_bufsize < TX_BUFFER_SIZE; ++tx_bufsize){
|
||||||
|
if(*Str == 0) break;
|
||||||
|
tx_buffer[tx_bufsize] = *Str++;
|
||||||
|
}
|
||||||
|
if(tx_bufsize == TX_BUFFER_SIZE){ // error: buffer overflow
|
||||||
|
tx_bufsize = 0;
|
||||||
|
usart_flags |= U_TX_COMPLETE;
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
UCSRB |= _BV(UDRIE); // allow TX data buffer empty interrupt
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* print signed long onto terminal
|
||||||
|
* max len = 10 symbols + 1 for "-" + 1 for '\n' + 1 for 0 = 13
|
||||||
|
*/
|
||||||
|
void print_long(int32_t Number){
|
||||||
|
uint8_t i, L = 0;
|
||||||
|
uint8_t ch;
|
||||||
|
char decimal_buff[12];
|
||||||
|
decimal_buff[11] = 0;
|
||||||
|
ch = 11;
|
||||||
|
if(Number < 0){
|
||||||
|
Number = -Number;
|
||||||
|
L = 1;
|
||||||
|
}
|
||||||
|
do{
|
||||||
|
i = Number % 10L;
|
||||||
|
decimal_buff[--ch] = i + '0';
|
||||||
|
Number /= 10L;
|
||||||
|
}while(Number && ch > 0);
|
||||||
|
if(ch > 0 && L) decimal_buff[--ch] = '-';
|
||||||
|
usart_send(&decimal_buff[ch]);
|
||||||
|
}
|
||||||
|
|
||||||
|
void printUint(uint8_t *val, uint8_t len){
|
||||||
|
uint32_t Number = 0;
|
||||||
|
uint8_t i = len;
|
||||||
|
int8_t ch;
|
||||||
|
uint8_t decimal_buff[11]; // max len of U32 == 10 + \0
|
||||||
|
if(len > 4 || len == 3 || len == 0) return;
|
||||||
|
for(i = 0; i < 11; i++)
|
||||||
|
decimal_buff[i] = 0;
|
||||||
|
ch = 9;
|
||||||
|
switch(len){
|
||||||
|
case 1:
|
||||||
|
Number = *((uint8_t*)val);
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
Number = *((uint16_t*)val);
|
||||||
|
break;
|
||||||
|
case 4:
|
||||||
|
Number = *((uint32_t*)val);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
do{
|
||||||
|
i = Number % 10L;
|
||||||
|
decimal_buff[ch--] = i + '0';
|
||||||
|
Number /= 10L;
|
||||||
|
}while(Number && ch > -1);
|
||||||
|
usart_send((char*)&decimal_buff[ch+1]);
|
||||||
|
}
|
||||||
|
|
||||||
|
char *omit_whitespace(char *str){
|
||||||
|
char c;
|
||||||
|
for(c = *str; c == ' ' || c == '\t' || c == '\r' || c == '\n'; c = *(++str));
|
||||||
|
return str;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* read 16 bit integer value from buffer until first non-number
|
||||||
|
* @param buff (i) - input buffer
|
||||||
|
* @param (o) - output value
|
||||||
|
* @return 1 if all OK or 0 if there's none numbers in buffer
|
||||||
|
*/
|
||||||
|
uint8_t readInt(char *buff, int16_t *val){
|
||||||
|
uint8_t sign = 0, rb, bad = 1;
|
||||||
|
int32_t R = 0;
|
||||||
|
if(*buff == '-'){
|
||||||
|
sign = 1;
|
||||||
|
++buff;
|
||||||
|
}
|
||||||
|
do{
|
||||||
|
rb = *buff++;
|
||||||
|
if(rb < '0' || rb > '9') break;
|
||||||
|
bad = 0;
|
||||||
|
R = R * 10L + rb - '0';
|
||||||
|
if(R > 0x7fff){ // bad value
|
||||||
|
bad = 1;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}while(1);
|
||||||
|
//print_long(R);
|
||||||
|
if(bad) return 0;
|
||||||
|
if(sign) R = -R;
|
||||||
|
if(val) *val = (int16_t)R;
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
ISR(USART_RX_vect){
|
||||||
|
char c = UDR, r = UCSRA;
|
||||||
|
if(0 == (r & (_BV(FE) | _BV(PE) | _BV(DOR)))){ // no errors
|
||||||
|
if(c == '\t' || c == '\r' || c == '\n') return; // omit spaces
|
||||||
|
rx_buffer[rx_bufsize++] = c;
|
||||||
|
if(c == ']'){
|
||||||
|
usart_flags |= U_RX_COMPLETE;
|
||||||
|
rx_buffer[rx_bufsize++] = '\n';
|
||||||
|
rx_buffer[rx_bufsize] = 0;
|
||||||
|
}else if(rx_bufsize == RX_BUFFER_SIZE)
|
||||||
|
usart_flags |= U_RX_COMPLETE | U_RX_OVERFL;
|
||||||
|
}else usart_flags |= U_RX_COMPLETE | U_RX_ERROR;
|
||||||
|
}
|
||||||
|
|
||||||
|
ISR(USART_UDRE_vect){
|
||||||
|
if(tx_bufsize == 0){
|
||||||
|
UCSRB &= ~_BV(UDRIE);
|
||||||
|
usart_flags |= U_TX_COMPLETE;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
UDR = tx_buffer[tx_idx++];
|
||||||
|
if(tx_idx == tx_bufsize){
|
||||||
|
tx_idx = 0;
|
||||||
|
tx_bufsize = 0;
|
||||||
|
UCSRB &= ~_BV(UDRIE);
|
||||||
|
usart_flags |= U_TX_COMPLETE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
53
avr/scorpio1_module/uart.h
Normal file
53
avr/scorpio1_module/uart.h
Normal file
@ -0,0 +1,53 @@
|
|||||||
|
/*
|
||||||
|
* geany_encoding=koi8-r
|
||||||
|
* uart.h
|
||||||
|
*
|
||||||
|
* Copyright 2017 Edward V. Emelianov <eddy@sao.ru, edward.emelianoff@gmail.com>
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation; either version 2 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
||||||
|
* MA 02110-1301, USA.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
#ifndef __UART_H__
|
||||||
|
#define __UART_H__
|
||||||
|
#include <avr/io.h> // IO ports
|
||||||
|
#include <stdint.h> // int types
|
||||||
|
|
||||||
|
#define U_TX_COMPLETE (_BV(0))
|
||||||
|
#define U_RX_COMPLETE (_BV(1))
|
||||||
|
#define U_TX_ERROR (_BV(2))
|
||||||
|
#define U_RX_ERROR (_BV(3))
|
||||||
|
#define U_RX_OVERFL (_BV(4))
|
||||||
|
|
||||||
|
#define RX_BUFFER_SIZE (32)
|
||||||
|
#define TX_BUFFER_SIZE (32)
|
||||||
|
|
||||||
|
extern volatile uint8_t usart_flags;
|
||||||
|
extern char rx_buffer[];
|
||||||
|
extern char rx_copy[];
|
||||||
|
extern volatile uint8_t rx_bufsize;
|
||||||
|
|
||||||
|
int usart_send(char *Str);
|
||||||
|
|
||||||
|
void print_long(int32_t Number);
|
||||||
|
void printUint(uint8_t *val, uint8_t len);
|
||||||
|
|
||||||
|
uint8_t readInt(char *buff, int16_t *val);
|
||||||
|
|
||||||
|
char *omit_whitespace(char *str);
|
||||||
|
|
||||||
|
#endif // __UART_H__
|
||||||
Loading…
x
Reference in New Issue
Block a user