Skip to content
This repository has been archived by the owner on Aug 21, 2024. It is now read-only.

Commit

Permalink
fix a warning:
Browse files Browse the repository at this point in the history
src/ds1302.c:123: warning 158: overflow in implicit constant conversion
  • Loading branch information
orzel committed Feb 3, 2022
1 parent beb3b51 commit 3579dc2
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/ds1302.c
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ uint8_t ds_readbyte(uint8_t addr) {
void ds_readburst() {
// ds1302 burst-read 8 bytes into struct
uint8_t j, b;
b = DS_CMD | DS_CMD_CLOCK | DS_BURST_MODE << 1 | DS_CMD_READ;
b = DS_CMD | DS_CMD_CLOCK | (DS_BURST_MODE << 1) | DS_CMD_READ;
DS_CE = 0;
DS_SCLK = 0;
DS_CE = 1;
Expand Down
8 changes: 4 additions & 4 deletions src/ds1302.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@

#define _nop_ __asm nop __endasm;

#define DS_CMD 1 << 7
#define DS_CMD_READ 1
#define DS_CMD (1u << 7)
#define DS_CMD_READ 1u
#define DS_CMD_WRITE 0
#define DS_CMD_RAM 1 << 6
#define DS_CMD_CLOCK 0 << 6
#define DS_CMD_CLOCK (0u << 6)

#define DS_ADDR_SECONDS 0
#define DS_ADDR_MINUTES 1
Expand All @@ -34,7 +34,7 @@
#define DS_TC_D2_4KO 0b1010
#define DS_TC_D2_8KO 0b1011

#define DS_BURST_MODE 31
#define DS_BURST_MODE 31u

// DS_ADDR_SECONDS c111_1111 0_0-5_9 c=clock_halt
// DS_ADDR_MINUTES x111_1111 0_0-5_9
Expand Down

0 comments on commit 3579dc2

Please sign in to comment.