parent
							
								
									8804993a89
								
							
						
					
					
						commit
						bae4bfe9d7
					
				@ -1,4 +1,5 @@
 | 
				
			||||
SRC += rev1/matrix.c \
 | 
				
			||||
	   rev1/split_util.c
 | 
				
			||||
SRC += rev1/matrix.c
 | 
				
			||||
SRC += rev1/split_util.c
 | 
				
			||||
SRC += rev1/split_scomm.c
 | 
				
			||||
 | 
				
			||||
BACKLIGHT_ENABLE = no
 | 
				
			||||
 | 
				
			||||
@ -0,0 +1,38 @@
 | 
				
			||||
#ifdef USE_SERIAL
 | 
				
			||||
#include <stdbool.h>
 | 
				
			||||
#include <stdint.h>
 | 
				
			||||
#include <stddef.h>
 | 
				
			||||
#include <split_scomm.h>
 | 
				
			||||
#include "serial.h"
 | 
				
			||||
 | 
				
			||||
uint8_t volatile serial_slave_buffer[SERIAL_SLAVE_BUFFER_LENGTH] = {0};
 | 
				
			||||
uint8_t volatile serial_master_buffer[SERIAL_MASTER_BUFFER_LENGTH] = {0};
 | 
				
			||||
uint8_t volatile status0 = 0;
 | 
				
			||||
 | 
				
			||||
SSTD_t transactions[] = {
 | 
				
			||||
 | 
				
			||||
#define WHOLE_MATRIX_EXCHANGE 0
 | 
				
			||||
    { (uint8_t *)&status0,
 | 
				
			||||
      sizeof(serial_master_buffer), (uint8_t *)serial_master_buffer,
 | 
				
			||||
      sizeof(serial_slave_buffer), (uint8_t *)serial_slave_buffer
 | 
				
			||||
    }
 | 
				
			||||
};
 | 
				
			||||
 | 
				
			||||
void serial_master_init(void)
 | 
				
			||||
{
 | 
				
			||||
    soft_serial_initiator_init(transactions);
 | 
				
			||||
}
 | 
				
			||||
 | 
				
			||||
void serial_slave_init(void)
 | 
				
			||||
{
 | 
				
			||||
    soft_serial_target_init(transactions);
 | 
				
			||||
}
 | 
				
			||||
 | 
				
			||||
// 0 => no error
 | 
				
			||||
// 1 => slave did not respond
 | 
				
			||||
// 2 => checksum error
 | 
				
			||||
int serial_update_buffers(int master_update)
 | 
				
			||||
{
 | 
				
			||||
    return soft_serial_transaction(WHOLE_MATRIX_EXCHANGE);
 | 
				
			||||
}
 | 
				
			||||
#endif /* USE_SERIAL */
 | 
				
			||||
@ -0,0 +1,15 @@
 | 
				
			||||
#ifndef SPLIT_COMM_H
 | 
				
			||||
#define SPLIT_COMM_H
 | 
				
			||||
 | 
				
			||||
// Buffers for master - slave communication
 | 
				
			||||
#define SERIAL_SLAVE_BUFFER_LENGTH MATRIX_ROWS/2
 | 
				
			||||
#define SERIAL_MASTER_BUFFER_LENGTH 1
 | 
				
			||||
 | 
				
			||||
extern volatile uint8_t serial_slave_buffer[SERIAL_SLAVE_BUFFER_LENGTH];
 | 
				
			||||
extern volatile uint8_t serial_master_buffer[SERIAL_MASTER_BUFFER_LENGTH];
 | 
				
			||||
 | 
				
			||||
void serial_master_init(void);
 | 
				
			||||
void serial_slave_init(void);
 | 
				
			||||
int serial_update_buffers(int master_changed);
 | 
				
			||||
 | 
				
			||||
#endif /* SPLIT_COMM_H */
 | 
				
			||||
					Loading…
					
					
				
		Reference in new issue