aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKing Kévin <kingkevin@cuvoodoo.info>2020-10-07 13:19:42 +0200
committerKing Kévin <kingkevin@cuvoodoo.info>2020-10-07 13:19:42 +0200
commit157a8ee41fad778a17233d7029c7632493c2185f (patch)
treed0582b9c06a85de79d883934772bfad12ceaaea8
parentc245295cc3dffcadcd48bb00a9b567af1347c6f6 (diff)
replace % with & to save space require to compile with newer SDCC
-rw-r--r--pic/318LPW1K-L/318LPW1K-L.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/pic/318LPW1K-L/318LPW1K-L.c b/pic/318LPW1K-L/318LPW1K-L.c
index 58698fb..464b3ed 100644
--- a/pic/318LPW1K-L/318LPW1K-L.c
+++ b/pic/318LPW1K-L/318LPW1K-L.c
@@ -82,15 +82,15 @@ uint8_t read_eeprom(uint8_t address) {
/* transmit the megacode */
void megacode (void) {
static uint8_t byte;
- uint8_t bit = phase/4;
+ uint8_t bit = phase / 4;
if (transmit != 0) {
- if (bit%8==0) { // read byte to transmit
- byte = read_eeprom(bit/8);
+ if (bit & 0x7 == 0) { // read byte to transmit
+ byte = read_eeprom(bit / 8);
}
- if (bit<24) { // transmit bit
- if (phase%2) {
- uint8_t pulse = (byte>>((23-bit)%8))&0x01;
- if ((phase%4==1 && !pulse) || (phase%4==3 && pulse)) {
+ if (bit < 24) { // transmit bit
+ if (phase & 0x1) {
+ uint8_t pulse = (byte >> ((23 - bit) & 0x7)) & 0x01;
+ if ((phase & 0x3 == 1 && !pulse) || (phase & 0x3 == 3 && pulse)) {
led_off();
tx_on();
}