Navigation Menu

Skip to content

Commit

Permalink
Fixed compiler warning in certain configurations. Further cleanup in …
Browse files Browse the repository at this point in the history
…the 1W code.
  • Loading branch information
sauttefk committed May 23, 2011
1 parent 3f849be commit b6deb1d
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 11 deletions.
8 changes: 5 additions & 3 deletions hardware/onewire/ecmd.c
Expand Up @@ -77,7 +77,7 @@ int16_t parse_cmd_onewire_list(char *cmd, char *output, uint16_t len)

if (ow_global.lock == 0) {
firstonbus = 1;
#ifdef ONEWIRE_MULTIBUS
#if ONEWIRE_COUNT > 1
ow_global.bus = 0;
#endif
#ifdef DEBUG_ECMD_OW_LIST
Expand Down Expand Up @@ -109,13 +109,15 @@ int16_t parse_cmd_onewire_list(char *cmd, char *output, uint16_t len)
firstonbus = 0;
}

#if defined ONEWIRE_DS2502_SUPPORT || ONEWIRE_COUNT > 1
list_next: ;
#endif

/* disable interrupts */
uint8_t sreg = SREG;
cli();

#ifdef ONEWIRE_MULTIBUS
#if ONEWIRE_COUNT > 1
ret = ow_search_rom((uint8_t)(1 << (ow_global.bus + ONEWIRE_STARTPIN)), firstonbus);
#else
ret = ow_search_rom(ONEWIRE_BUSMASK, firstonbus);
Expand Down Expand Up @@ -183,7 +185,7 @@ list_next: ;
#endif
}

#ifdef ONEWIRE_MULTIBUS
#if ONEWIRE_COUNT > 1
#ifdef DEBUG_ECMD_OW_LIST
if (ret != 0) {
debug_printf("no devices on bus %d\n", ow_global.bus);
Expand Down
10 changes: 5 additions & 5 deletions hardware/onewire/onewire.c
Expand Up @@ -166,7 +166,7 @@ uint8_t noinline ow_read_byte(uint8_t busmask)
int8_t noinline ow_read_rom(struct ow_rom_code_t *rom)
{

#ifdef ONEWIRE_MULTIBUS
#if ONEWIRE_COUNT > 1
uint8_t busmask = 1 << (ONEWIRE_STARTPIN); // FIXME: currently only on 1st bus
#else
uint8_t busmask = ONEWIRE_BUSMASK;
Expand Down Expand Up @@ -411,7 +411,7 @@ int8_t ow_temp_read_scratchpad(struct ow_rom_code_t *rom, struct ow_temp_scratch
/* transmit command byte */
ow_write_byte(ONEWIRE_BUSMASK, OW_FUNC_READ_SP);

#ifdef ONEWIRE_MULTIBUS
#if ONEWIRE_COUNT > 1
for (uint8_t bus = 0; bus < ONEWIRE_COUNT; bus++) {
/* read 9 bytes from each onewire bus */
busmask = (uint8_t)(1 << (bus + ONEWIRE_STARTPIN));
Expand All @@ -427,7 +427,7 @@ int8_t ow_temp_read_scratchpad(struct ow_rom_code_t *rom, struct ow_temp_scratch
/* return if we got a valid response from one device */
return 1;
}
#ifdef ONEWIRE_MULTIBUS
#if ONEWIRE_COUNT > 1
}
#endif

Expand All @@ -438,7 +438,7 @@ int8_t ow_temp_read_scratchpad(struct ow_rom_code_t *rom, struct ow_temp_scratch
int8_t ow_temp_power(struct ow_rom_code_t *rom)
{

#ifdef ONEWIRE_MULTIBUS
#if ONEWIRE_COUNT > 1
uint8_t busmask = 1 << (ONEWIRE_STARTPIN); // FIXME: currently only on 1st bus
#else
uint8_t busmask = ONEWIRE_BUSMASK;
Expand Down Expand Up @@ -497,7 +497,7 @@ int8_t ow_eeprom(struct ow_rom_code_t *rom)

int8_t ow_eeprom_read(struct ow_rom_code_t *rom, void *data)
{
#ifdef ONEWIRE_MULTIBUS
#if ONEWIRE_COUNT > 1
uint8_t busmask = 1 << (ONEWIRE_STARTPIN); // FIXME: currently only on 1st bus
#else
uint8_t busmask = ONEWIRE_BUSMASK;
Expand Down
2 changes: 1 addition & 1 deletion hardware/onewire/onewire.h
Expand Up @@ -189,7 +189,7 @@ struct ow_global_t {
int8_t list_type;
#endif
struct ow_rom_code_t current_rom;
#ifdef ONEWIRE_MULTIBUS
#if ONEWIRE_COUNT > 1
uint8_t bus;
#endif
};
Expand Down
4 changes: 4 additions & 0 deletions pinning/hardware/netio.m4
Expand Up @@ -38,6 +38,10 @@ ifdef(`conf_STATUSLED_RX', `dnl
pin(STATUSLED_RX, PA0, OUTPUT)
')dnl

ifdef(`conf_STATUSLED_HB_ACT', `dnl
pin(STATUSLED_HB_ACT, PA0, OUTPUT)
')dnl

ifdef(`conf_FS20', `dnl
/* fs20 support */
pin(FS20_SEND, PD7)
Expand Down
3 changes: 1 addition & 2 deletions pinning/internals/header.m4
Expand Up @@ -205,13 +205,12 @@ define(`ddr_mask_'pinname, eval(DM(pinname) | (1 << itr)))

')dnl

#define ONEWIRE_COUNT eval(stop-start+1)
#define ONEWIRE_COUNT eval(stop - start + 1)
#define ONEWIRE_STARTPIN start
#define ONEWIRE_PORT format(PORT%s, pinname)
#define ONEWIRE_DDR format(DDR%s, pinname)
#define ONEWIRE_PIN format(PIN%s, pinname)
#define ONEWIRE_BUSMASK eval(((1 << eval(stop-start+1)) - 1) << start)U
#define ONEWIRE_MULTIBUS 1

')

Expand Down

0 comments on commit b6deb1d

Please sign in to comment.