/*
+Note to self: adapted from ergodox EZ matrix
+The "column" and "row" in here actually refers to the opposite on the keyboard
+see definition of KEYMAP in v1.h, the grid is transposed so that a "row" in here is actually a "column" on the physical keyboard
+Nicolas
+
Note for ErgoDox EZ customizers: Here be dragons!
This is not a file you want to be messing with.
All of the interesting stuff for you is under keymaps/ :)
Love, Erez
-Note to self, the "column" and "row" in here actually refers to the opposite on the keyboard
-see definition of KEYMAP in v1.h, the grid is transposed so that a "row" in here is actually a "column" on the physical keyboard
-Nicolas
-
Copyright 2013 Oleg Kostyuk <cub.uanic@gmail.com>
+Copyright 2013 Nicolas Poirey <nicolas.poirey@gmail.com>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
#include "util.h"
#include "matrix.h"
#include "frenchdev.h"
-#include "i2cmaster.h"
#ifdef DEBUG_MATRIX_SCAN_RATE
#include "timer.h"
#endif
print("left side not responding\n");
} else {
print("left side attached\n");
- ergodox_blink_all_leds();
+ frenchdev_blink_all_leds();
}
}
}
return 0;
} else {
uint8_t data = 0;
- mcp23018_status = i2c_start(I2C_ADDR_WRITE); if (mcp23018_status) goto out;
- mcp23018_status = i2c_write(GPIOB); if (mcp23018_status) goto out;
- mcp23018_status = i2c_start(I2C_ADDR_READ); if (mcp23018_status) goto out;
- data = i2c_readNak();
- data = ~data;
+ mcp23018_status = i2c_start(I2C_ADDR_WRITE, I2C_TIMEOUT); if (mcp23018_status) goto out;
+ mcp23018_status = i2c_write(GPIOB, I2C_TIMEOUT); if (mcp23018_status) goto out;
+ mcp23018_status = i2c_start(I2C_ADDR_READ, I2C_TIMEOUT); if (mcp23018_status) goto out;
+ data = i2c_read_nack(I2C_TIMEOUT); if (mcp23018_status < 0) goto out;
+ data = ~((uint8_t)mcp23018_status);
+ mcp23018_status = I2C_STATUS_SUCCESS;
out:
i2c_stop();
return data;
// do nothing
} else {
// set all rows hi-Z : 1
- mcp23018_status = i2c_start(I2C_ADDR_WRITE); if (mcp23018_status) goto out;
- mcp23018_status = i2c_write(GPIOA); if (mcp23018_status) goto out;
- mcp23018_status = i2c_write( 0xFF
- & ~(0<<8)
- ); if (mcp23018_status) goto out;
+ mcp23018_status = i2c_start(I2C_ADDR_WRITE, I2C_TIMEOUT); if (mcp23018_status) goto out;
+ mcp23018_status = i2c_write(GPIOA, I2C_TIMEOUT); if (mcp23018_status) goto out;
+ mcp23018_status = i2c_write( 0xFF & ~(0<<8), I2C_TIMEOUT); if (mcp23018_status) goto out;
out:
i2c_stop();
}
} else {
// set active row low : 0
// set other rows hi-Z : 1
- mcp23018_status = i2c_start(I2C_ADDR_WRITE); if (mcp23018_status) goto out;
- mcp23018_status = i2c_write(GPIOA); if (mcp23018_status) goto out;
- mcp23018_status = i2c_write( 0xFF & ~(1<<row)
- & ~(0<<8)
- ); if (mcp23018_status) goto out;
+ mcp23018_status = i2c_start(I2C_ADDR_WRITE, I2C_TIMEOUT); if (mcp23018_status) goto out;
+ mcp23018_status = i2c_write(GPIOA, I2C_TIMEOUT); if (mcp23018_status) goto out;
+ mcp23018_status = i2c_write( 0xFF & ~(1<<row) & ~(0<<8), I2C_TIMEOUT); if (mcp23018_status) goto out;
out:
i2c_stop();
}
}
}
}
-