Revision 3106e8cc periphery-lld/periphAL.h
periphery-lld/periphAL.h | ||
---|---|---|
35 | 35 |
* @brief The periphery abstraction layer interface minor version. |
36 | 36 |
* @note A higher minor version implies new functionalty, but all old interfaces are still available. |
37 | 37 |
*/ |
38 |
#define PERIPHAL_VERSION_MINOR 0
|
|
38 |
#define PERIPHAL_VERSION_MINOR 1
|
|
39 | 39 |
|
40 | 40 |
/*============================================================================*/ |
41 | 41 |
/* DEPENDENCIES */ |
... | ... | |
107 | 107 |
* @brief GPIO driver type. |
108 | 108 |
*/ |
109 | 109 |
struct apalGpio_t { |
110 |
ioportid_t port; |
|
111 |
iopadid_t pad; |
|
110 |
ioline_t line; |
|
112 | 111 |
} PACKED_VAR; |
113 | 112 |
|
114 | 113 |
/** |
... | ... | |
124 | 123 |
apalDbgAssert(gpio != NULL); |
125 | 124 |
apalDbgAssert(val != NULL); |
126 | 125 |
|
127 |
*val = (palReadPad(gpio->port, gpio->pad) == PAL_HIGH) ? APAL_GPIO_HIGH : APAL_GPIO_LOW;
|
|
126 |
*val = (palReadLine(gpio->line) == PAL_HIGH) ? APAL_GPIO_HIGH : APAL_GPIO_LOW;
|
|
128 | 127 |
return APAL_STATUS_OK; |
129 | 128 |
} |
130 | 129 |
|
... | ... | |
140 | 139 |
{ |
141 | 140 |
apalDbgAssert(gpio != NULL); |
142 | 141 |
|
143 |
// palWritePad() is not guaranteed to be atomic, thus the scheduler is locked.
|
|
142 |
// palWriteLine() is not guaranteed to be atomic, thus the scheduler is locked.
|
|
144 | 143 |
syssts_t sysstatus = chSysGetStatusAndLockX(); |
145 |
palWritePad(gpio->port, gpio->pad, (val == APAL_GPIO_HIGH) ? PAL_HIGH : PAL_LOW);
|
|
144 |
palWriteLine(gpio->line, (val == APAL_GPIO_HIGH) ? PAL_HIGH : PAL_LOW);
|
|
146 | 145 |
chSysRestoreStatusX(sysstatus); |
147 | 146 |
return APAL_STATUS_OK; |
148 | 147 |
} |
... | ... | |
158 | 157 |
{ |
159 | 158 |
apalDbgAssert(gpio != NULL); |
160 | 159 |
|
161 |
// palWritePad() is not guaranteed to be atomic, thus the scheduler is locked.
|
|
160 |
// palWriteLine() is not guaranteed to be atomic, thus the scheduler is locked.
|
|
162 | 161 |
syssts_t sysstatus = chSysGetStatusAndLockX(); |
163 |
palWritePad(gpio->port, gpio->pad, (palReadPad(gpio->port, gpio->pad) == PAL_HIGH) ? PAL_LOW : PAL_HIGH);
|
|
162 |
palWriteLine(gpio->line, (palReadLine(gpio->line) == PAL_HIGH) ? PAL_LOW : PAL_HIGH);
|
|
164 | 163 |
chSysRestoreStatusX(sysstatus); |
165 | 164 |
return APAL_STATUS_OK; |
166 | 165 |
} |
... | ... | |
179 | 178 |
apalDbgAssert(cgpio->gpio != NULL); |
180 | 179 |
apalDbgAssert(val != NULL); |
181 | 180 |
|
182 |
*val = ((palReadPad(cgpio->gpio->port, cgpio->gpio->pad) == PAL_HIGH) ^ (cgpio->meta.active == APAL_GPIO_ACTIVE_HIGH)) ? APAL_GPIO_OFF : APAL_GPIO_ON;
|
|
181 |
*val = ((palReadLine(cgpio->gpio->line) == PAL_HIGH) ^ (cgpio->meta.active == APAL_GPIO_ACTIVE_HIGH)) ? APAL_GPIO_OFF : APAL_GPIO_ON;
|
|
183 | 182 |
return APAL_STATUS_OK; |
184 | 183 |
} |
185 | 184 |
|
... | ... | |
197 | 196 |
apalDbgAssert(cgpio->gpio != NULL); |
198 | 197 |
apalDbgAssert(cgpio->meta.direction == APAL_GPIO_DIRECTION_OUTPUT || cgpio->meta.direction == APAL_GPIO_DIRECTION_BIDIRECTIONAL); |
199 | 198 |
|
200 |
// palWritePad() is not guaranteed to be atomic, thus the scheduler is locked.
|
|
199 |
// palWriteLine() is not guaranteed to be atomic, thus the scheduler is locked.
|
|
201 | 200 |
syssts_t sysstatus = chSysGetStatusAndLockX(); |
202 |
palWritePad(cgpio->gpio->port, cgpio->gpio->pad, ((cgpio->meta.active == APAL_GPIO_ACTIVE_HIGH) ^ (val == APAL_GPIO_ON)) ? PAL_LOW : PAL_HIGH);
|
|
201 |
palWriteLine(cgpio->gpio->line, ((cgpio->meta.active == APAL_GPIO_ACTIVE_HIGH) ^ (val == APAL_GPIO_ON)) ? PAL_LOW : PAL_HIGH);
|
|
203 | 202 |
chSysRestoreStatusX(sysstatus); |
204 | 203 |
return APAL_STATUS_OK; |
205 | 204 |
} |
... | ... | |
600 | 599 |
} |
601 | 600 |
|
602 | 601 |
/** |
603 |
* @brief Transmit data to SPI and receive data afterwards without releasing the bus in between |
|
602 |
* @brief Transmit data to SPI and receive data afterwards without releasing the bus in between.
|
|
604 | 603 |
* |
605 | 604 |
* @param spid The SPI driver to use. |
606 | 605 |
* @param txData Transmit data buffer. |
Also available in: Unified diff