Performed standard indent script indent.sh on project files.

This commit is contained in:
skarg
2010-12-15 19:02:40 +00:00
parent f820697464
commit 2a0bf4926a
107 changed files with 974 additions and 1033 deletions
+2 -2
View File
@@ -360,8 +360,8 @@ bool Analog_Value_Write_Property(
(value.type.Real >= 0.0) && (value.type.Real <= 100.0)) {
level = (uint8_t) value.type.Real;
object_index =
Analog_Value_Instance_To_Index
(wp_data->object_instance);
Analog_Value_Instance_To_Index(wp_data->
object_instance);
priority--;
Present_Value[object_index] = level;
/* Note: you could set the physical output here if we
+2 -2
View File
@@ -270,8 +270,8 @@ bool Binary_Value_Write_Property(
(value.type.Enumerated <= MAX_BINARY_PV)) {
level = value.type.Enumerated;
object_index =
Binary_Value_Instance_To_Index
(wp_data->object_instance);
Binary_Value_Instance_To_Index(wp_data->
object_instance);
priority--;
/* NOTE: this Binary value has no priority array */
Present_Value[object_index] = level;
+2 -2
View File
@@ -829,8 +829,8 @@ bool Device_Write_Property_Local(
case PROP_OBJECT_IDENTIFIER:
if (value.tag == BACNET_APPLICATION_TAG_OBJECT_ID) {
if ((value.type.Object_Id.type == OBJECT_DEVICE) &&
(Device_Set_Object_Instance_Number(value.type.
Object_Id.instance))) {
(Device_Set_Object_Instance_Number(value.type.Object_Id.
instance))) {
/* we could send an I-Am broadcast to let the world know */
status = true;
} else {
+2 -3
View File
@@ -870,10 +870,9 @@ static bool MSTP_Master_Node_FSM(
(Next_Station == This_Station)) {
/* NextStationUnknown - added in Addendum 135-2008v-1 */
/* then the next station to which the token
should be sent is unknown - so PollForMaster */
should be sent is unknown - so PollForMaster */
Poll_Station = next_this_station;
MSTP_Send_Frame(
FRAME_TYPE_POLL_FOR_MASTER, Poll_Station,
MSTP_Send_Frame(FRAME_TYPE_POLL_FOR_MASTER, Poll_Station,
This_Station, NULL, 0);
RetryCount = 0;
Master_State = MSTP_MASTER_STATE_POLL_FOR_MASTER;
+2 -2
View File
@@ -211,8 +211,8 @@ bool Binary_Value_Write_Property(
if ((value.type.Enumerated == BINARY_ACTIVE) ||
(value.type.Enumerated == BINARY_INACTIVE)) {
object_index =
Binary_Value_Instance_To_Index
(wp_data->object_instance);
Binary_Value_Instance_To_Index(wp_data->
object_instance);
/* NOTE: this Binary value has no priority array */
Present_Value[object_index] =
(BACNET_BINARY_PV) value.type.Enumerated;
+2 -2
View File
@@ -380,8 +380,8 @@ bool Device_Write_Property(
case PROP_OBJECT_IDENTIFIER:
if (value.tag == BACNET_APPLICATION_TAG_OBJECT_ID) {
if ((value.type.Object_Id.type == OBJECT_DEVICE) &&
(Device_Set_Object_Instance_Number(value.type.
Object_Id.instance))) {
(Device_Set_Object_Instance_Number(value.type.Object_Id.
instance))) {
/* we could send an I-Am broadcast to let the world know */
status = true;
} else {
+2 -3
View File
@@ -787,10 +787,9 @@ static bool MSTP_Master_Node_FSM(
(Next_Station == This_Station)) {
/* NextStationUnknown - added in Addendum 135-2008v-1 */
/* then the next station to which the token
should be sent is unknown - so PollForMaster */
should be sent is unknown - so PollForMaster */
Poll_Station = next_this_station;
MSTP_Send_Frame(
FRAME_TYPE_POLL_FOR_MASTER, Poll_Station,
MSTP_Send_Frame(FRAME_TYPE_POLL_FOR_MASTER, Poll_Station,
This_Station, NULL, 0);
RetryCount = 0;
Master_State = MSTP_MASTER_STATE_POLL_FOR_MASTER;
+2 -2
View File
@@ -211,8 +211,8 @@ bool Binary_Value_Write_Property(
if ((value.type.Enumerated == BINARY_ACTIVE) ||
(value.type.Enumerated == BINARY_INACTIVE)) {
object_index =
Binary_Value_Instance_To_Index
(wp_data->object_instance);
Binary_Value_Instance_To_Index(wp_data->
object_instance);
/* NOTE: this Binary value has no priority array */
Present_Value[object_index] =
(BACNET_BINARY_PV) value.type.Enumerated;
+19 -19
View File
@@ -61,30 +61,30 @@ ISR(ADC_vect)
uint16_t value = 0;
/* determine which conversion finished */
index = BITMASK_CHECK(ADMUX,((1<<MUX2)|(1<<MUX1)|(1<<MUX0)));
index = BITMASK_CHECK(ADMUX, ((1 << MUX2) | (1 << MUX1) | (1 << MUX0)));
/* read the results */
value = ADCL;
value |= (ADCH << 8);
Sample_Result[index] = value;
__enable_interrupt();
/* clear the mux */
BITMASK_CLEAR(ADMUX, ((1<<MUX2)|(1<<MUX1)|(1<<MUX0)));
BITMASK_CLEAR(ADMUX, ((1 << MUX2) | (1 << MUX1) | (1 << MUX0)));
/* find the next channel */
while (Enabled_Channels) {
index = (index+1)%ADC_CHANNELS_MAX;
if (BIT_CHECK(Enabled_Channels, index)) {
break;
}
index = (index + 1) % ADC_CHANNELS_MAX;
if (BIT_CHECK(Enabled_Channels, index)) {
break;
}
}
/* configure the next channel */
BITMASK_SET(ADMUX, ((index)<<MUX0));
BITMASK_SET(ADMUX, ((index) << MUX0));
/* Start the next conversion */
BIT_SET(ADCSRA, ADSC);
}
void adc_enable(
uint8_t index) /* 0..7 = ADC0..ADC7, respectively */
{
uint8_t index)
{ /* 0..7 = ADC0..ADC7, respectively */
if (Enabled_Channels) {
/* ADC interupt is already started */
BIT_SET(Enabled_Channels, index);
@@ -93,9 +93,9 @@ void adc_enable(
/* not running yet */
BIT_SET(Enabled_Channels, index);
/* clear the mux */
BITMASK_CLEAR(ADMUX, ((1<<MUX2)|(1<<MUX1)|(1<<MUX0)));
BITMASK_CLEAR(ADMUX, ((1 << MUX2) | (1 << MUX1) | (1 << MUX0)));
/* configure the channel */
BITMASK_SET(ADMUX, ((index)<<MUX0));
BITMASK_SET(ADMUX, ((index) << MUX0));
/* Start the next conversion */
BIT_SET(ADCSRA, ADSC);
}
@@ -103,8 +103,8 @@ void adc_enable(
}
uint8_t adc_result_8bit(
uint8_t index) /* 0..7 = ADC0..ADC7, respectively */
{
uint8_t index)
{ /* 0..7 = ADC0..ADC7, respectively */
uint8_t result = 0;
uint8_t sreg;
@@ -112,7 +112,7 @@ uint8_t adc_result_8bit(
adc_enable(index);
sreg = SREG;
__disable_interrupt();
result = (uint8_t)(Sample_Result[index]>>2);
result = (uint8_t) (Sample_Result[index] >> 2);
SREG = sreg;
}
@@ -120,8 +120,8 @@ uint8_t adc_result_8bit(
}
uint16_t adc_result_10bit(
uint8_t index) /* 0..7 = ADC0..ADC7, respectively */
{
uint8_t index)
{ /* 0..7 = ADC0..ADC7, respectively */
uint16_t result = 0;
uint8_t sreg;
@@ -142,7 +142,7 @@ void adc_init(
/* Initial channel selection */
/* ADLAR = Left Adjust Result
REFSx = hardware setup: cap on AREF
*/
*/
ADMUX = (0 << ADLAR) | (0 << REFS1) | (1 << REFS0);
/* ADEN = Enable
ADSC = Start conversion
@@ -150,8 +150,8 @@ void adc_init(
ADIE = Interrupt Enable
ADATE = Auto Trigger Enable
*/
ADCSRA = (1 << ADEN) | (1 << ADIE) |
(1 << ADIF) | (0 << ADATE) | ADPS_10BIT;
ADCSRA =
(1 << ADEN) | (1 << ADIE) | (1 << ADIF) | (0 << ADATE) | ADPS_10BIT;
/* trigger selection bits
0 0 0 Free Running mode
0 0 1 Analog Comparator
+2 -2
View File
@@ -33,9 +33,9 @@ extern "C" {
void adc_enable(
uint8_t index); /* 0..7 = ADC0..ADC7, respectively */
uint8_t adc_result_8bit(
uint8_t index); /* 0..7 = ADC0..ADC7, respectively */
uint8_t index); /* 0..7 = ADC0..ADC7, respectively */
uint16_t adc_result_10bit(
uint8_t index); /* 0..7 = ADC0..ADC7, respectively */
uint8_t index); /* 0..7 = ADC0..ADC7, respectively */
void adc_init(
void);
+3 -3
View File
@@ -199,7 +199,7 @@ BACNET_POLARITY Binary_Output_Polarity(
BACNET_POLARITY polarity = POLARITY_NORMAL;
if (instance < MAX_BINARY_OUTPUTS) {
polarity = (BACNET_POLARITY)Polarity[instance];
polarity = (BACNET_POLARITY) Polarity[instance];
}
return polarity;
@@ -437,8 +437,8 @@ bool Binary_Output_Write_Property(
priority = wp_data->priority;
if (priority && (priority <= BACNET_MAX_PRIORITY)) {
priority--;
Binary_Output_Present_Value_Set
(wp_data->object_instance, level, priority);
Binary_Output_Present_Value_Set(wp_data->
object_instance, level, priority);
} else if (priority == 6) {
status = false;
/* Command priority 6 is reserved for use by Minimum On/Off
+4 -4
View File
@@ -813,8 +813,8 @@ bool Device_Write_Property_Local(
case PROP_OBJECT_IDENTIFIER:
if (value.tag == BACNET_APPLICATION_TAG_OBJECT_ID) {
if ((value.type.Object_Id.type == OBJECT_DEVICE) &&
(Device_Set_Object_Instance_Number(value.type.
Object_Id.instance))) {
(Device_Set_Object_Instance_Number(value.type.Object_Id.
instance))) {
/* we could send an I-Am broadcast to let the world know */
status = true;
} else {
@@ -874,8 +874,8 @@ bool Device_Write_Property_Local(
eeprom_bytes_write(NV_EEPROM_DEVICE_NAME_LENGTH,
&small_length, 1);
pCharString =
characterstring_value(&value.
type.Character_String);
characterstring_value(&value.type.
Character_String);
eeprom_bytes_write(NV_EEPROM_DEVICE_NAME_0,
(uint8_t *) pCharString, length);
status = true;
+2 -3
View File
@@ -892,10 +892,9 @@ static bool MSTP_Master_Node_FSM(
(Next_Station == This_Station)) {
/* NextStationUnknown - added in Addendum 135-2008v-1 */
/* then the next station to which the token
should be sent is unknown - so PollForMaster */
should be sent is unknown - so PollForMaster */
Poll_Station = next_this_station;
MSTP_Send_Frame(
FRAME_TYPE_POLL_FOR_MASTER, Poll_Station,
MSTP_Send_Frame(FRAME_TYPE_POLL_FOR_MASTER, Poll_Station,
This_Station, NULL, 0);
RetryCount = 0;
Master_State = MSTP_MASTER_STATE_POLL_FOR_MASTER;
+1 -1
View File
@@ -98,7 +98,7 @@ void rs485_turnaround_delay(
/* delay after reception before trasmitting - per MS/TP spec */
/* Transmit 4 dummy bytes with RS485 driver off.
This equals the 40 bit times (1 start, 8 data, 1 stop). */
This equals the 40 bit times (1 start, 8 data, 1 stop). */
rs485_rts_enable(false);
while (nbytes) {
/* Send the data byte */
+10 -6
View File
@@ -58,7 +58,8 @@ void test_init(
* Returns: none
* Notes: none
*************************************************************************/
static inline void test_pin_on(void)
static inline void test_pin_on(
void)
{
BIT_SET(PORTB, PB0);
}
@@ -68,7 +69,8 @@ static inline void test_pin_on(void)
* Returns: none
* Notes: none
*************************************************************************/
static inline void test_pin_off(void)
static inline void test_pin_off(
void)
{
BIT_CLEAR(PORTB, PB0);
}
@@ -78,7 +80,8 @@ static inline void test_pin_off(void)
* Returns: true if on, false if off.
* Notes: none
*************************************************************************/
static inline bool test_pin_state(void)
static inline bool test_pin_state(
void)
{
return (BIT_CHECK(PINB, PB0));
}
@@ -88,7 +91,8 @@ static inline bool test_pin_state(void)
* Returns: none
* Notes: none
*************************************************************************/
static inline void test_pin_toggle(void)
static inline void test_pin_toggle(
void)
{
if (test_pin_state()) {
test_pin_off();
@@ -157,11 +161,11 @@ void test_task(
break;
case 'b':
sprintf(Send_Buffer, "\r\n%lubps",
(unsigned long)rs485_baud_rate());
(unsigned long) rs485_baud_rate());
break;
case 'm':
sprintf(Send_Buffer, "\r\nMax:%u",
(unsigned)dlmstp_max_master());
(unsigned) dlmstp_max_master());
break;
default:
break;
+4 -2
View File
@@ -308,7 +308,8 @@ void timer_interval_restart(
* Returns: number of milliseconds elapsed
* Notes: only up to 255ms elapsed
**************************************************************************/
uint8_t timer_milliseconds_delta(uint8_t start)
uint8_t timer_milliseconds_delta(
uint8_t start)
{
return (timer_milliseconds_byte() - start);
}
@@ -318,7 +319,8 @@ uint8_t timer_milliseconds_delta(uint8_t start)
* Returns: mark timer starting tick
* Notes: only up to 255ms elapsed
**************************************************************************/
uint8_t timer_milliseconds_mark(void)
uint8_t timer_milliseconds_mark(
void)
{
return timer_milliseconds_byte();
}
+4 -2
View File
@@ -104,8 +104,10 @@ extern "C" {
struct itimer *t);
/* special for 8-bit microcontrollers - limited to 255ms */
uint8_t timer_milliseconds_delta(uint8_t start);
uint8_t timer_milliseconds_mark(void);
uint8_t timer_milliseconds_delta(
uint8_t start);
uint8_t timer_milliseconds_mark(
void);
#ifdef __cplusplus
}
+3 -2
View File
@@ -66,7 +66,8 @@ ISR(TIMER2_OVF_vect);
* Returns: nothing
* Notes: none
*************************************************************************/
static inline void timer_interrupt_handler(void)
static inline void timer_interrupt_handler(
void)
{
/* Set the counter for the next interrupt */
TCNT2 = TIMER2_COUNT;
@@ -92,7 +93,7 @@ ISR(TIMER2_OVF_vect)
uint32_t timer_milliseconds(
void)
{
uint32_t timer_value; /* return value */
uint32_t timer_value; /* return value */
/* Disable the overflow interrupt.
Prevents value corruption that would happen if interrupted */
+2 -3
View File
@@ -888,10 +888,9 @@ static bool MSTP_Master_Node_FSM(
(Next_Station == This_Station)) {
/* NextStationUnknown - added in Addendum 135-2008v-1 */
/* then the next station to which the token
should be sent is unknown - so PollForMaster */
should be sent is unknown - so PollForMaster */
Poll_Station = next_this_station;
MSTP_Send_Frame(
FRAME_TYPE_POLL_FOR_MASTER, Poll_Station,
MSTP_Send_Frame(FRAME_TYPE_POLL_FOR_MASTER, Poll_Station,
This_Station, NULL, 0);
RetryCount = 0;
Master_State = MSTP_MASTER_STATE_POLL_FOR_MASTER;
+2 -2
View File
@@ -325,8 +325,8 @@ bool Analog_Value_Write_Property(
(value.type.Real >= 0.0) && (value.type.Real <= 100.0)) {
level = (uint8_t) value.type.Real;
object_index =
Analog_Value_Instance_To_Index
(wp_data->object_instance);
Analog_Value_Instance_To_Index(wp_data->
object_instance);
priority--;
Present_Value[object_index] = level;
/* Note: you could set the physical output here if we
+2 -2
View File
@@ -237,8 +237,8 @@ bool Binary_Value_Write_Property(
(value.type.Enumerated <= MAX_BINARY_PV)) {
level = value.type.Enumerated;
object_index =
Binary_Value_Instance_To_Index
(wp_data->object_instance);
Binary_Value_Instance_To_Index(wp_data->
object_instance);
priority--;
/* NOTE: this Binary value has no priority array */
Present_Value[object_index] = level;
+2 -2
View File
@@ -510,8 +510,8 @@ bool Device_Write_Property(
case PROP_OBJECT_IDENTIFIER:
if (value.tag == BACNET_APPLICATION_TAG_OBJECT_ID) {
if ((value.type.Object_Id.type == OBJECT_DEVICE) &&
(Device_Set_Object_Instance_Number(value.type.
Object_Id.instance))) {
(Device_Set_Object_Instance_Number(value.type.Object_Id.
instance))) {
/* we could send an I-Am broadcast to let the world know */
status = true;
} else {
+2 -3
View File
@@ -803,10 +803,9 @@ bool MSTP_Master_Node_FSM(
(Next_Station == This_Station)) {
/* NextStationUnknown - added in Addendum 135-2008v-1 */
/* then the next station to which the token
should be sent is unknown - so PollForMaster */
should be sent is unknown - so PollForMaster */
Poll_Station = next_this_station;
MSTP_Send_Frame(
FRAME_TYPE_POLL_FOR_MASTER, Poll_Station,
MSTP_Send_Frame(FRAME_TYPE_POLL_FOR_MASTER, Poll_Station,
This_Station, NULL, 0);
RetryCount = 0;
Master_State = MSTP_MASTER_STATE_POLL_FOR_MASTER;
+11 -20
View File
@@ -259,25 +259,16 @@ bool bip_init(
bip_set_addr(my_addr.s_addr);
set_broadcast_address(my_addr.s_addr);
bip_set_port(htons((0xBAC0));
/* assumes that the driver has already been initialized */
sock_fd = socket(AF_INET, SOCK_DGRAM, IPROTO_UDP);
bip_set_socket(sock_fd);
if (sock_fd < 0)
/* assumes that the driver has already been initialized */
sock_fd = socket(AF_INET, SOCK_DGRAM, IPROTO_UDP);
bip_set_socket(sock_fd); if (sock_fd < 0)
return false;
/* bind the socket to the local port number and IP address */
sin.sin_family = AF_INET; sin.sin_addr.s_addr = htonl(INADDR_ANY);
sin.sin_port = bip_get_port(); memset(&(sin.sin_zero), '\0', 8);
rv =
bind(sock_fd, (const struct sockaddr *) &sin, sizeof(struct sockaddr));
if (rv < 0) {
close(sock_fd); bip_set_socket(-1); return false;}
/* bind the socket to the local port number and IP address */
sin.sin_family = AF_INET;
sin.sin_addr.s_addr = htonl(INADDR_ANY);
sin.sin_port = bip_get_port();
memset(&(sin.sin_zero), '\0', 8);
rv = bind(sock_fd, (const struct sockaddr *) &sin,
sizeof(struct sockaddr));
if (rv < 0) {
close(sock_fd);
bip_set_socket(-1);
return false;
}
return true;
}
return true;}
+1 -1
View File
@@ -942,7 +942,7 @@ bool MSTP_Master_Node_FSM(
(mstp_port->Next_Station == mstp_port->This_Station)) {
/* NextStationUnknown - added in Addendum 135-2008v-1 */
/* then the next station to which the token
should be sent is unknown - so PollForMaster */
should be sent is unknown - so PollForMaster */
mstp_port->Poll_Station = next_this_station;
MSTP_Create_And_Send_Frame(mstp_port,
FRAME_TYPE_POLL_FOR_MASTER, mstp_port->Poll_Station,