-
Notifications
You must be signed in to change notification settings - Fork 0
/
mcp2515_driver_pal.h
96 lines (85 loc) · 2.05 KB
/
mcp2515_driver_pal.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
/**
* @author Ashutosh Singh Parmar
* @file mcp2515_driver_pal.h
* @brief This file contains function declarations for platform abstraction layer APIs.
*/
#ifndef MCP2515_DRIVER_PAL
#define MCP2515_DRIVER_PAL
#include "mcp2515_driver_pal_defs.h"
/**
* @brief This PAL API will be called by core APIs to suspend execution by '_int' milliseconds.
*
* @param
* 1. uint32_t _int : number of milliseconds.
*
* @return
* NOTHING
*/
inline void pal_delay_ms(uint32_t _int)
{
/* !...Platform Specific Code here...! */
}
/**
* @brief This PAL API will be called by core APIs to suspend execution by '_int' microseconds.
*
* @param
* 1. uint32_t _int : number of microseconds.
*
* @return
* NOTHING
*/
inline void pal_delay_us(uint32_t _int)
{
/* !...Platform Specific Code here...! */
}
/**
* @brief This PAL API will be called by core APIs to initialize the SPI port.
*
* @param
* 1. void * data : pointer to a custom structure containing initialization information.
* 2. uint8_t data_direction : Direction of shifting out data - MSB_FIRST or LSB_FIRST.
* 3. uint8_t idle_level : The idle level of spi port - IDLE_HIGH OR IDLE_LOW.
* 4. uint8_t shift_iedge : The edge at which data will be shifted out - RISING or FALLING.
*
* @return NOTHING
*/
void pal_spi_init(void*, uint8_t, uint8_t, uint8_t);
/**
* @brief This PAL API will be called by core APIs to select the mcp2515 chip.
*
* @param
* NONE
*
* @return NOTHING
*/
void pal_select_slave(void);
/**
* @brief This PAL API will be called by core APIs to deselect the mcp2515 chip.
*
* @param
* NONE
*
* @return NOTHING
*/
void pal_deselect_slave(void);
/**
* @brief This PAL API will be called by core APIs to send a byte over the SPI port.
*
* @param
* 1. uint8_t byt : The data byte to send
*
* @return
* NOTHING
*/
void pal_spi_send(uint8_t byt);
/**
* @brief This PAL API will be called by core APIs to send a byte over the SPI port.
*
* @param
* NONE
*
* @return
* uint8_t : the data byte read over the SPI port.
*/
uint8_t pal_spi_read(void);
#endif