Syrostan-MCU-C/Core/Inc/User/ethernet.h
2021-07-27 09:58:57 +08:00

21 lines
513 B
C

#ifndef ETHERNET_H
#define ETHERNET_H
#include "user_main.h"
#define ENC_CMD_RESET (0b11001010)
#define ENC_CMD_RCR(add) (0b00000000 | add)
#define ENC_CMD_WCR(add) (0b01000000 | add)
#define ENC_CMD_BxSEL(x) (0b11000000 | (x << 1U))
#define ENC_CMD_RBSEL (0b11001000)
typedef enum
{
ENC_SPI_READ = 0,
ENC_SPI_WRITE
} enc_spi_operate_type_t;
void ethernet_init();
void ethernet_spi_n_byte_banked(enc_spi_operate_type_t type, uint8_t spi_cmd, uint8_t *spi_data, uint8_t n);
#endif