Skip to content

Commit

Permalink
Correct some situations where checks may have always evaluated true a…
Browse files Browse the repository at this point in the history
…nd add a lakefile (using Steve Donovan's Lake: http://github.com/stevedonovan/Lake)
  • Loading branch information
jsnyder committed Oct 26, 2010
1 parent a2b033c commit 87df2d7
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 4 deletions.
9 changes: 9 additions & 0 deletions lakefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
sources = 'main,stm32ld'

if WINDOWS then
sources = sources..",serial_win32"
else
sources = sources..",serial_posix"
end

c.program{'stm32ld', src=sources}
10 changes: 6 additions & 4 deletions stm32ld.c
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,8 @@ int stm32_init( const char *portname, u32 baud )
// Expected response: ACK version OPTION1 OPTION2 ACK
int stm32_get_version( u8 *major, u8 *minor )
{
u8 temp, total, i, version;
u8 i, version;
int temp, total;
int tries = STM32_RETRY_COUNT;

STM32_CHECK_INIT;
Expand All @@ -111,7 +112,7 @@ int stm32_get_version( u8 *major, u8 *minor )
{
STM32_READ_AND_CHECK( temp );
if( i == 0 )
version = temp;
version = ( u8 )temp;
}
*major = version >> 4;
*minor = version & 0x0F;
Expand All @@ -122,7 +123,8 @@ int stm32_get_version( u8 *major, u8 *minor )
// Get chip ID
int stm32_get_chip_id( u16 *version )
{
u8 temp, vh, vl;
u8 temp;
int vh, vl;

STM32_CHECK_INIT;
stm32h_send_command( STM32_CMD_GET_ID );
Expand All @@ -131,7 +133,7 @@ int stm32_get_chip_id( u16 *version )
STM32_READ_AND_CHECK( vh );
STM32_READ_AND_CHECK( vl );
STM32_EXPECT( STM32_COMM_ACK );
*version = ( ( u16 )vh << 8 ) | vl;
*version = ( ( u16 )vh << 8 ) | ( u16 )vl;
return STM32_OK;
}

Expand Down

0 comments on commit 87df2d7

Please sign in to comment.