Skip to content
Browse files

Merge branch 'can-or-control'

  • Loading branch information...
2 parents 179a41c + 5d83d58 commit b8b7615eaf41b3bea188198a5aba1ece41e2415f @uescher uescher committed
View
4 can-or-control/avr-can-lib/src/config.h
@@ -42,8 +42,8 @@
* Remember NOT to use them in your application!
* It is a good idea to use bits from the port that carries MOSI, MISO, SCK.
*/
-#define MCP2515_CS B,2
-#define MCP2515_INT B,1
+#define MCP2515_CS B,1
+#define MCP2515_INT C,0
// -----------------------------------------------------------------------------
// Setting for SJA1000
View
8 can-or-control/main.c
@@ -45,6 +45,11 @@
//Hier startet das Hauptprogramm
int main(void)
{
+ // Set Output LED1 LED2
+ DDRC |= (1<<PC3)|(1<<PC2);
+
+ // Set Output SPI SS Pin
+ DDRB = (1<<PB2);
// Configuration hmi (Human Machine Interface)
#if USE_HMI
@@ -79,6 +84,9 @@ int main(void)
wdt_enable(WDTO_500MS);
+ // Activate LED1 - System OK
+ PORTC = (1<<PC3);
+
while(1)
{
View
4 can-or-control/makefile
@@ -61,7 +61,7 @@ endif
#Fuse settings for ATmega8
ifeq ($(MCU), atmega8)
- FUSE_BITS = -u -U lfuse:w:0xbe:m -U hfuse:w:0xd2:m
+ FUSE_BITS = -u -U lfuse:w:0x90:m -U hfuse:w:0xd2:m
HEX_FILE_NAME = MEGA8
endif
@@ -189,7 +189,7 @@ AVRDUDE_PROGRAMMER = stk500v2
AVRDUDE_PORT = /dev/ttyUSB0 # programmer connected to parallel port
#AVRDUDE_WRITE_FLASH = -D -U flash:w:$(TARGET).hex $(FUSE_BITS)
-AVRDUDE_WRITE_FLASH = -U flash:w:$(TARGET).hex $(FUSE_BITS)
+AVRDUDE_WRITE_FLASH = -D -U flash:w:$(TARGET).hex $(FUSE_BITS)
#AVRDUDE_WRITE_EEPROM = -U eeprom:w:$(TARGET).eep
#AVRDUDE_FLAGS = -p $(MCU) -P $(AVRDUDE_PORT) -b 115200 -c $(AVRDUDE_PROGRAMMER)
View
8 can-or-control/power_mgt.c
@@ -75,7 +75,13 @@ void power_mgt_init(void)
void power_mgt_main(void)
{
- power_mgt_state[0].input_1 = key_state & _BV(PD2);
+ power_mgt_state[0].input_1 = key_state & _BV(PD5);
+
+ if (power_mgt_state[0].input_1) {
+ PORTC |= (1<<PC2);
+ } else {
+ PORTC &= ~(1<<PC2);
+ }
static uint8_t i = POWER_MGT_CHANNEL_COUNT;
View
13 can-or-control/timer.c
@@ -120,19 +120,8 @@ void timer_init (void)
static uint8_t ct0, ct1;
uint8_t i;
-
- uint8_t input_byte = 0;
-
- input_byte |= ((PIND<<3)&0xE0);
-
- input_byte |= ((PIND>>1)&0x10);
- input_byte |= ((PIND>>3)&0x08);
- input_byte |= ((PIND>>5)&0x04);
- input_byte |= ((PINB<<1)&0x02);
- input_byte |= ((PIND>>2)&0x01);
-
- i = key_state ^ ~input_byte; // key changed ?
+ i = key_state ^ ~PIND; // key changed ?
ct0 = ~( ct0 & i ); // reset or count ct0
ct1 = ct0 ^ (ct1 & i); // reset or count ct1
i &= ct0 & ct1; // count until roll over ?
View
4 can-or-control/uart.c
@@ -71,6 +71,10 @@ void uart_init()
// FIFOs für Ein- und Ausgabe initialisieren
fifo_init (&uart_infifo, uart_inbuf, BUFSIZE_IN);
fifo_init (&uart_outfifo, uart_outbuf, BUFSIZE_OUT);
+
+ //MAX485 TX-Enable
+ PORTD |= (1<<PD2);
+ DDRD |= (1<<PD2);
}
//----------------------------------------------------------------------------

0 comments on commit b8b7615

Please sign in to comment.
Something went wrong with that request. Please try again.