diff options
| author | spicyjpeg <88942473+spicyjpeg@users.noreply.github.com> | 2022-01-17 17:55:09 +0100 |
|---|---|---|
| committer | spicyjpeg <88942473+spicyjpeg@users.noreply.github.com> | 2022-01-17 17:55:09 +0100 |
| commit | e9475e283a82665fe6c19bebc3318b5084f15a2e (patch) | |
| tree | 5740f396d10a9580c3a39ca536544436898ff1b6 /examples/io/pads/spi.h | |
| parent | de38196a978548b61c4b45115d24ef743b9eef90 (diff) | |
| parent | 08de895e8582dbc70b639ae5f511ab9ebfb4d68a (diff) | |
| download | psn00bsdk-e9475e283a82665fe6c19bebc3318b5084f15a2e.tar.gz | |
Merge branch 'master' of github.com:Lameguy64/PSn00bSDK into latest-commit
Diffstat (limited to 'examples/io/pads/spi.h')
| -rw-r--r-- | examples/io/pads/spi.h | 25 |
1 files changed, 13 insertions, 12 deletions
diff --git a/examples/io/pads/spi.h b/examples/io/pads/spi.h index 1c473cd..c50e065 100644 --- a/examples/io/pads/spi.h +++ b/examples/io/pads/spi.h @@ -9,23 +9,24 @@ #include <stdint.h> #include <psxpad.h> +// Maximum request/response length (34 bytes for pads, 140 for memory cards) //#define SPI_BUFF_LEN 34 #define SPI_BUFF_LEN 140 /* Request structures */ -typedef void (*SPICALLBACK)(uint32_t port, const volatile uint8_t *buff, size_t rx_len); +typedef void (*SPI_Callback)(uint32_t port, const volatile uint8_t *buff, size_t rx_len); -typedef struct _SPIREQUEST { +typedef struct _SPI_Request { union { - uint8_t data[SPI_BUFF_LEN]; - PADREQUEST pad_req; - MCDREQUEST mcd_req; + uint8_t data[SPI_BUFF_LEN]; + PadRequest pad_req; + MemCardRequest mcd_req; }; - uint32_t len, port; - SPICALLBACK callback; - struct _SPIREQUEST *next; -} SPIREQUEST; + uint32_t len, port; + SPI_Callback callback; + struct _SPI_Request *next; +} SPI_Request; /* Public API */ @@ -34,7 +35,7 @@ typedef struct _SPIREQUEST { * object must be populated afterwards by setting the length, callback and * filling in the TX data buffer. */ -SPIREQUEST *spi_new_request(void); +SPI_Request *SPI_CreateRequest(void); /** * @brief Changes the controller polling rate. The lowest supported rate is 65 @@ -43,7 +44,7 @@ SPIREQUEST *spi_new_request(void); * * @param value */ -void spi_set_poll_rate(uint32_t value); +void SPI_SetPollRate(uint32_t value); /** * @brief Installs the SPI and timer 2 interrupt handlers and starts the poll @@ -56,6 +57,6 @@ void spi_set_poll_rate(uint32_t value); * * @param callback */ -void spi_init(SPICALLBACK callback); +void SPI_Init(SPI_Callback callback); #endif |
