Reset to bootloader call added to makefile. Buffer data read function added.
This commit is contained in:
parent
e3989613bc
commit
ff14f0971e
7 changed files with 25 additions and 9 deletions
|
@ -23,11 +23,17 @@ LUFA_PATH = ../LUFA/LUFA
|
||||||
CC_FLAGS = -DUSE_LUFA_CONFIG_HEADER -IConfig/ -Iuart/
|
CC_FLAGS = -DUSE_LUFA_CONFIG_HEADER -IConfig/ -Iuart/
|
||||||
LD_FLAGS =
|
LD_FLAGS =
|
||||||
PROGRAMMER = dfu-programmer
|
PROGRAMMER = dfu-programmer
|
||||||
|
MUX_TOOL =../tools/muxctrl.py
|
||||||
|
PYTHON = python
|
||||||
|
|
||||||
# Default target
|
# Default target
|
||||||
all:
|
all:
|
||||||
|
|
||||||
program:
|
reset:
|
||||||
|
-$(PYTHON) $(MUX_TOOL) -d /dev/ttyACM0 -r
|
||||||
|
-sleep 2
|
||||||
|
|
||||||
|
program: reset
|
||||||
$(PROGRAMMER) $(MCU) erase
|
$(PROGRAMMER) $(MCU) erase
|
||||||
$(PROGRAMMER) $(MCU) flash $(TARGET).hex
|
$(PROGRAMMER) $(MCU) flash $(TARGET).hex
|
||||||
$(PROGRAMMER) $(MCU) reset
|
$(PROGRAMMER) $(MCU) reset
|
||||||
|
|
|
@ -21,7 +21,6 @@
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
||||||
|
|
||||||
void cc_setBaudrate(void);
|
void cc_setBaudrate(void);
|
||||||
void cc_getBaudrate(void);
|
void cc_getBaudrate(void);
|
||||||
void cc_setMuxLine(void);
|
void cc_setMuxLine(void);
|
||||||
|
|
|
@ -144,3 +144,16 @@ void cc_clearReadDataBuffer()
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
||||||
|
uint32_t read32BitFromBuffer(uint8_t pos)
|
||||||
|
{
|
||||||
|
uint32_t tmp = (uint32_t)cc_read_data[pos ] << 24;
|
||||||
|
tmp += (uint32_t)cc_read_data[pos + 1] << 16;
|
||||||
|
tmp += (uint32_t)cc_read_data[pos + 2] << 8;
|
||||||
|
tmp += (uint32_t)cc_read_data[pos + 3];
|
||||||
|
|
||||||
|
return tmp;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*****************************************************************************/
|
||||||
|
|
||||||
|
|
|
@ -29,6 +29,8 @@
|
||||||
|
|
||||||
extern void USB_serialStreamWriteC(char*, uint16_t);
|
extern void USB_serialStreamWriteC(char*, uint16_t);
|
||||||
|
|
||||||
|
uint32_t read32BitFromBuffer(uint8_t);
|
||||||
|
|
||||||
void cc_init(void);
|
void cc_init(void);
|
||||||
void cc_abort(void);
|
void cc_abort(void);
|
||||||
void cc_processData(uint8_t);
|
void cc_processData(uint8_t);
|
||||||
|
|
|
@ -15,10 +15,7 @@ extern uint32_t baudrate;
|
||||||
|
|
||||||
void cc_setBaudrate()
|
void cc_setBaudrate()
|
||||||
{
|
{
|
||||||
baudrate = (uint32_t)cc_read_data[0] << 24;
|
baudrate = read32BitFromBuffer(0);
|
||||||
baudrate += (uint32_t)cc_read_data[1] << 16;
|
|
||||||
baudrate += (uint32_t)cc_read_data[2] << 8;
|
|
||||||
baudrate += (uint32_t)cc_read_data[3];
|
|
||||||
|
|
||||||
eeprom_busy_wait();
|
eeprom_busy_wait();
|
||||||
|
|
||||||
|
|
|
@ -261,7 +261,7 @@ void CDC2_Task(void)
|
||||||
/* Finalize the stream transfer to send the last packet */
|
/* Finalize the stream transfer to send the last packet */
|
||||||
Endpoint_ClearOUT();
|
Endpoint_ClearOUT();
|
||||||
|
|
||||||
// TODO at this point send the data to the USART
|
// at this point send the data to the USART
|
||||||
// Send USART &Buffer
|
// Send USART &Buffer
|
||||||
for (uint16_t i = 0; i < DataLength; i++)
|
for (uint16_t i = 0; i < DataLength; i++)
|
||||||
{
|
{
|
||||||
|
@ -271,7 +271,7 @@ void CDC2_Task(void)
|
||||||
|
|
||||||
//=====================================
|
//=====================================
|
||||||
uint8_t outBuffer[OUTPUT_BUFFER_SIZE];
|
uint8_t outBuffer[OUTPUT_BUFFER_SIZE];
|
||||||
// TODO read the USART data and send them to the host
|
// read the USART data and send them to the host
|
||||||
// Fill &Buffer with USART data or send the USART input buffer direct
|
// Fill &Buffer with USART data or send the USART input buffer direct
|
||||||
uint16_t cnt = 0;
|
uint16_t cnt = 0;
|
||||||
int c = uart_getc();
|
int c = uart_getc();
|
||||||
|
|
|
@ -58,7 +58,6 @@
|
||||||
|
|
||||||
/* UART definitions: */
|
/* UART definitions: */
|
||||||
|
|
||||||
//#define UART_BAUD_RATE 115200
|
|
||||||
#define OUTPUT_BUFFER_SIZE 100
|
#define OUTPUT_BUFFER_SIZE 100
|
||||||
|
|
||||||
#include "uart/uart.h" // include after the definition
|
#include "uart/uart.h" // include after the definition
|
||||||
|
|
Loading…
Reference in a new issue