Skip to content

Commit 4367e6e

Browse files
devsaurusmarcelstoer
authored andcommitted
remove deprecated init functions in adxl345, am2320, bme280, bmp085, hdc1080, hmc58831, l3g4200d, HDC1000, lm92 (#2276)
1 parent 5c8af3c commit 4367e6e

File tree

19 files changed

+21
-305
lines changed

19 files changed

+21
-305
lines changed

app/modules/adxl345.c

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -45,23 +45,6 @@ static int adxl345_setup(lua_State* L) {
4545
return 0;
4646
}
4747

48-
static int adxl345_init(lua_State* L) {
49-
50-
uint32_t sda;
51-
uint32_t scl;
52-
53-
platform_print_deprecation_note("adxl345.init() is replaced by adxl345.setup()", "in the next version");
54-
55-
sda = luaL_checkinteger(L, 1);
56-
scl = luaL_checkinteger(L, 2);
57-
58-
luaL_argcheck(L, sda > 0 && scl > 0, 1, "no i2c for D0");
59-
60-
platform_i2c_setup(adxl345_i2c_id, sda, scl, PLATFORM_I2C_SPEED_SLOW);
61-
62-
return adxl345_setup(L);
63-
}
64-
6548
static int adxl345_read(lua_State* L) {
6649

6750
uint8_t data[6];
@@ -96,8 +79,6 @@ static int adxl345_read(lua_State* L) {
9679
static const LUA_REG_TYPE adxl345_map[] = {
9780
{ LSTRKEY( "read" ), LFUNCVAL( adxl345_read )},
9881
{ LSTRKEY( "setup" ), LFUNCVAL( adxl345_setup )},
99-
/// init() is deprecated
100-
{ LSTRKEY( "init" ), LFUNCVAL( adxl345_init )},
10182
{ LNILKEY, LNILVAL}
10283
};
10384

app/modules/am2320.c

Lines changed: 0 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -106,29 +106,6 @@ static int am2320_setup(lua_State* L)
106106
return 3;
107107
}
108108

109-
static int am2320_init(lua_State* L)
110-
{
111-
uint32_t sda;
112-
uint32_t scl;
113-
114-
platform_print_deprecation_note("am2320.init() is replaced by am2320.setup()", "in the next version");
115-
116-
if (!lua_isnumber(L, 1) || !lua_isnumber(L, 2)) {
117-
return luaL_error(L, "wrong arg range");
118-
}
119-
120-
sda = luaL_checkinteger(L, 1);
121-
scl = luaL_checkinteger(L, 2);
122-
123-
if (scl == 0 || sda == 0) {
124-
return luaL_error(L, "no i2c for D0");
125-
}
126-
127-
platform_i2c_setup(am2320_i2c_id, sda, scl, PLATFORM_I2C_SPEED_SLOW);
128-
129-
return am2320_setup(L);
130-
}
131-
132109
static int am2320_read(lua_State* L)
133110
{
134111
int ret;
@@ -155,8 +132,6 @@ static int am2320_read(lua_State* L)
155132
static const LUA_REG_TYPE am2320_map[] = {
156133
{ LSTRKEY( "read" ), LFUNCVAL( am2320_read )},
157134
{ LSTRKEY( "setup" ), LFUNCVAL( am2320_setup )},
158-
// init() is deprecated
159-
{ LSTRKEY( "init" ), LFUNCVAL( am2320_init )},
160135
{ LNILKEY, LNILVAL}
161136
};
162137

app/modules/bme280.c

Lines changed: 0 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -314,30 +314,6 @@ static int bme280_lua_setup(lua_State* L) {
314314
return 1;
315315
}
316316

317-
static int bme280_lua_init(lua_State* L) {
318-
uint8_t sda;
319-
uint8_t scl;
320-
uint8_t config;
321-
uint8_t ack;
322-
uint8_t full_init;
323-
324-
platform_print_deprecation_note("bme280.init() is replaced by bme280.setup()", "in the next version");
325-
326-
if (!lua_isnumber(L, 1) || !lua_isnumber(L, 2)) {
327-
return luaL_error(L, "wrong arg range");
328-
}
329-
sda = luaL_checkinteger(L, 1);
330-
scl = luaL_checkinteger(L, 2);
331-
332-
platform_i2c_setup(bme280_i2c_id, sda, scl, PLATFORM_I2C_SPEED_SLOW);
333-
334-
// remove sda and scl parameters from stack
335-
lua_remove(L, 1);
336-
lua_remove(L, 1);
337-
338-
return bme280_lua_setup(L);
339-
}
340-
341317
static void bme280_readoutdone (void *arg)
342318
{
343319
NODE_DBG("timer out\n");
@@ -495,8 +471,6 @@ static int bme280_lua_dewpoint(lua_State* L) {
495471
}
496472

497473
static const LUA_REG_TYPE bme280_map[] = {
498-
// init() is deprecated
499-
{ LSTRKEY( "init" ), LFUNCVAL(bme280_lua_init)},
500474
{ LSTRKEY( "setup" ), LFUNCVAL(bme280_lua_setup)},
501475
{ LSTRKEY( "temp" ), LFUNCVAL(bme280_lua_temp)},
502476
{ LSTRKEY( "baro" ), LFUNCVAL(bme280_lua_baro)},

app/modules/bmp085.c

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -63,28 +63,6 @@ static int bmp085_setup(lua_State* L) {
6363
return 0;
6464
}
6565

66-
static int bmp085_init(lua_State* L) {
67-
uint32_t sda;
68-
uint32_t scl;
69-
70-
platform_print_deprecation_note("bmp085.init() is replaced by bmp085.setup()", "in the next version");
71-
72-
if (!lua_isnumber(L, 1) || !lua_isnumber(L, 2)) {
73-
return luaL_error(L, "wrong arg range");
74-
}
75-
76-
sda = luaL_checkinteger(L, 1);
77-
scl = luaL_checkinteger(L, 2);
78-
79-
if (scl == 0 || sda == 0) {
80-
return luaL_error(L, "no i2c for D0");
81-
}
82-
83-
platform_i2c_setup(bmp085_i2c_id, sda, scl, PLATFORM_I2C_SPEED_SLOW);
84-
85-
return bmp085_setup(L);
86-
}
87-
8866
static uint32_t bmp085_temperature_raw_b5(void) {
8967
int16_t t, X1, X2;
9068

@@ -196,8 +174,6 @@ static const LUA_REG_TYPE bmp085_map[] = {
196174
{ LSTRKEY( "pressure" ), LFUNCVAL( bmp085_lua_pressure )},
197175
{ LSTRKEY( "pressure_raw" ), LFUNCVAL( bmp085_lua_pressure_raw )},
198176
{ LSTRKEY( "setup" ), LFUNCVAL( bmp085_setup )},
199-
// init() is deprecated
200-
{ LSTRKEY( "init" ), LFUNCVAL( bmp085_init )},
201177
{ LNILKEY, LNILVAL}
202178
};
203179

app/modules/hdc1080.c

Lines changed: 0 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -33,33 +33,6 @@ static int hdc1080_setup(lua_State* L) {
3333
return 0;
3434
}
3535

36-
static int hdc1080_init(lua_State* L) {
37-
38-
uint32_t sda;
39-
uint32_t scl;
40-
41-
platform_print_deprecation_note("hdc1080.init() is replaced by hdc1080.setup()", "in the next version");
42-
43-
if (!lua_isnumber(L, 1) || !lua_isnumber(L, 2)) {
44-
return luaL_error(L, "wrong arg range");
45-
}
46-
47-
sda = luaL_checkinteger(L, 1);
48-
scl = luaL_checkinteger(L, 2);
49-
50-
if (scl == 0 || sda == 0) {
51-
return luaL_error(L, "no i2c for D0");
52-
}
53-
54-
platform_i2c_setup(hdc1080_i2c_id, sda, scl, PLATFORM_I2C_SPEED_SLOW);
55-
56-
// remove sda and scl parameters from stack
57-
lua_remove(L, 1);
58-
lua_remove(L, 1);
59-
60-
return hdc1080_setup(L);
61-
}
62-
6336
static int hdc1080_read(lua_State* L) {
6437

6538
uint8_t data[2];
@@ -129,7 +102,6 @@ static int hdc1080_read(lua_State* L) {
129102
static const LUA_REG_TYPE hdc1080_map[] = {
130103
{ LSTRKEY( "read" ), LFUNCVAL( hdc1080_read )},
131104
{ LSTRKEY( "setup" ), LFUNCVAL( hdc1080_setup )},
132-
{ LSTRKEY( "init" ), LFUNCVAL( hdc1080_init )},
133105
{ LNILKEY, LNILVAL}
134106
};
135107

app/modules/hmc5883l.c

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -57,23 +57,6 @@ static int hmc5883_setup(lua_State* L) {
5757
return 0;
5858
}
5959

60-
static int hmc5883_init(lua_State* L) {
61-
62-
uint32_t sda;
63-
uint32_t scl;
64-
65-
platform_print_deprecation_note("hmc5883l.init() is replaced by hmc5883l.setup()", "in the next version");
66-
67-
sda = luaL_checkinteger(L, 1);
68-
scl = luaL_checkinteger(L, 2);
69-
70-
luaL_argcheck(L, sda > 0 && scl > 0, 1, "no i2c for D0");
71-
72-
platform_i2c_setup(hmc5883_i2c_id, sda, scl, PLATFORM_I2C_SPEED_SLOW);
73-
74-
return hmc5883_setup(L);
75-
}
76-
7760
static int hmc5883_read(lua_State* L) {
7861

7962
uint8_t data[6];
@@ -109,8 +92,6 @@ static int hmc5883_read(lua_State* L) {
10992
static const LUA_REG_TYPE hmc5883_map[] = {
11093
{ LSTRKEY( "read" ), LFUNCVAL( hmc5883_read )},
11194
{ LSTRKEY( "setup" ), LFUNCVAL( hmc5883_setup )},
112-
// init() is deprecated
113-
{ LSTRKEY( "init" ), LFUNCVAL( hmc5883_init )},
11495
{ LNILKEY, LNILVAL}
11596
};
11697

app/modules/l3g4200d.c

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -48,23 +48,6 @@ static int l3g4200d_setup(lua_State* L) {
4848
return 0;
4949
}
5050

51-
static int l3g4200d_init(lua_State* L) {
52-
53-
uint32_t sda;
54-
uint32_t scl;
55-
56-
platform_print_deprecation_note("l3g4200d.init() is replaced by l3g4200d.setup()", "in the next version");
57-
58-
sda = luaL_checkinteger(L, 1);
59-
scl = luaL_checkinteger(L, 2);
60-
61-
luaL_argcheck(L, sda > 0 && scl > 0, 1, "no i2c for D0");
62-
63-
platform_i2c_setup(i2c_id, sda, scl, PLATFORM_I2C_SPEED_SLOW);
64-
65-
return l3g4200d_setup(L);
66-
}
67-
6851
static int l3g4200d_read(lua_State* L) {
6952

7053
uint8_t data[6];
@@ -99,8 +82,6 @@ static int l3g4200d_read(lua_State* L) {
9982
static const LUA_REG_TYPE l3g4200d_map[] = {
10083
{ LSTRKEY( "read" ), LFUNCVAL( l3g4200d_read )},
10184
{ LSTRKEY( "setup" ), LFUNCVAL( l3g4200d_setup )},
102-
// init() is deprecated
103-
{ LSTRKEY( "init" ), LFUNCVAL( l3g4200d_init )},
10485
{ LNILKEY, LNILVAL}
10586
};
10687

docs/en/modules/adxl345.md

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -24,23 +24,6 @@ local x,y,z = adxl345.read()
2424
print(string.format("X = %d, Y = %d, Z = %d", x, y, z))
2525
```
2626

27-
## adxl345.init()
28-
Initializes the module and sets the pin configuration.
29-
30-
!!! attention
31-
32-
This function is deprecated and will be removed in upcoming releases. Use `adxl345.setup()` instead.
33-
34-
#### Syntax
35-
`adxl345.init(sda, scl)`
36-
37-
#### Parameters
38-
- `sda` data pin
39-
- `scl` clock pin
40-
41-
#### Returns
42-
`nil`
43-
4427
## adxl345.setup()
4528
Initializes the module.
4629

docs/en/modules/am2320.md

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -6,27 +6,6 @@
66

77
This module provides access to the [AM2320](https://akizukidenshi.com/download/ds/aosong/AM2320.pdf) humidity and temperature sensor, using the i2c interface.
88

9-
## am2320.init()
10-
Initializes the module and sets the pin configuration. Returns model, version, serial but is seams these where all zero on my model.
11-
12-
!!! attention
13-
14-
This function is deprecated and will be removed in upcoming releases. Use `am2320.setup()` instead.
15-
16-
#### Syntax
17-
`model, version, serial = am2320.init(sda, scl)`
18-
19-
#### Parameters
20-
- `sda` data pin
21-
- `scl` clock pin
22-
23-
#### Returns
24-
- `model` 16 bits number of model
25-
- `version` 8 bits version number
26-
- `serial` 32 bits serial number
27-
28-
Note: I have only observed values of 0 for all of these, maybe other sensors return more sensible readings.
29-
309
## am2320.read()
3110
Samples the sensor and returns the relative humidity in % and temperature in celsius, as an integer multiplied with 10.
3211

docs/en/modules/bme280.md

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -68,21 +68,6 @@ none
6868
- `H` last relative humidity reading in % times 1000
6969
- `T` temperature in celsius as an integer multiplied with 100
7070

71-
## bme280.init()
72-
73-
Initializes module. Initialization is mandatory before read values.
74-
75-
!!! attention
76-
77-
This function is deprecated and will be removed in upcoming releases. Use `bme280.setup()` instead.
78-
79-
#### Syntax
80-
81-
`bme280.init(sda, scl, [temp_oss, press_oss, humi_oss, power_mode, inactive_duration, IIR_filter])`
82-
83-
#### Parameters
84-
See [`setup()`](#bme280setup).
85-
8671
## bme280.qfe2qnh()
8772

8873
For given altitude converts the air pressure to sea level air pressure.

0 commit comments

Comments
 (0)