aboutsummaryrefslogtreecommitdiffstats
path: root/os/hal/src
diff options
context:
space:
mode:
authorgdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4>2010-10-13 11:45:07 +0000
committergdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4>2010-10-13 11:45:07 +0000
commit4fab7c06d1b0c9e61f6106b5b2a5c2c0b5694c34 (patch)
treee7fdadc85d78aa2143d0082d26351da49f7f2d53 /os/hal/src
parentec7455babe131ee0b8a4c228ed00a02396619a7d (diff)
downloadChibiOS-4fab7c06d1b0c9e61f6106b5b2a5c2c0b5694c34.tar.gz
ChibiOS-4fab7c06d1b0c9e61f6106b5b2a5c2c0b5694c34.tar.bz2
ChibiOS-4fab7c06d1b0c9e61f6106b5b2a5c2c0b5694c34.zip
ADC, SPI, PWM driver enhancements.
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@2254 35acf78f-673a-0410-8e92-d51de3d6d3f4
Diffstat (limited to 'os/hal/src')
-rw-r--r--os/hal/src/adc.c6
-rw-r--r--os/hal/src/pwm.c10
-rw-r--r--os/hal/src/spi.c3
3 files changed, 10 insertions, 9 deletions
diff --git a/os/hal/src/adc.c b/os/hal/src/adc.c
index c6968f11b..e18995089 100644
--- a/os/hal/src/adc.c
+++ b/os/hal/src/adc.c
@@ -176,7 +176,8 @@ void adcStartConversionI(ADCDriver *adcp,
((depth == 1) || ((depth & 1) == 0)),
"adcStartConversionI");
- chDbgAssert(adcp->ad_state == ADC_READY,
+ chDbgAssert((adcp->ad_state == ADC_READY) ||
+ (adcp->ad_state == ADC_COMPLETE),
"adcStartConversionI(), #1", "not ready");
adcp->ad_samples = samples;
adcp->ad_depth = depth;
@@ -201,8 +202,7 @@ void adcStopConversion(ADCDriver *adcp) {
chSysLock();
chDbgAssert((adcp->ad_state == ADC_READY) ||
- (adcp->ad_state == ADC_ACTIVE) ||
- (adcp->ad_state == ADC_COMPLETE),
+ (adcp->ad_state == ADC_ACTIVE),
"adcStopConversion(), #1", "invalid state");
if (adcp->ad_state != ADC_READY) {
adc_lld_stop_conversion(adcp);
diff --git a/os/hal/src/pwm.c b/os/hal/src/pwm.c
index 978149ff6..13c77bfc6 100644
--- a/os/hal/src/pwm.c
+++ b/os/hal/src/pwm.c
@@ -86,8 +86,7 @@ void pwmStart(PWMDriver *pwmp, const PWMConfig *config) {
chSysLock();
chDbgAssert((pwmp->pd_state == PWM_STOP) || (pwmp->pd_state == PWM_READY),
- "pwmStart(), #1",
- "invalid state");
+ "pwmStart(), #1", "invalid state");
pwmp->pd_config = config;
pwm_lld_start(pwmp);
pwmp->pd_state = PWM_READY;
@@ -107,8 +106,7 @@ void pwmStop(PWMDriver *pwmp) {
chSysLock();
chDbgAssert((pwmp->pd_state == PWM_STOP) || (pwmp->pd_state == PWM_READY),
- "pwmStop(), #1",
- "invalid state");
+ "pwmStop(), #1", "invalid state");
pwm_lld_stop(pwmp);
pwmp->pd_state = PWM_STOP;
chSysUnlock();
@@ -133,7 +131,7 @@ void pwmEnableChannel(PWMDriver *pwmp,
chSysLock();
chDbgAssert(pwmp->pd_state == PWM_READY,
- "pwmEnableChannel(), #1", "invalid state");
+ "pwmEnableChannel(), #1", "not ready");
pwm_lld_enable_channel(pwmp, channel, width);
chSysUnlock();
}
@@ -155,7 +153,7 @@ void pwmDisableChannel(PWMDriver *pwmp, pwmchannel_t channel) {
chSysLock();
chDbgAssert(pwmp->pd_state == PWM_READY,
- "pwmDisableChannel(), #1", "invalid state");
+ "pwmDisableChannel(), #1", "not ready");
pwm_lld_disable_channel(pwmp, channel);
chSysUnlock();
}
diff --git a/os/hal/src/spi.c b/os/hal/src/spi.c
index fe7b729bd..be5cf9452 100644
--- a/os/hal/src/spi.c
+++ b/os/hal/src/spi.c
@@ -105,6 +105,8 @@ void spiStart(SPIDriver *spip, const SPIConfig *config) {
/**
* @brief Deactivates the SPI peripheral.
+ * @note Deactivating the peripheral also enforces a release of the slave
+ * select line.
*
* @param[in] spip pointer to the @p SPIDriver object
*
@@ -117,6 +119,7 @@ void spiStop(SPIDriver *spip) {
chSysLock();
chDbgAssert((spip->spd_state == SPI_STOP) || (spip->spd_state == SPI_READY),
"spiStop(), #1", "invalid state");
+ spi_lld_unselect(spip);
spi_lld_stop(spip);
spip->spd_state = SPI_STOP;
chSysUnlock();