aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSelene ToyKeeper2017-03-26 15:18:03 -0600
committerSelene ToyKeeper2017-03-26 15:18:03 -0600
commit651b2c8bdc72364f7602db356f21d2a061f82ebf (patch)
tree07667e2b1b834db0c6db847aa156b3d83513b801
parentMade tk-delay.h allow use of both _delay_ms() and _delay_4ms(). (diff)
downloadanduril-651b2c8bdc72364f7602db356f21d2a061f82ebf.tar.gz
anduril-651b2c8bdc72364f7602db356f21d2a061f82ebf.tar.bz2
anduril-651b2c8bdc72364f7602db356f21d2a061f82ebf.zip
Fixed a compiler warning about tk-random.h.
-rw-r--r--tk-random.h5
1 files changed, 4 insertions, 1 deletions
diff --git a/tk-random.h b/tk-random.h
index d559659..b2ff296 100644
--- a/tk-random.h
+++ b/tk-random.h
@@ -22,7 +22,10 @@
uint8_t pgm_rand() {
static uint16_t offset = 255;
- offset = (offset + 1) & 0x3ff | 0x0100;
+ // loop through ROM space, but avoid the first 256 bytes
+ // because the beginning tends to have a big ramp which
+ // doesn't look very random at all
+ offset = ((offset + 1) & 0x3ff) | 0x0100;
return pgm_read_byte(offset);
}