2016-08-23 09:32:19 +02:00
|
|
|
/*
|
|
|
|
* Author: klaute -Kai Lauterbach - @kailauterbach - me@klaute.de
|
|
|
|
* Date: 08/2016
|
|
|
|
* License: GPLv3
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef __COMMAND_CONFIG_H__
|
|
|
|
#define __COMMAND_CONFIG_H__
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
|
|
#include <stdio.h>
|
|
|
|
#include <string.h>
|
|
|
|
|
|
|
|
#include <avr/wdt.h>
|
|
|
|
#include <avr/eeprom.h>
|
|
|
|
|
|
|
|
#include "globals.h"
|
|
|
|
|
|
|
|
#include "uart/uart.h"
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
|
|
|
|
|
|
void cc_setBaudrate(void);
|
|
|
|
void cc_getBaudrate(void);
|
2016-08-23 09:48:37 +02:00
|
|
|
void cc_setMuxLine(void);
|
2016-08-26 15:20:31 +02:00
|
|
|
void cc_getMuxLine(void);
|
2016-08-23 09:32:19 +02:00
|
|
|
void cc_startBootloader(void);
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
|
|
#define CC_CMD_SET_BAUDRATE 0x0A
|
|
|
|
#define CC_CMD_GET_BAUDRATE 0x14
|
2016-08-23 09:48:37 +02:00
|
|
|
#define CC_CMD_SET_MUX_LINE 0x1E
|
2016-08-26 15:20:31 +02:00
|
|
|
#define CC_CMD_GET_MUX_LINE 0x28
|
2016-08-23 09:32:19 +02:00
|
|
|
#define CC_CMD_START_BTLDR 0x32
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
|
|
#define CC_CMD_SET_BAUDRATE_FUNC &cc_setBaudrate
|
|
|
|
#define CC_CMD_GET_BAUDRATE_FUNC &cc_getBaudrate
|
2016-08-23 09:48:37 +02:00
|
|
|
#define CC_CMD_SET_MUX_LINE_FUNC &cc_setMuxLine
|
2016-08-26 15:20:31 +02:00
|
|
|
#define CC_CMD_GET_MUX_LINE_FUNC &cc_getMuxLine
|
2016-08-23 09:32:19 +02:00
|
|
|
#define CC_CMD_START_BTLDR_FUNC &cc_startBootloader
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
|
|
#define CC_CMD_SET_BAUDRATE_DATA_TO_READ 4 // set baudrate
|
|
|
|
#define CC_CMD_GET_BAUDRATE_DATA_TO_READ 0 // get baudrate
|
2016-08-23 09:48:37 +02:00
|
|
|
#define CC_CMD_SET_MUX_LINE_DATA_TO_READ 1 // set mux line
|
2016-08-26 15:20:31 +02:00
|
|
|
#define CC_CMD_GET_MUX_LINE_DATA_TO_READ 0 // get mux line
|
2016-08-23 09:32:19 +02:00
|
|
|
#define CC_CMD_START_BTLDR_DATA_TO_READ 0 // start bootloader
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
|
|
#define CC_READ_DATA_MAX 64
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
|
|
uint8_t cc_commands[] = {
|
|
|
|
CC_CMD_SET_BAUDRATE,
|
|
|
|
CC_CMD_GET_BAUDRATE,
|
2016-08-23 09:48:37 +02:00
|
|
|
CC_CMD_SET_MUX_LINE,
|
2016-08-26 15:20:31 +02:00
|
|
|
CC_CMD_GET_MUX_LINE,
|
2016-08-23 09:32:19 +02:00
|
|
|
CC_CMD_START_BTLDR,
|
|
|
|
};
|
|
|
|
|
|
|
|
void (*cc_cmd_functions[])() = {
|
|
|
|
CC_CMD_SET_BAUDRATE_FUNC,
|
|
|
|
CC_CMD_GET_BAUDRATE_FUNC,
|
2016-08-23 09:48:37 +02:00
|
|
|
CC_CMD_SET_MUX_LINE_FUNC,
|
2016-08-26 15:20:31 +02:00
|
|
|
CC_CMD_GET_MUX_LINE_FUNC,
|
2016-08-23 09:32:19 +02:00
|
|
|
CC_CMD_START_BTLDR_FUNC,
|
|
|
|
};
|
|
|
|
|
|
|
|
uint8_t cc_cmd_data_to_read[] = {
|
|
|
|
CC_CMD_SET_BAUDRATE_DATA_TO_READ,
|
|
|
|
CC_CMD_GET_BAUDRATE_DATA_TO_READ,
|
2016-08-23 09:48:37 +02:00
|
|
|
CC_CMD_SET_MUX_LINE_DATA_TO_READ,
|
2016-08-26 15:20:31 +02:00
|
|
|
CC_CMD_GET_MUX_LINE_DATA_TO_READ,
|
2016-08-23 09:32:19 +02:00
|
|
|
CC_CMD_START_BTLDR_DATA_TO_READ,
|
|
|
|
};
|
|
|
|
|
|
|
|
uint8_t cc_read_data[CC_READ_DATA_MAX];
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|