Skip to content

Commit 06ec377

Browse files
committed
[driver] Small fixes for replacing Protothreads with Fibers
1 parent 5f9cb9b commit 06ec377

26 files changed

+34
-60
lines changed

src/modm/driver/adc/ads101x.lb

+1-2
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,7 @@ The ADS1013/ADS1014/ADS1015 are ultra-low power, high precision analog-digital c
2121
def prepare(module, options):
2222
module.depends(
2323
":architecture:i2c.device",
24-
":architecture:register",
25-
":processing:protothread")
24+
":architecture:register")
2625
return True
2726

2827
def build(env):

src/modm/driver/adc/ads7828_impl.hpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ namespace modm
2121
{
2222

2323
template <typename I2cMaster>
24-
Ads7828<I2cMaster>::Ads7828(Data &data, uint8_t address) : data(data), modm::I2cDevice<I2cMaster, 1>(address)
24+
Ads7828<I2cMaster>::Ads7828(Data &data, uint8_t address) : modm::I2cDevice<I2cMaster, 1>(address), data(data)
2525
{
2626
}
2727

@@ -60,4 +60,4 @@ Ads7828<I2cMaster>::readConversionResult()
6060
RF_END_RETURN_CALL(this->runTransaction());
6161
}
6262

63-
} // modm namespace
63+
} // modm namespace

src/modm/driver/display/hd44780.hpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ class Hd44780 : public CharacterDisplay
7777
* cg must be uint8_t[8].
7878
*/
7979
void
80-
writeCGRAM(uint8_t character, uint8_t *cg);
80+
writeCGRAM(uint8_t character, const uint8_t *cg);
8181

8282
};
8383

src/modm/driver/display/hd44780_base.hpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ class Hd44780Base
126126
isBusy();
127127

128128
static inline bool
129-
writeCGRAM(uint8_t character, uint8_t *cg);
129+
writeCGRAM(uint8_t character, const uint8_t *cg);
130130

131131
protected:
132132
/// unconditionally write data to the controller

src/modm/driver/display/hd44780_base_impl.hpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,7 @@ modm::Hd44780Base<DATA, RW, RS, E>::isBusy()
172172

173173
template <typename DATA, typename RW, typename RS, typename E>
174174
bool
175-
modm::Hd44780Base<DATA, RW, RS, E>::writeCGRAM(uint8_t character, uint8_t *cg)
175+
modm::Hd44780Base<DATA, RW, RS, E>::writeCGRAM(uint8_t character, const uint8_t *cg)
176176
{
177177
while(not writeCommand(SetCGRAM_Address | (character << 3)))
178178
;

src/modm/driver/display/hd44780_impl.hpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ modm::Hd44780<DATA, RW, RS, E>::execute(Command command)
6464

6565
template <typename DATA, typename RW, typename RS, typename E>
6666
void
67-
modm::Hd44780<DATA, RW, RS, E>::writeCGRAM(uint8_t character, uint8_t *cg)
67+
modm::Hd44780<DATA, RW, RS, E>::writeCGRAM(uint8_t character, const uint8_t *cg)
6868
{
6969
// There are only 8 characters in CGRAM
7070
if (character > 8) {

src/modm/driver/encoder/as5047.hpp

+1-2
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818
#include <modm/architecture/interface/register.hpp>
1919
#include <modm/architecture/interface/spi_device.hpp>
2020
#include <modm/processing/resumable.hpp>
21-
#include <modm/processing/timer.hpp>
2221
#include <modm/math/geometry/angle_int.hpp>
2322

2423
namespace modm
@@ -121,4 +120,4 @@ class As5047 : public as5047, public modm::SpiDevice<SpiMaster>, protected modm:
121120

122121
} // namespace modm
123122

124-
#include "as5047_impl.hpp"
123+
#include "as5047_impl.hpp"

src/modm/driver/encoder/as5047.lb

+8-8
Original file line numberDiff line numberDiff line change
@@ -11,21 +11,21 @@
1111
# -----------------------------------------------------------------------------
1212

1313
def init(module):
14-
module.name = ":driver:as5047"
15-
module.description = """\
14+
module.name = ":driver:as5047"
15+
module.description = """\
1616
# AS5047 14 bit Absolute Encoder SPI Driver
1717
1818
[Datasheet](https://ams.com/documents/20143/36005/AS5047D_DS000394_2-00.pdf)
1919
"""
2020

2121
def prepare(module, options):
22-
module.depends(
23-
":architecture:gpio",
24-
":architecture:spi.device",
25-
":processing:resumable",
26-
":math:geometry"
22+
module.depends(
23+
":architecture:gpio",
24+
":architecture:spi.device",
25+
":processing:resumable",
26+
":math:geometry"
2727
)
28-
return True
28+
return True
2929

3030
def build(env):
3131
env.outbasepath = "modm/src/modm/driver/encoder"

src/modm/driver/inertial/bmi088.lb

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,8 @@ def prepare(module, options):
2525
":architecture:register",
2626
":architecture:spi.device",
2727
":architecture:i2c.device",
28+
":architecture:fiber",
2829
":math:geometry",
29-
":processing:fiber",
3030
":processing:timer")
3131
return True
3232

src/modm/driver/inertial/bmi088_transport_impl.hpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
#error "Don't include this file directly, use 'bmi088_transport.hpp' instead!"
1414
#endif
1515

16-
#include <modm/processing/fiber.hpp>
16+
#include <modm/architecture/interface/fiber.hpp>
1717

1818
namespace modm
1919
{

src/modm/driver/inertial/hmc6343.hpp

-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313
#define MODM_HMC6343_HPP
1414

1515
#include <modm/architecture/interface/i2c_device.hpp>
16-
#include <modm/processing/protothread.hpp>
1716

1817
namespace modm
1918
{

src/modm/driver/inertial/hmc6343.lb

+1-2
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,7 @@ def prepare(module, options):
2828
module.depends(
2929
":architecture:i2c.device",
3030
":architecture:register",
31-
":math:utils",
32-
":processing:protothread")
31+
":math:utils")
3332
return True
3433

3534
def build(env):

src/modm/driver/position/vl6180.lb

+1-3
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,7 @@ def prepare(module, options):
2222
":architecture:register",
2323
":architecture:unaligned",
2424
":math:utils",
25-
":debug",
26-
":processing:protothread",
27-
":processing:timer",)
25+
":processing:timer")
2826
return True
2927

3028
def build(env):

src/modm/driver/pressure/bme280.hpp

-3
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,8 @@
1313
#ifndef MODM_BME280_HPP
1414
#define MODM_BME280_HPP
1515

16-
#include <modm/processing/protothread.hpp>
17-
#include <modm/processing/resumable.hpp>
1816
#include <modm/architecture/interface/i2c_device.hpp>
1917
#include <modm/architecture/interface/register.hpp>
20-
#include <modm/processing/timer.hpp>
2118

2219
#include "bme280_data.hpp"
2320

src/modm/driver/pressure/bme280.lb

+1-3
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,7 @@ def prepare(module, options):
2929
":architecture:i2c.device",
3030
":architecture:register",
3131
":math:utils",
32-
":debug",
33-
":processing:protothread",
34-
":processing:timer")
32+
":debug")
3533
return True
3634

3735
def build(env):

src/modm/driver/pressure/bmp085.hpp

-2
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,6 @@
1313
#ifndef MODM_BMP085_HPP
1414
#define MODM_BMP085_HPP
1515

16-
#include <modm/processing/protothread.hpp>
17-
#include <modm/processing/resumable.hpp>
1816
#include <modm/architecture/interface/i2c_device.hpp>
1917
#include <modm/processing/timer.hpp>
2018

src/modm/driver/pressure/bmp085.lb

-1
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@ def prepare(module, options):
3333
":architecture:i2c.device",
3434
":math:utils",
3535
":debug",
36-
":processing:protothread",
3736
":processing:timer")
3837
return True
3938

src/modm/driver/rtc/mcp7941x.hpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818

1919
#include <modm/architecture/interface/register.hpp>
2020
#include <modm/architecture/interface/i2c_device.hpp>
21-
#include <modm/processing/protothread.hpp>
21+
#include <modm/processing/resumable.hpp>
2222

2323
namespace modm
2424
{

src/modm/driver/temperature/ds1631.hpp

+2-6
Original file line numberDiff line numberDiff line change
@@ -116,9 +116,8 @@ class Ds1631 : public ds1631, public I2cDevice< I2cMaster, 2 >,
116116
///
117117
Ds1631(Data &data, uint8_t address=0x90);
118118

119-
void
120-
update()
121-
{ run(); }
119+
bool
120+
update();
122121

123122
modm::ResumableResult<bool>
124123
initialize();
@@ -170,9 +169,6 @@ class Ds1631 : public ds1631, public I2cDevice< I2cMaster, 2 >,
170169
{ return data; }
171170

172171
private:
173-
bool
174-
run();
175-
176172
modm::ResumableResult<bool>
177173
writeCommand(Command cmd);
178174

src/modm/driver/temperature/ds1631_impl.hpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ modm::Ds1631<I2cMaster>::initialize()
4141

4242
template < typename I2cMaster >
4343
bool
44-
modm::Ds1631<I2cMaster>::run()
44+
modm::Ds1631<I2cMaster>::update()
4545
{
4646
PT_BEGIN();
4747

src/modm/driver/temperature/tmp102.hpp

+2-6
Original file line numberDiff line numberDiff line change
@@ -118,9 +118,8 @@ class Tmp102 : public tmp102, public Lm75< I2cMaster >,
118118
/// sets address to default of 0x48 (alternatives are 0x49, 0x4A and 0x4B).
119119
Tmp102(Data &data, uint8_t address=0x48);
120120

121-
void
122-
update()
123-
{ run(); }
121+
bool
122+
update();
124123

125124
// MARK: Configuration
126125
// @param rate Update rate in Hz: 0 to 33. (Use 0 to update at 0.25Hz).
@@ -153,9 +152,6 @@ class Tmp102 : public tmp102, public Lm75< I2cMaster >,
153152
getData();
154153

155154
private:
156-
bool
157-
run();
158-
159155
modm::ResumableResult<bool>
160156
writeConfiguration(uint8_t length=3);
161157

src/modm/driver/temperature/tmp102.lb

+2-1
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,8 @@ def prepare(module, options):
3636
":architecture:register",
3737
":driver:lm75",
3838
":math:utils",
39-
":processing:protothread")
39+
":processing:protothread",
40+
":processing:timer")
4041
return True
4142

4243
def build(env):

src/modm/driver/temperature/tmp102_impl.hpp

+1-2
Original file line numberDiff line numberDiff line change
@@ -22,12 +22,11 @@ modm::Tmp102<I2cMaster>::Tmp102(Data &data, uint8_t address)
2222
updateTime(250), timeout(modm::ShortDuration(updateTime)),
2323
config_lsb(ConversionRate_t(ConversionRate::Hz4))
2424
{
25-
this->stop();
2625
}
2726

2827
template < typename I2cMaster >
2928
bool
30-
modm::Tmp102<I2cMaster>::run()
29+
modm::Tmp102<I2cMaster>::update()
3130
{
3231
PT_BEGIN();
3332

src/modm/driver/temperature/tmp12x.hpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
#define MODM_TMP12x_HPP
1414

1515
#include <modm/architecture/interface/spi_device.hpp>
16-
#include <modm/processing/resumable/nested_resumable.hpp>
16+
#include <modm/processing/resumable.hpp>
1717
#include <array>
1818
#include <ratio>
1919

src/modm/driver/temperature/tmp175.hpp

+2-6
Original file line numberDiff line numberDiff line change
@@ -74,9 +74,8 @@ class Tmp175 : public tmp175, public Lm75< I2cMaster >,
7474
/// sets address to default of 0x48 (alternatives are 0x49, 0x4A and 0x4B).
7575
Tmp175(Data &data, uint8_t address=0x48);
7676

77-
void
78-
update()
79-
{ run(); }
77+
bool
78+
update();
8079

8180
// @param rate Update rate in Hz: 1 to 33.
8281
void
@@ -103,9 +102,6 @@ class Tmp175 : public tmp175, public Lm75< I2cMaster >,
103102
getData();
104103

105104
private:
106-
bool
107-
run();
108-
109105
modm::ResumableResult<bool>
110106
writeConfiguration();
111107

src/modm/driver/temperature/tmp175_impl.hpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ modm::Tmp175<I2cMaster>::Tmp175(Data &data, uint8_t address)
2727

2828
template < typename I2cMaster >
2929
bool
30-
modm::Tmp175<I2cMaster>::run()
30+
modm::Tmp175<I2cMaster>::update()
3131
{
3232
PT_BEGIN();
3333

0 commit comments

Comments
 (0)