New function added to thow the current driver mux line.

This commit is contained in:
klaute 2016-08-26 15:20:31 +02:00
parent 3c6bfbfa39
commit 747fe86deb
3 changed files with 21 additions and 0 deletions

View file

@ -25,6 +25,7 @@
void cc_setBaudrate(void); void cc_setBaudrate(void);
void cc_getBaudrate(void); void cc_getBaudrate(void);
void cc_setMuxLine(void); void cc_setMuxLine(void);
void cc_getMuxLine(void);
void cc_startBootloader(void); void cc_startBootloader(void);
/*****************************************************************************/ /*****************************************************************************/
@ -32,6 +33,7 @@ void cc_startBootloader(void);
#define CC_CMD_SET_BAUDRATE 0x0A #define CC_CMD_SET_BAUDRATE 0x0A
#define CC_CMD_GET_BAUDRATE 0x14 #define CC_CMD_GET_BAUDRATE 0x14
#define CC_CMD_SET_MUX_LINE 0x1E #define CC_CMD_SET_MUX_LINE 0x1E
#define CC_CMD_GET_MUX_LINE 0x28
#define CC_CMD_START_BTLDR 0x32 #define CC_CMD_START_BTLDR 0x32
/*****************************************************************************/ /*****************************************************************************/
@ -39,6 +41,7 @@ void cc_startBootloader(void);
#define CC_CMD_SET_BAUDRATE_FUNC &cc_setBaudrate #define CC_CMD_SET_BAUDRATE_FUNC &cc_setBaudrate
#define CC_CMD_GET_BAUDRATE_FUNC &cc_getBaudrate #define CC_CMD_GET_BAUDRATE_FUNC &cc_getBaudrate
#define CC_CMD_SET_MUX_LINE_FUNC &cc_setMuxLine #define CC_CMD_SET_MUX_LINE_FUNC &cc_setMuxLine
#define CC_CMD_GET_MUX_LINE_FUNC &cc_getMuxLine
#define CC_CMD_START_BTLDR_FUNC &cc_startBootloader #define CC_CMD_START_BTLDR_FUNC &cc_startBootloader
/*****************************************************************************/ /*****************************************************************************/
@ -46,6 +49,7 @@ void cc_startBootloader(void);
#define CC_CMD_SET_BAUDRATE_DATA_TO_READ 4 // set baudrate #define CC_CMD_SET_BAUDRATE_DATA_TO_READ 4 // set baudrate
#define CC_CMD_GET_BAUDRATE_DATA_TO_READ 0 // get baudrate #define CC_CMD_GET_BAUDRATE_DATA_TO_READ 0 // get baudrate
#define CC_CMD_SET_MUX_LINE_DATA_TO_READ 1 // set mux line #define CC_CMD_SET_MUX_LINE_DATA_TO_READ 1 // set mux line
#define CC_CMD_GET_MUX_LINE_DATA_TO_READ 0 // get mux line
#define CC_CMD_START_BTLDR_DATA_TO_READ 0 // start bootloader #define CC_CMD_START_BTLDR_DATA_TO_READ 0 // start bootloader
/*****************************************************************************/ /*****************************************************************************/
@ -58,6 +62,7 @@ uint8_t cc_commands[] = {
CC_CMD_SET_BAUDRATE, CC_CMD_SET_BAUDRATE,
CC_CMD_GET_BAUDRATE, CC_CMD_GET_BAUDRATE,
CC_CMD_SET_MUX_LINE, CC_CMD_SET_MUX_LINE,
CC_CMD_GET_MUX_LINE,
CC_CMD_START_BTLDR, CC_CMD_START_BTLDR,
}; };
@ -65,6 +70,7 @@ void (*cc_cmd_functions[])() = {
CC_CMD_SET_BAUDRATE_FUNC, CC_CMD_SET_BAUDRATE_FUNC,
CC_CMD_GET_BAUDRATE_FUNC, CC_CMD_GET_BAUDRATE_FUNC,
CC_CMD_SET_MUX_LINE_FUNC, CC_CMD_SET_MUX_LINE_FUNC,
CC_CMD_GET_MUX_LINE_FUNC,
CC_CMD_START_BTLDR_FUNC, CC_CMD_START_BTLDR_FUNC,
}; };
@ -72,6 +78,7 @@ uint8_t cc_cmd_data_to_read[] = {
CC_CMD_SET_BAUDRATE_DATA_TO_READ, CC_CMD_SET_BAUDRATE_DATA_TO_READ,
CC_CMD_GET_BAUDRATE_DATA_TO_READ, CC_CMD_GET_BAUDRATE_DATA_TO_READ,
CC_CMD_SET_MUX_LINE_DATA_TO_READ, CC_CMD_SET_MUX_LINE_DATA_TO_READ,
CC_CMD_GET_MUX_LINE_DATA_TO_READ,
CC_CMD_START_BTLDR_DATA_TO_READ, CC_CMD_START_BTLDR_DATA_TO_READ,
}; };

View file

@ -60,6 +60,19 @@ void cc_startBootloader()
/*****************************************************************************/ /*****************************************************************************/
void cc_getMuxLine()
{
uint8_t mux_line = ((PORTB & 0x40) >> 6);
mux_line += ((PORTB & 0x20) >> 4);
mux_line += ((PORTB & 0x10) >> 2);
char* sBody = " ";
sprintf(sBody, "%c%c%c%c%c%c", MSG_SOM1, MSG_SOM2, MSG_TYPE_MUXLINE, mux_line, MSG_EOM1, MSG_EOM2);
USB_serialStreamWriteC(sBody, strlen(sBody));
}
/*****************************************************************************/
void cc_setMuxLine() void cc_setMuxLine()
{ {
switch(cc_read_data[0]) switch(cc_read_data[0])

View file

@ -10,6 +10,7 @@
#define MSG_TYPE_ANSWER_OK 0x01 #define MSG_TYPE_ANSWER_OK 0x01
#define MSG_TYPE_ANSWER_NOK 0x02 #define MSG_TYPE_ANSWER_NOK 0x02
#define MSG_TYPE_BAUDRATE 0x03 #define MSG_TYPE_BAUDRATE 0x03
#define MSG_TYPE_MUXLINE 0x04
/*****************************************************************************/ /*****************************************************************************/