Compare commits

...
Author SHA1 Message Date
Jack Humbert ec0f9db8ad separate commands, m/s updates 2018-06-12 19:24:40 -04:00
Jack Humbert 8c36c83a84 try more stuff 2018-06-12 10:58:32 -04:00
Jack Humbert cca90f4389 non working code 2018-06-11 13:47:38 -04:00
5 changed files with 346 additions and 188 deletions
+25 -10
View File
@@ -75,11 +75,6 @@ void twi2c_catch_error(I2CDriver *i2cp)
/**
* Callback after sending of response complete - restores default reply in case polled
*/
void twi2c_clear_after_send(I2CDriver *i2cp)
{
// echoReply.size = 0; // Clear receive message
// i2cSlaveReplyI(i2cp, &initialReply);
}
uint8_t twi2c_start(void) {
i2cStart(&I2C_DRIVER, &i2cconfig);
@@ -100,11 +95,11 @@ void twi2c_init(void) {
}
uint8_t twi2c_write(uint8_t data) {
return i2cMasterTransmitTimeout(&I2C_DRIVER, twi2c_address/2, &data, 1, 0, 0, MS2ST(100));
return i2cMasterTransmitTimeout(&I2C_DRIVER, twi2c_address/2, &data, 1, NULL, 0, MS2ST(100));
}
uint8_t twi2c_transmit(uint8_t address, uint8_t * data, uint16_t length) {
return i2cMasterTransmitTimeout(&I2C_DRIVER, address/2, data, length, 0, 0, MS2ST(100));
return i2cMasterTransmitTimeout(&I2C_DRIVER, address/2, data, length, NULL, 0, MS2ST(100));
}
uint8_t twi2c_receive(uint8_t address, uint8_t * data, uint16_t length) {
@@ -112,8 +107,8 @@ uint8_t twi2c_receive(uint8_t address, uint8_t * data, uint16_t length) {
}
uint8_t twi2c_incoming_body[50];
uint8_t twi2c_outgoing_body[1024];
uint8_t twi2c_incoming_body[50] = {0};
uint8_t twi2c_outgoing_body[1024] = {0};
// Response to received messages
I2CSlaveMsg twi2c_incoming_message = {
@@ -138,6 +133,11 @@ I2CSlaveMsg twi2c_outgoing_message = {
twi2c_catch_error
};
void twi2c_clear_after_send(I2CDriver *i2cp) {
twi2c_outgoing_message.size = 0; // Clear receive message
//i2cSlaveReplyI(i2cp, &initialReply);
}
uint8_t twi2c_reply(I2CDriver * i2cp, uint8_t * data, uint16_t length) {
memcpy(twi2c_outgoing_body, data, length);
twi2c_outgoing_message.size = length;
@@ -157,11 +157,26 @@ uint8_t twi2c_start_listening(uint8_t address, twi2c_message_received callback)
return 0;
}
uint8_t twi2c_restart_listening(uint8_t address) {
uint8_t twi2c_remove_listening(uint8_t address) {
i2cUnmatchAddress(&I2C_DRIVER, address/2);
return 0;
}
uint8_t twi2c_add_listening(uint8_t address) {
i2cMatchAddress(&I2C_DRIVER, address/2);
return 0;
}
uint8_t twi2c_remove_listening_i(uint8_t address) {
i2cUnmatchAddressI(&I2C_DRIVER, address/2);
return 0;
}
uint8_t twi2c_add_listening_i(uint8_t address) {
i2cMatchAddressI(&I2C_DRIVER, address/2);
return 0;
}
void twi2c_stop(void) {
i2cUnmatchAll(&I2C_DRIVER);
i2cStop(&I2C_DRIVER);
+4 -1
View File
@@ -43,6 +43,9 @@ void twi2c_stop(void);
uint8_t twi2c_reply(I2CDriver * i2cp, uint8_t * data, uint16_t length);
uint8_t twi2c_transmit_receive(uint8_t address, uint8_t * tx_body, uint16_t tx_length, uint8_t * rx_body, uint16_t rx_length);
uint8_t twi2c_start_listening(uint8_t address, twi2c_message_received callback);
uint8_t twi2c_restart_listening(uint8_t address);
uint8_t twi2c_add_listening(uint8_t address);
uint8_t twi2c_remove_listening(uint8_t address);
uint8_t twi2c_add_listening_i(uint8_t address);
uint8_t twi2c_remove_listening_i(uint8_t address);
#endif
File diff suppressed because it is too large Load Diff
+3 -3
View File
@@ -141,11 +141,11 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
// 0b1110111 AD <-> VCC
// 0b1110101 AD <-> SCL
// 0b1110110 AD <-> SDA
#define DRIVER_ADDR_1 0b1110100
#define DRIVER_ADDR_2 0b1110110
#define DRIVER_ADDR_1 0b1110111
#define DRIVER_ADDR_2 0b1110101
#define DRIVER_COUNT 2
#define DRIVER_1_LED_TOTAL 25
#define DRIVER_1_LED_TOTAL 24
#define DRIVER_2_LED_TOTAL 24
#define DRIVER_LED_TOTAL DRIVER_1_LED_TOTAL + DRIVER_2_LED_TOTAL
+112 -62
View File
@@ -43,73 +43,123 @@ const uint8_t music_map[MATRIX_ROWS][MATRIX_COLS] = LAYOUT_ortho_4x6(
0, 1, 2, 3, 4, 5
);
// const is31_led g_is31_leds[DRIVER_LED_TOTAL] = {
// /* Refer to IS31 manual for these locations
// * driver
// * | R location
// * | | G location
// * | | | B location
// * | | | | */
// {0, C1_3, C2_3, C3_3},
// {0, C1_4, C2_4, C3_4},
// {0, C1_5, C2_5, C3_5},
// {0, C1_11, C2_11, C3_11},
// {0, C1_12, C2_12, C3_12},
// {0, C1_13, C2_13, C3_13},
#ifdef RGB_MATRIX_ENABLE
const is31_led g_is31_leds[DRIVER_LED_TOTAL] = {
/* Refer to IS31 manual for these locations
* driver
* | R location
* | | G location
* | | | B location
* | | | | */
{0, C1_3, C2_3, C3_3},
{0, C1_4, C2_4, C3_4},
{0, C1_5, C2_5, C3_5},
{0, C1_11, C2_11, C3_11},
{0, C1_12, C2_12, C3_12},
{0, C1_13, C2_13, C3_13},
{1, C1_3, C2_3, C3_3},
{1, C1_4, C2_4, C3_4},
{1, C1_5, C2_5, C3_5},
{1, C1_11, C2_11, C3_11},
{1, C1_12, C2_12, C3_12},
{1, C1_13, C2_13, C3_13},
// {0, C1_6, C2_6, C3_6},
// {0, C1_7, C2_7, C3_7},
// {0, C1_8, C2_8, C3_8},
// {0, C1_14, C2_14, C3_14},
// {0, C1_15, C2_15, C3_15},
// {0, C1_16, C2_16, C3_16},
{0, C1_6, C2_6, C3_6},
{0, C1_7, C2_7, C3_7},
{0, C1_8, C2_8, C3_8},
{0, C1_14, C2_14, C3_14},
{0, C1_15, C2_15, C3_15},
{0, C1_16, C2_16, C3_16},
{1, C1_6, C2_6, C3_6},
{1, C1_7, C2_7, C3_7},
{1, C1_8, C2_8, C3_8},
{1, C1_14, C2_14, C3_14},
{1, C1_15, C2_15, C3_15},
{1, C1_16, C2_16, C3_16},
// {0, C9_1, C8_1, C7_1},
// {0, C9_2, C8_2, C7_2},
// {0, C9_3, C8_3, C7_3},
// {0, C9_9, C8_9, C7_9},
// {0, C9_10, C8_10, C7_10},
// {0, C9_11, C8_11, C7_11},
{0, C9_1, C8_1, C7_1},
{0, C9_2, C8_2, C7_2},
{0, C9_3, C8_3, C7_3},
{0, C9_9, C8_9, C7_9},
{0, C9_10, C8_10, C7_10},
{0, C9_11, C8_11, C7_11},
{1, C9_1, C8_1, C7_1},
{1, C9_2, C8_2, C7_2},
{1, C9_3, C8_3, C7_3},
{1, C9_9, C8_9, C7_9},
{1, C9_10, C8_10, C7_10},
{1, C9_11, C8_11, C7_11},
// {0, C9_4, C8_4, C7_4},
// {0, C9_5, C8_5, C7_5},
// {0, C9_6, C8_6, C7_6},
// {0, C9_12, C8_12, C7_12},
// {0, C9_13, C8_13, C7_13},
// {0, C9_14, C8_14, C7_14}
// };
{0, C9_4, C8_4, C7_4},
{0, C9_5, C8_5, C7_5},
{0, C9_6, C8_6, C7_6},
{0, C9_12, C8_12, C7_12},
{0, C9_13, C8_13, C7_13},
{0, C9_14, C8_14, C7_14},
{1, C9_4, C8_4, C7_4},
{1, C9_5, C8_5, C7_5},
{1, C9_6, C8_6, C7_6},
{1, C9_12, C8_12, C7_12},
{1, C9_13, C8_13, C7_13},
{1, C9_14, C8_14, C7_14}
};
// const rgb_led g_rgb_leds[DRIVER_LED_TOTAL] = {
const rgb_led g_rgb_leds[DRIVER_LED_TOTAL] = {
// {row | col << 4}
// | {x=0..224, y=0..64}
// | | modifier
// | | |
// {{0|(0<<4)}, {20.36*0, 21.33*0}, 1},
// {{0|(1<<4)}, {20.36*1, 21.33*0}, 0},
// {{0|(2<<4)}, {20.36*2, 21.33*0}, 0},
// {{0|(3<<4)}, {20.36*3, 21.33*0}, 0},
// {{0|(4<<4)}, {20.36*4, 21.33*0}, 0},
// {{0|(5<<4)}, {20.36*5, 21.33*0}, 0},
/*{row | col << 4}
| {x=0..224, y=0..64}
| | modifier
| | | */
{{0|(0<<4)}, {20.36*0, 21.33*0}, 1},
{{0|(1<<4)}, {20.36*1, 21.33*0}, 0},
{{0|(2<<4)}, {20.36*2, 21.33*0}, 0},
{{0|(3<<4)}, {20.36*3, 21.33*0}, 0},
{{0|(4<<4)}, {20.36*4, 21.33*0}, 0},
{{0|(5<<4)}, {20.36*5, 21.33*0}, 0},
{{0|(6<<4)}, {20.36*6, 21.33*0}, 0},
{{0|(7<<4)}, {20.36*7, 21.33*0}, 0},
{{0|(8<<4)}, {20.36*8, 21.33*0}, 0},
{{0|(9<<4)}, {20.36*9, 21.33*0}, 0},
{{0|(10<<4)}, {20.36*10,21.33*0}, 0},
{{0|(11<<4)}, {20.36*11,21.33*0}, 1},
// {{1|(0<<4)}, {20.36*0, 21.33*1}, 1},
// {{1|(1<<4)}, {20.36*1, 21.33*1}, 0},
// {{1|(2<<4)}, {20.36*2, 21.33*1}, 0},
// {{1|(3<<4)}, {20.36*3, 21.33*1}, 0},
// {{1|(4<<4)}, {20.36*4, 21.33*1}, 0},
// {{1|(5<<4)}, {20.36*5, 21.33*1}, 0},
{{1|(0<<4)}, {20.36*0, 21.33*1}, 1},
{{1|(1<<4)}, {20.36*1, 21.33*1}, 0},
{{1|(2<<4)}, {20.36*2, 21.33*1}, 0},
{{1|(3<<4)}, {20.36*3, 21.33*1}, 0},
{{1|(4<<4)}, {20.36*4, 21.33*1}, 0},
{{1|(5<<4)}, {20.36*5, 21.33*1}, 0},
{{1|(6<<4)}, {20.36*6, 21.33*1}, 0},
{{1|(7<<4)}, {20.36*7, 21.33*1}, 0},
{{1|(8<<4)}, {20.36*8, 21.33*1}, 0},
{{1|(9<<4)}, {20.36*9, 21.33*1}, 0},
{{1|(10<<4)}, {20.36*10,21.33*1}, 0},
{{1|(11<<4)}, {20.36*11,21.33*1}, 1},
// {{2|(0<<4)}, {20.36*0, 21.33*2}, 1},
// {{2|(1<<4)}, {20.36*1, 21.33*2}, 0},
// {{2|(2<<4)}, {20.36*2, 21.33*2}, 0},
// {{2|(3<<4)}, {20.36*3, 21.33*2}, 0},
// {{2|(4<<4)}, {20.36*4, 21.33*2}, 0},
// {{2|(5<<4)}, {20.36*5, 21.33*2}, 0},
{{2|(0<<4)}, {20.36*0, 21.33*2}, 1},
{{2|(1<<4)}, {20.36*1, 21.33*2}, 0},
{{2|(2<<4)}, {20.36*2, 21.33*2}, 0},
{{2|(3<<4)}, {20.36*3, 21.33*2}, 0},
{{2|(4<<4)}, {20.36*4, 21.33*2}, 0},
{{2|(5<<4)}, {20.36*5, 21.33*2}, 0},
{{2|(6<<4)}, {20.36*6, 21.33*2}, 0},
{{2|(7<<4)}, {20.36*7, 21.33*2}, 0},
{{2|(8<<4)}, {20.36*8, 21.33*2}, 0},
{{2|(9<<4)}, {20.36*9, 21.33*2}, 0},
{{2|(10<<4)}, {20.36*10,21.33*2}, 0},
{{2|(11<<4)}, {20.36*11,21.33*2}, 1},
// {{3|(0<<4)}, {20.36*0, 21.33*3}, 1},
// {{3|(1<<4)}, {20.36*1, 21.33*3}, 1},
// {{3|(2<<4)}, {20.36*2, 21.33*3}, 1},
// {{3|(3<<4)}, {20.36*3, 21.33*3}, 1},
// {{3|(4<<4)}, {20.36*4, 21.33*3}, 1},
// {{3|(5<<4)}, {20.36*5, 21.33*3}, 0}
// };
{{3|(0<<4)}, {20.36*0, 21.33*3}, 1},
{{3|(1<<4)}, {20.36*1, 21.33*3}, 1},
{{3|(2<<4)}, {20.36*2, 21.33*3}, 1},
{{3|(3<<4)}, {20.36*3, 21.33*3}, 1},
{{3|(4<<4)}, {20.36*4, 21.33*3}, 1},
{{3|(5<<4)}, {20.36*5, 21.33*3}, 0},
{{3|(6<<4)}, {20.36*6, 21.33*3}, 0},
{{3|(7<<4)}, {20.36*7, 21.33*3}, 1},
{{3|(8<<4)}, {20.36*8, 21.33*3}, 1},
{{3|(9<<4)}, {20.36*9, 21.33*3}, 1},
{{3|(10<<4)}, {20.36*10,21.33*3}, 1},
{{3|(11<<4)}, {20.36*11,21.33*3}, 1}
};
#endif