Corrected comments that didn't convert well automatically and caused syntax errors.
This commit is contained in:
@@ -35,7 +35,7 @@
|
|||||||
#include "rs485.h"
|
#include "rs485.h"
|
||||||
#include "npdu.h"
|
#include "npdu.h"
|
||||||
|
|
||||||
/* Number of MS/TP Packets Rx/Tx
|
/* Number of MS/TP Packets Rx/Tx */
|
||||||
uint16_t MSTP_Packets = 0;
|
uint16_t MSTP_Packets = 0;
|
||||||
|
|
||||||
/* receive buffer */
|
/* receive buffer */
|
||||||
@@ -49,41 +49,6 @@ volatile struct mstp_port_struct_t MSTP_Port;
|
|||||||
|
|
||||||
#define INCREMENT_AND_LIMIT_UINT16(x) {if (x < 0xFFFF) x++;}
|
#define INCREMENT_AND_LIMIT_UINT16(x) {if (x < 0xFFFF) x++;}
|
||||||
|
|
||||||
|
|
||||||
/* This defines the number of edit fields for this module
|
|
||||||
*/
|
|
||||||
#define MAX_EDIT_FIELD 1
|
|
||||||
static uint8_t EditField = 0;
|
|
||||||
/* *************************************************************************
|
|
||||||
DESCRIPTION: This function handles incrementing or decrementing our
|
|
||||||
EditField
|
|
||||||
RETURN: none
|
|
||||||
ALGORITHM: none
|
|
||||||
NOTES: Pass a #>0 to increment #<0 to decrement
|
|
||||||
*************************************************************************** */
|
|
||||||
void dlmstp_SetEditField(signed char state)
|
|
||||||
{ /* direction our editfield is moving */
|
|
||||||
if (state > 0) {
|
|
||||||
if (++EditField > MAX_EDIT_FIELD)
|
|
||||||
EditField = 0;
|
|
||||||
} else if (state < 0) {
|
|
||||||
if (EditField)
|
|
||||||
EditField--;
|
|
||||||
else
|
|
||||||
EditField = MAX_EDIT_FIELD;
|
|
||||||
} else
|
|
||||||
EditField = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* *************************************************************************
|
|
||||||
DESCRIPTION: Gets the current edit field for this module
|
|
||||||
RETURN: the current edit field
|
|
||||||
ALGORITHM: none
|
|
||||||
NOTES: none
|
|
||||||
*************************************************************************** */
|
|
||||||
uint8_t dlmstp_GetEditField(void)
|
|
||||||
{
|
|
||||||
return (EditField);
|
|
||||||
void dlmstp_millisecond_timer(void)
|
void dlmstp_millisecond_timer(void)
|
||||||
{
|
{
|
||||||
INCREMENT_AND_LIMIT_UINT16(MSTP_Port.SilenceTimer);
|
INCREMENT_AND_LIMIT_UINT16(MSTP_Port.SilenceTimer);
|
||||||
@@ -204,7 +169,8 @@ void dlmstp_task(void)
|
|||||||
if (MSTP_Port.receive_state == MSTP_RECEIVE_STATE_IDLE) {
|
if (MSTP_Port.receive_state == MSTP_RECEIVE_STATE_IDLE) {
|
||||||
while (MSTP_Master_Node_FSM(&MSTP_Port)) {
|
while (MSTP_Master_Node_FSM(&MSTP_Port)) {
|
||||||
};
|
};
|
||||||
while (MSTP_Master_Node_FSM(&MSTP_Port)) {
|
/*MSTP_Master_Node_FSM(&MSTP_Port);
|
||||||
|
*/
|
||||||
}
|
}
|
||||||
/* see if there is a packet available, and a place
|
/* see if there is a packet available, and a place
|
||||||
to put the reply (if necessary) and process it */
|
to put the reply (if necessary) and process it */
|
||||||
|
|||||||
@@ -43,7 +43,8 @@ uint32_t RS485_Baud_Rate = 9600;
|
|||||||
/* the ISR and other use this for status and control */
|
/* the ISR and other use this for status and control */
|
||||||
COMSTAT RS485_Comstat;
|
COMSTAT RS485_Comstat;
|
||||||
|
|
||||||
/*#pragma udata MSTPPortData
|
/*#pragma udata MSTPPortData
|
||||||
|
*/
|
||||||
/* the buffer for receiving characters */
|
/* the buffer for receiving characters */
|
||||||
volatile uint8_t RS485_Rx_Buffer[MAX_MPDU];
|
volatile uint8_t RS485_Rx_Buffer[MAX_MPDU];
|
||||||
|
|
||||||
@@ -86,14 +87,15 @@ void RS485_Send_Frame(volatile struct mstp_port_struct_t *mstp_port, /* port
|
|||||||
};
|
};
|
||||||
|
|
||||||
RS485_Comstat.TxHead = 0;
|
RS485_Comstat.TxHead = 0;
|
||||||
RS485_Comstat.TxHead = 0;
|
memcpy((void *) &RS485_Tx_Buffer[0], (void *) buffer, nbytes);
|
||||||
memcpy((void *) &RS485_Tx_Buffer[0], (void *) buffer, nbytes);
|
#if 0
|
||||||
|
for (i = 0; i < nbytes; i++) {
|
||||||
/*for (i = 0; i < nbytes; i++) {
|
/* put the data into the buffer */
|
||||||
*/
|
RS485_Tx_Buffer[i] = *buffer;
|
||||||
/* /* put the data into the buffer */
|
buffer++;
|
||||||
*/
|
}
|
||||||
/* RS485_Tx_Buffer[i] = *buffer;
|
#endif
|
||||||
|
RS485_Comstat.Tx_Bytes = nbytes;
|
||||||
/* disable the receiver */
|
/* disable the receiver */
|
||||||
PIE3bits.RC2IE = 0;
|
PIE3bits.RC2IE = 0;
|
||||||
RCSTA2bits.CREN = 0;
|
RCSTA2bits.CREN = 0;
|
||||||
@@ -198,7 +200,8 @@ void RS485_Interrupt_Tx(void)
|
|||||||
/* enable the receiver */
|
/* enable the receiver */
|
||||||
RS485_TX_ENABLE = 0;
|
RS485_TX_ENABLE = 0;
|
||||||
RS485_RX_DISABLE = 0;
|
RS485_RX_DISABLE = 0;
|
||||||
while (!TXSTA2bits.TRMT);
|
/* FIXME: might not be necessary
|
||||||
|
*/
|
||||||
PIE3bits.RC2IE = 1;
|
PIE3bits.RC2IE = 1;
|
||||||
RCSTA2bits.CREN = 1;
|
RCSTA2bits.CREN = 1;
|
||||||
}
|
}
|
||||||
@@ -346,7 +349,7 @@ void RS485_Disable_Port(void)
|
|||||||
|
|
||||||
void RS485_Reinit(void)
|
void RS485_Reinit(void)
|
||||||
{
|
{
|
||||||
RCSTA2 &= 0x4F; /* Disable the receiver */
|
RS485_Set_Baud_Rate(38400);
|
||||||
}
|
}
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
|
|||||||
Reference in New Issue
Block a user