Permalink
Please sign in to comment.
Showing
with
0 additions
and 12,131 deletions.
- 0 {mendel → }/Makefile
- 0 {mendel → }/arduino.h
- +0 −75 battery_charger/Makefile
- +0 −56 battery_charger/adc.c
- +0 −23 battery_charger/adc.h
- +0 −69 battery_charger/battery_charger.c
- +0 −595 battery_charger/lcd.c
- +0 −263 battery_charger/lcd.h
- +0 −282 battery_charger/ld.strace
- +0 −89 battery_charger/ringbuffer.c
- +0 −26 battery_charger/ringbuffer.h
- +0 −72 battery_charger/serial.c
- +0 −24 battery_charger/serial.h
- 0 {mendel → }/calc.pl
- 0 {mendel → }/clock.c
- 0 {mendel → }/clock.h
- 0 {mendel → }/copier.c
- 0 {mendel → }/copier.h
- 0 {mendel → }/dda.c
- 0 {mendel → }/dda.h
- 0 {mendel → }/dda_queue.c
- 0 {mendel → }/dda_queue.h
- 0 {mendel → }/debug.c
- 0 {mendel → }/debug.h
- +0 −52 freq-counter/Makefile
- +0 −109 freq-counter/freq-counter.c
- +0 −595 freq-counter/lcd.c
- +0 −263 freq-counter/lcd.h
- BIN freq-counter/lcdlibrary.zip
- +0 −49 freq-counter/lcdlibrary/doxygen.css
- BIN freq-counter/lcdlibrary/doxygen.png
- +0 −1,174 freq-counter/lcdlibrary/group__pfleury__lcd.html
- +0 −609 freq-counter/lcdlibrary/lcd.c
- +0 −265 freq-counter/lcdlibrary/lcd.h
- +0 −425 freq-counter/lcdlibrary/makefile
- +0 −167 freq-counter/lcdlibrary/test_lcd.c
- +0 −89 freq-counter/ringbuffer.c
- +0 −26 freq-counter/ringbuffer.h
- +0 −72 freq-counter/serial.c
- +0 −24 freq-counter/serial.h
- BIN freq-counter/uartlibrary.zip
- +0 −49 freq-counter/uartlibrary/doxygen.css
- BIN freq-counter/uartlibrary/doxygen.png
- +0 −560 freq-counter/uartlibrary/group__pfleury__uart.html
- +0 −508 freq-counter/uartlibrary/makefile
- +0 −130 freq-counter/uartlibrary/test_uart.c
- +0 −651 freq-counter/uartlibrary/uart.c
- +0 −194 freq-counter/uartlibrary/uart.h
- 0 {mendel → }/func.sh
- 0 {mendel → }/gcode.c
- 0 {mendel → }/gcode.h
- 0 {mendel → }/machine.h
- 0 {mendel → }/mendel.c
- 0 {mendel → }/mendel_cmd
- 0 {mendel → }/pinout.h
- 0 {mendel → }/ringbuffer.c
- 0 {mendel → }/ringbuffer.h
- 0 {mendel → }/sender.sh
- 0 {mendel → }/serial.c
- 0 {mendel → }/serial.h
- 0 {mendel → }/sermsg.c
- 0 {mendel → }/sermsg.h
- 0 {mendel → }/sersendf.c
- 0 {mendel → }/sersendf.h
- +0 −76 skel/Makefile
- +0 −104 skel/arduino.h
- +0 −595 skel/lcd.c
- +0 −263 skel/lcd.h
- +0 −89 skel/ringbuffer.c
- +0 −26 skel/ringbuffer.h
- +0 −72 skel/serial.c
- +0 −26 skel/serial.h
- +0 −56 skel/yourprogramnamehere.c
- +0 −76 stepper-2/Makefile
- +0 −104 stepper-2/arduino.h
- +0 −595 stepper-2/lcd.c
- +0 −263 stepper-2/lcd.h
- +0 −89 stepper-2/ringbuffer.c
- +0 −26 stepper-2/ringbuffer.h
- +0 −72 stepper-2/serial.c
- +0 −24 stepper-2/serial.h
- +0 −302 stepper-2/stepper.c
- +0 −76 stepper/Makefile
- +0 −104 stepper/arduino.h
- +0 −595 stepper/lcd.c
- +0 −263 stepper/lcd.h
- +0 −89 stepper/ringbuffer.c
- +0 −26 stepper/ringbuffer.h
- +0 −72 stepper/serial.c
- +0 −24 stepper/serial.h
- +0 −396 stepper/stepper.c
- +0 −43 stepper/test.c
- 0 {mendel → }/temp.c
- 0 {mendel → }/temp.h
- 0 {mendel → }/timer.c
- 0 {mendel → }/timer.h
- 0 {mendel → }/watchdog.c
- 0 {mendel → }/watchdog.h
File renamed without changes.
File renamed without changes.
@@ -1,75 +0,0 @@ | ||
-############################################################################## | ||
-# # | ||
-# AVR-GCC skeleton # | ||
-# # | ||
-# by Triffid Hunter # | ||
-# # | ||
-############################################################################## | ||
- | ||
-############################################################################## | ||
-# # | ||
-# Change these to suit your application # | ||
-# # | ||
-############################################################################## | ||
- | ||
-PROGRAM = battery_charger | ||
- | ||
-SOURCES = $(PROGRAM).c ringbuffer.c serial.c lcd.c adc.c | ||
- | ||
-############################################################################## | ||
-# # | ||
-# Change these to suit your hardware # | ||
-# # | ||
-############################################################################## | ||
- | ||
-MCU_TARGET = atmega168 | ||
-F_CPU = 16000000L | ||
- | ||
-############################################################################## | ||
-# # | ||
-# These defaults should be ok, change if you need to # | ||
-# # | ||
-############################################################################## | ||
- | ||
-ARCH = avr- | ||
-OPTIMIZE = -Os | ||
-CFLAGS = -g -Wall -Wstrict-prototypes $(OPTIMIZE) -mmcu=$(MCU_TARGET) -DF_CPU=$(F_CPU) $(DEFS) -std=gnu99 -funsigned-char -funsigned-bitfields -fpack-struct -fshort-enums | ||
-LDFLAGS = -Wl,-u,vfprintf -lprintf_min | ||
- | ||
-CC = $(ARCH)gcc | ||
-OBJDUMP = $(ARCH)objdump | ||
-OBJCOPY = $(ARCH)objcopy | ||
-AVRDUDE = ~/bin/avrdude | ||
- | ||
-PROGPORT = /dev/arduino | ||
-PROGBAUD = 19200 | ||
- | ||
-OBJ = $(patsubst %.c,%.o,${SOURCES}) | ||
- | ||
-.PHONY: all program clean | ||
-.PRECIOUS: %.o %.elf | ||
- | ||
-all: $(PROGRAM).hex $(PROGRAM).lst | ||
- | ||
-program: $(PROGRAM).hex | ||
- stty $(PROGBAUD) raw ignbrk hup < $(PROGPORT) | ||
- $(AVRDUDE) -cstk500v1 -b$(PROGBAUD) -p$(MCU_TARGET) -P$(PROGPORT) -C/etc/avrdude.conf -U flash:w:$^ | ||
- stty -hup -echo < $(PROGPORT) | ||
- | ||
-clean: | ||
- rm -rf *.o *.elf *.lst *.map *.sym *.lss *.eep *.srec *.bin *.hex *.al | ||
- | ||
-%.o: %.c | ||
- $(CC) -c $(CFLAGS) -Wa,-adhlns=$(<:.c=.al) -o $@ $^ | ||
- | ||
-%.elf: $(OBJ) | ||
- $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $^ $(LIBS) | ||
- | ||
-%.lst: %.elf | ||
- $(OBJDUMP) -h -S $< > $@ | ||
- | ||
-%.hex: %.elf | ||
- $(OBJCOPY) -j .text -j .data -O ihex $< $@ | ||
- | ||
-%.bin: %.elf | ||
- $(OBJCOPY) -j .text -j .data -O binary $< $@ |
@@ -1,56 +0,0 @@ | ||
-#include "adc.h" | ||
- | ||
-void adc_init(uint8_t vsel) | ||
-{ | ||
- PRR &= ~_BV(PRADC); | ||
- ADMUX = (ADMUX & ~(_BV(REFS1) | _BV(REFS0))) | vsel; | ||
- ADCSRA = _BV(ADEN); | ||
- | ||
- #if F_CPU >= (ADC_MAX_FREQ * 128) | ||
- #error F_CPU is too high for ADC prescaler! | ||
- #elif F_CPU >= (ADC_MAX_FREQ * 64) | ||
- ADCSRA |= _BV(ADPS2) | _BV(ADPS1) | _BV(ADPS0); | ||
- #elif F_CPU >= (ADC_MAX_FREQ * 32) | ||
- ADCSRA |= _BV(ADPS2) | _BV(ADPS1); | ||
- #elif F_CPU >= (ADC_MAX_FREQ * 16) | ||
- ADCSRA |= _BV(ADPS2) | _BV(ADPS0); | ||
- #elif F_CPU >= (ADC_MAX_FREQ * 8) | ||
- ADCSRA |= _BV(ADPS2); | ||
- #elif F_CPU >= (ADC_MAX_FREQ * 4) | ||
- ADCSRA |= _BV(ADPS1) | _BV(ADPS0); | ||
- #elif F_CPU >= (ADC_MAX_FREQ * 2) | ||
- ADCSRA |= _BV(ADPS1); | ||
- #elif F_CPU >= (ADC_MAX_FREQ >> 1) | ||
- ADSRA |= _BV(ADPS0); | ||
- #else | ||
- #error F_CPU is too slow for ADC to run well! | ||
- #endif | ||
-} | ||
- | ||
-uint16_t adc_read(uint8_t pin) | ||
-{ | ||
- adc_start(pin); | ||
- adc_wait(); | ||
- return adc_result(); | ||
-} | ||
- | ||
-void adc_start(uint8_t pin) | ||
-{ | ||
- ADMUX = (ADMUX & 0xF0) | pin; | ||
- ADCSRA |= _BV(ADSC); | ||
-} | ||
- | ||
-uint16_t adc_result() | ||
-{ | ||
- return ADC; | ||
-} | ||
- | ||
-uint8_t adc_finished() | ||
-{ | ||
- return (ADCSRA & _BV(ADSC))?0xFF:0; | ||
-} | ||
- | ||
-void adc_wait() | ||
-{ | ||
- for (;adc_finished() == 0;); | ||
-} |
@@ -1,23 +0,0 @@ | ||
-#ifndef _ADC_H | ||
-#define _ADC_H | ||
- | ||
-#include <stdint.h> | ||
-#include <avr/io.h> | ||
- | ||
-#define VSEL_AREF 0 | ||
-#define VSEL_AVCC _BV(REFS0) | ||
-#define VSEL_1V1 _BV(REFS1) | ||
- | ||
-#define ADC_MAX_FREQ 200000 | ||
- | ||
-void adc_init(uint8_t vsel); | ||
- | ||
-uint16_t adc_read(uint8_t pin); | ||
- | ||
-void adc_start(uint8_t pin); | ||
-inline uint16_t adc_result(void); | ||
- | ||
-uint8_t adc_finished(void); | ||
-void adc_wait(void); | ||
- | ||
-#endif /* _ADC_H */ |
@@ -1,69 +0,0 @@ | ||
-#include <stddef.h> | ||
-#include <stdio.h> | ||
-#include <stdint.h> | ||
- | ||
-#include <avr/io.h> | ||
-#include <avr/interrupt.h> | ||
- | ||
-#include "serial.h" | ||
-#include "lcd.h" | ||
- | ||
-// write to lcd function for fdev_setup_stream | ||
-static int lcd_putc_fdev(char c, FILE *stream) | ||
-{ | ||
- lcd_putc(c); | ||
- return 0; | ||
-} | ||
- | ||
-int serial_putc_fdev(char c, FILE *stream) | ||
-{ | ||
- serial_writechar((uint8_t) c); | ||
- return 0; | ||
-} | ||
- | ||
-int serial_getc_fdev(FILE *stream) | ||
-{ | ||
- for (;serial_rxchars() == 0;); | ||
- return (int) serial_popchar(); | ||
-} | ||
- | ||
-static FILE lcdo = FDEV_SETUP_STREAM(lcd_putc_fdev, NULL, _FDEV_SETUP_WRITE); | ||
-static FILE serio = FDEV_SETUP_STREAM(serial_putc_fdev, serial_getc_fdev, _FDEV_SETUP_RW); | ||
- | ||
-int main (void) | ||
-{ | ||
- // set up LCD | ||
- lcd_init(LCD_DISP_ON_CURSOR); | ||
- | ||
- lcd_puts_P("Starting..."); | ||
- | ||
- // set up STDIN/OUT/ERR | ||
- stdin = &serio; | ||
- stdout = &lcdo; | ||
- stderr = &lcdo; | ||
- | ||
- // set up serial | ||
- serial_init(19200); | ||
- | ||
- sei(); | ||
- | ||
- lcd_gotoxy(0, 0); | ||
- fprintf(&lcdo, "Battery Charger OK"); | ||
- | ||
- for (;;) | ||
- { | ||
- # switch off all currents | ||
- # check battery presence | ||
- # for (each battery) { | ||
- # check ambient temperature | ||
- # check battery temperature | ||
- # calculate delta T | ||
- # check battery voltage | ||
- # calculate delta V | ||
- # check charge cycle location | ||
- # apply suitable current | ||
- # update screen/indicators | ||
- # } | ||
- # wait | ||
- } | ||
-} |

Oops, something went wrong.
0 comments on commit
595b66a