Firmware SDK
twr_module_sensor.h
1 #ifndef _TWR_MODULE_SENSOR_H
2 #define _TWR_MODULE_SENSOR_H
3 
4 #include <twr_gpio.h>
5 #include <twr_onewire.h>
6 
10 
12 
13 typedef enum
14 {
17 
20 
23 
25 
27 
28 typedef enum
29 {
32 
35 
38 
41 
44 
46 
48 
49 typedef enum
50 {
53 
56 
58 
60 
61 typedef enum
62 {
65 
68 
71 
73 
77 
78 bool twr_module_sensor_init(void);
79 
81 
82 void twr_module_sensor_deinit(void);
83 
89 
91 
95 
97 
101 
103 
107 
109 
113 
115 
119 
121 
125 
127 
130 
132 
137 
138 bool twr_module_sensor_set_vdd(bool on);
139 
141 
143 
146 
148 
152 
154 
158 
160 
162 
163 
164 #endif // _TWR_MODULE_SENSOR_H
@ TWR_GPIO_MODE_INPUT
GPIO channel operates as input.
Definition: twr_gpio.h:105
@ TWR_GPIO_MODE_OUTPUT
GPIO channel operates as output.
Definition: twr_gpio.h:108
@ TWR_GPIO_PULL_NONE
GPIO channel has no pull-up/pull-down.
Definition: twr_gpio.h:90
@ TWR_GPIO_PULL_DOWN
GPIO channel has pull-down.
Definition: twr_gpio.h:96
@ TWR_GPIO_PULL_UP
GPIO channel has pull-up.
Definition: twr_gpio.h:93
twr_module_sensor_revision_t twr_module_sensor_get_revision(void)
Get Sensor Module revision.
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.
int twr_module_sensor_get_output(twr_module_sensor_channel_t channel)
Get output state for Sensor Module channel.
void twr_module_sensor_toggle_output(twr_module_sensor_channel_t channel)
Toggle output state for Sensor Module channel.
twr_module_sensor_mode_t twr_module_sensor_get_mode(twr_module_sensor_channel_t channel)
Get mode of operation for Sensor Module channel.
twr_module_sensor_revision_t
Sensor Module hardware revision.
int twr_module_sensor_get_input(twr_module_sensor_channel_t channel)
Get input of Sensor Module channel.
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.
twr_onewire_t * twr_module_sensor_get_onewire(void)
Initialize and get Instance 1-Wire for channel B.
void twr_module_sensor_set_output(twr_module_sensor_channel_t channel, int state)
Set output state of Sensor Module channel.
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.
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.
bool twr_module_sensor_set_vdd(bool on)
Set VDD On / Off.
bool twr_module_sensor_init(void)
Initialize Sensor Module.
twr_module_sensor_mode_t
Sensor Module mode of operation.
twr_module_sensor_pull_t
Sensor module 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.
twr_module_sensor_channel_t
Sensor Module channels.
void twr_module_sensor_deinit(void)
Deinitialize Sensor Module.
@ 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.
@ TWR_MODULE_SENSOR_MODE_INPUT
Channel operates as input.
@ TWR_MODULE_SENSOR_MODE_OUTPUT
Channel operates as output.
@ TWR_MODULE_SENSOR_PULL_UP_4K7
Channel has pull-up 4k7.
@ TWR_MODULE_SENSOR_PULL_DOWN_INTERNAL
Channel has internal pull-down.
@ TWR_MODULE_SENSOR_PULL_UP_INTERNAL
Channel has internal pull-up.
@ TWR_MODULE_SENSOR_PULL_NONE
Channel has no pull.
@ TWR_MODULE_SENSOR_PULL_UP_56R
Channel has pull-up 56R.
@ TWR_MODULE_SENSOR_CHANNEL_B
Channel B.
@ TWR_MODULE_SENSOR_CHANNEL_A
Channel A.
@ TWR_MODULE_SENSOR_CHANNEL_C
Channel C.
struct twr_onewire_t twr_onewire_t
1-Wire instance
Definition: twr_onewire.h:14