refactoring

This commit is contained in:
2019-10-04 16:35:36 +02:00
parent 86f89f2f8d
commit de23e55290
5 changed files with 203 additions and 0 deletions

63
src/LS7366R.h Normal file
View File

@ -0,0 +1,63 @@
#ifndef _LS7366R_H_
#define _LS7366R_H_
#include <stdint.h>
const uint8_t REG_MDR0 = 0b00001000;
const uint8_t REG_MDR1 = 0b00010000;
const uint8_t REG_DTR = 0b00011000;
const uint8_t REG_CNTR = 0b00100000;
const uint8_t REG_OTR = 0b00101000;
const uint8_t REG_STR = 0b00110000;
const uint8_t CMD_CLR = 0b00000000;
const uint8_t CMD_RD = 0b01000000;
const uint8_t CMD_WR = 0b10000000;
const uint8_t CMD_LOAD = 0b11000000;
const uint8_t STR_CY = 0b10000000;
const uint8_t STR_BW = 0b01000000;
const uint8_t STR_CMP = 0b00100000;
const uint8_t STR_IDX = 0b00010000;
const uint8_t STR_CEN = 0b00001000;
const uint8_t STR_PLS = 0b00000100;
const uint8_t STR_UD = 0b00000010;
const uint8_t STR_S = 0b00000001;
const uint8_t MDR0_NOQ = 0b00000000;
const uint8_t MDR0_Q1 = 0b00000001;
const uint8_t MDR0_Q2 = 0b00000010;
const uint8_t MDR0_Q4 = 0b00000011;
const uint8_t MDR0_FRC = 0b00000000;
const uint8_t MDR0_SCC = 0b00000100;
const uint8_t MDR0_RLC = 0b00001000;
const uint8_t MDR0_MNC = 0b00001100;
const uint8_t MDR0_DI = 0b00000000;
const uint8_t MDR0_ILC = 0b00010000;
const uint8_t MDR0_IRC = 0b00100000;
const uint8_t MDR0_ILO = 0b00110000;
const uint8_t MDR0_AI = 0b00000000;
const uint8_t MDR0_SI = 0b01000000;
const uint8_t MDR0_FC1 = 0b00000000;
const uint8_t MDR0_FC2 = 0b10000000;
const uint8_t MDR1_4CM = 0b00000000;
const uint8_t MDR1_3CM = 0b00000001;
const uint8_t MDR1_2CM = 0b00000010;
const uint8_t MDR1_1CM = 0b00000011;
const uint8_t MDR1_EC = 0b00000000;
const uint8_t MDR1_DC = 0b00000100;
const uint8_t MDR1_F_IDX = 0b00010000;
const uint8_t MDR1_F_CMP = 0b00100000;
const uint8_t MDR1_F_BW = 0b01000000;
const uint8_t MDR1_F_CY = 0b10000000;
void ls7366rWriteCmd(uint8_t c);
void ls7366rWriteCmdData(uint8_t c, uint8_t d);
uint8_t ls7366rRead8(uint8_t c);
uint32_t ls7366rRead32(uint8_t c);
void ls7366rInit();
#endif // _LS7366R_H_