Firmware SDK
twr_module_sensor

Driver for Sensor Module. More...

Enumerations

enum  twr_module_sensor_channel_t {
  TWR_MODULE_SENSOR_CHANNEL_A = 0 ,
  TWR_MODULE_SENSOR_CHANNEL_B = 1 ,
  TWR_MODULE_SENSOR_CHANNEL_C = 2
}
 Sensor Module channels. More...
 
enum  twr_module_sensor_pull_t {
  TWR_MODULE_SENSOR_PULL_NONE = TWR_GPIO_PULL_NONE ,
  TWR_MODULE_SENSOR_PULL_UP_INTERNAL = TWR_GPIO_PULL_UP ,
  TWR_MODULE_SENSOR_PULL_DOWN_INTERNAL = TWR_GPIO_PULL_DOWN ,
  TWR_MODULE_SENSOR_PULL_UP_4K7 = 3 ,
  TWR_MODULE_SENSOR_PULL_UP_56R = 4
}
 Sensor module pull. More...
 
enum  twr_module_sensor_mode_t {
  TWR_MODULE_SENSOR_MODE_INPUT = TWR_GPIO_MODE_INPUT ,
  TWR_MODULE_SENSOR_MODE_OUTPUT = TWR_GPIO_MODE_OUTPUT
}
 Sensor Module mode of operation. More...
 
enum  twr_module_sensor_revision_t {
  TWR_MODULE_SENSOR_REVISION_UNKNOWN = 0 ,
  TWR_MODULE_SENSOR_REVISION_R1_0 = 1 ,
  TWR_MODULE_SENSOR_REVISION_R1_1 = 2
}
 Sensor Module hardware revision. More...
 

Functions

bool twr_module_sensor_init (void)
 Initialize Sensor Module. More...
 
void twr_module_sensor_deinit (void)
 Deinitialize Sensor Module.
 
bool twr_module_sensor_set_pull (twr_module_sensor_channel_t channel, twr_module_sensor_pull_t pull)
 Set pull of Sensor Module channel. More...
 
twr_module_sensor_pull_t twr_module_sensor_get_pull (twr_module_sensor_channel_t channel)
 Get pull-up/pull-down configuration for Sensor Module channel. More...
 
void twr_module_sensor_set_mode (twr_module_sensor_channel_t channel, twr_module_sensor_mode_t mode)
 Set output mode of Sensor Module channel. More...
 
twr_module_sensor_mode_t twr_module_sensor_get_mode (twr_module_sensor_channel_t channel)
 Get mode of operation for Sensor Module channel. More...
 
int twr_module_sensor_get_input (twr_module_sensor_channel_t channel)
 Get input of Sensor Module channel. More...
 
void twr_module_sensor_set_output (twr_module_sensor_channel_t channel, int state)
 Set output state of Sensor Module channel. More...
 
int twr_module_sensor_get_output (twr_module_sensor_channel_t channel)
 Get output state for Sensor Module channel. More...
 
void twr_module_sensor_toggle_output (twr_module_sensor_channel_t channel)
 Toggle output state for Sensor Module channel. More...
 
bool twr_module_sensor_set_vdd (bool on)
 Set VDD On / Off. More...
 
twr_module_sensor_revision_t twr_module_sensor_get_revision (void)
 Get Sensor Module revision.
 
twr_onewire_ttwr_module_sensor_get_onewire (void)
 Initialize and get Instance 1-Wire for channel B. More...
 
bool twr_module_sensor_onewire_power_up (void)
 Semaphore for 1Wire Power up: for R1.1 set VDD On, for R1.0 pull up 56R on channel A. More...
 
bool twr_module_sensor_onewire_power_down (void)
 Semaphore for 1Wire Power down: for R1.1 set VDD Off, for R1.0 pull none on channel A. More...
 

Detailed Description

Driver for Sensor Module.

Enumeration Type Documentation

◆ twr_module_sensor_channel_t

Sensor Module channels.

Enumerator
TWR_MODULE_SENSOR_CHANNEL_A 

Channel A.

TWR_MODULE_SENSOR_CHANNEL_B 

Channel B.

TWR_MODULE_SENSOR_CHANNEL_C 

Channel C.

Definition at line 13 of file twr_module_sensor.h.

◆ twr_module_sensor_mode_t

Sensor Module mode of operation.

Enumerator
TWR_MODULE_SENSOR_MODE_INPUT 

Channel operates as input.

TWR_MODULE_SENSOR_MODE_OUTPUT 

Channel operates as output.

Definition at line 49 of file twr_module_sensor.h.

◆ twr_module_sensor_pull_t

Sensor module pull.

Enumerator
TWR_MODULE_SENSOR_PULL_NONE 

Channel has no pull.

TWR_MODULE_SENSOR_PULL_UP_INTERNAL 

Channel has internal pull-up.

TWR_MODULE_SENSOR_PULL_DOWN_INTERNAL 

Channel has internal pull-down.

TWR_MODULE_SENSOR_PULL_UP_4K7 

Channel has pull-up 4k7.

TWR_MODULE_SENSOR_PULL_UP_56R 

Channel has pull-up 56R.

Definition at line 28 of file twr_module_sensor.h.

◆ twr_module_sensor_revision_t

Sensor Module hardware revision.

Enumerator
TWR_MODULE_SENSOR_REVISION_UNKNOWN 

Hardware revision unknown.

TWR_MODULE_SENSOR_REVISION_R1_0 

Hardware revision R1.0.

TWR_MODULE_SENSOR_REVISION_R1_1 

Hardware revision R1.1.

Definition at line 61 of file twr_module_sensor.h.

Function Documentation

◆ twr_module_sensor_get_input()

int twr_module_sensor_get_input ( twr_module_sensor_channel_t  channel)

Get input of Sensor Module channel.

Parameters
[in]channelSensor Module channel
Returns
Input state

Definition at line 217 of file twr_module_sensor.c.

Here is the call graph for this function:

◆ twr_module_sensor_get_mode()

twr_module_sensor_mode_t twr_module_sensor_get_mode ( twr_module_sensor_channel_t  channel)

Get mode of operation for Sensor Module channel.

Parameters
[in]channelSensor Module channel
Returns
Mode of operation

◆ twr_module_sensor_get_onewire()

twr_onewire_t* twr_module_sensor_get_onewire ( void  )

Initialize and get Instance 1-Wire for channel B.

Returns
pointer on Instance 1-Wire

Definition at line 312 of file twr_module_sensor.c.

Referenced by twr_ds18b20_init_multiple(), twr_ds18b20_init_single(), twr_i2c_init(), and twr_soil_sensor_init_multiple().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ twr_module_sensor_get_output()

int twr_module_sensor_get_output ( twr_module_sensor_channel_t  channel)

Get output state for Sensor Module channel.

Parameters
[in]channelSensor Module channel
Returns
Output state

Definition at line 227 of file twr_module_sensor.c.

Here is the call graph for this function:

◆ twr_module_sensor_get_pull()

twr_module_sensor_pull_t twr_module_sensor_get_pull ( twr_module_sensor_channel_t  channel)

Get pull-up/pull-down configuration for Sensor Module channel.

Parameters
[in]channelSensor Module channel
Returns
Pull-up/pull-down configuration

Definition at line 178 of file twr_module_sensor.c.

Here is the call graph for this function:

◆ twr_module_sensor_init()

bool twr_module_sensor_init ( void  )

Initialize Sensor Module.

Returns
true On success
false On Error

Definition at line 36 of file twr_module_sensor.c.

Referenced by twr_ds18b20_init_multiple(), twr_ds18b20_init_single(), twr_i2c_init(), and twr_pulse_counter_init().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ twr_module_sensor_onewire_power_down()

bool twr_module_sensor_onewire_power_down ( void  )

Semaphore for 1Wire Power down: for R1.1 set VDD Off, for R1.0 pull none on channel A.

Returns
true On success
false On error

Definition at line 363 of file twr_module_sensor.c.

Here is the call graph for this function:

◆ twr_module_sensor_onewire_power_up()

bool twr_module_sensor_onewire_power_up ( void  )

Semaphore for 1Wire Power up: for R1.1 set VDD On, for R1.0 pull up 56R on channel A.

Returns
true On success
false On error

Definition at line 324 of file twr_module_sensor.c.

Referenced by twr_i2c_init().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ twr_module_sensor_set_mode()

void twr_module_sensor_set_mode ( twr_module_sensor_channel_t  channel,
twr_module_sensor_mode_t  mode 
)

Set output mode of Sensor Module channel.

Parameters
[in]channelSensor Module channel
[in]modeDesired mode of operation

Definition at line 212 of file twr_module_sensor.c.

Referenced by twr_pulse_counter_init().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ twr_module_sensor_set_output()

void twr_module_sensor_set_output ( twr_module_sensor_channel_t  channel,
int  state 
)

Set output state of Sensor Module channel.

Parameters
[in]channelSensor Module channel
[in]stateState to be set

Definition at line 222 of file twr_module_sensor.c.

Here is the call graph for this function:

◆ twr_module_sensor_set_pull()

bool twr_module_sensor_set_pull ( twr_module_sensor_channel_t  channel,
twr_module_sensor_pull_t  pull 
)

Set pull of Sensor Module channel.

Parameters
[in]channelSensor Module channel
[in]pullSensor Module pull
Returns
true On success
false On error

Definition at line 70 of file twr_module_sensor.c.

Referenced by twr_i2c_deinit(), twr_module_sensor_onewire_power_down(), twr_module_sensor_onewire_power_up(), and twr_pulse_counter_init().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ twr_module_sensor_set_vdd()

bool twr_module_sensor_set_vdd ( bool  on)

Set VDD On / Off.

Parameters
[in]onOn
Returns
true On success
false On error

Definition at line 237 of file twr_module_sensor.c.

Referenced by twr_module_sensor_onewire_power_down(), and twr_module_sensor_onewire_power_up().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ twr_module_sensor_toggle_output()

void twr_module_sensor_toggle_output ( twr_module_sensor_channel_t  channel)

Toggle output state for Sensor Module channel.

Parameters
[in]channelSensor Module channel

Definition at line 232 of file twr_module_sensor.c.

Here is the call graph for this function: