Definition in file pushb.h.
#include "compiler.h"
#include "FreeRTOS.h"
#include "datalog.h"
Go to the source code of this file.
Functions | |
Bool | b_pushb1_get_value (xLogDef *pxLog) |
Get a pushbutton current state. | |
Bool | b_pushb1_init (void) |
Init the push button 1 sensor. | |
Bool | b_pushb2_get_value (xLogDef *pxLog) |
Get a pushbutton current state. | |
Bool | b_pushb2_init (void) |
Init the push button 2 sensor. | |
Bool | b_pushb3_get_value (xLogDef *pxLog) |
Get a pushbutton current state. | |
Bool | b_pushb3_init (void) |
Init the push button 3 sensor. | |
eExecStatus | e_pushb1_get_config (signed portCHAR **ppcStringReply) |
Get the pushbutton1 sensor config. | |
eExecStatus | e_pushb1_set_config (signed portCHAR **ppcStringReply, int ac, signed portCHAR *av[]) |
Set the sensor config. | |
eExecStatus | e_pushb2_get_config (signed portCHAR **ppcStringReply) |
Get the pushbutton2 sensor config. | |
eExecStatus | e_pushb2_set_config (signed portCHAR **ppcStringReply, int ac, signed portCHAR *av[]) |
Set the sensor config. | |
eExecStatus | e_pushb3_get_config (signed portCHAR **ppcStringReply) |
Get the pushbutton3 sensor config. | |
eExecStatus | e_pushb3_set_config (signed portCHAR **ppcStringReply, int ac, signed portCHAR *av[]) |
Set the sensor config. | |
void | v_pushb1_stop (void) |
Stop the push button 1 sensor. | |
void | v_pushb2_stop (void) |
Stop the push button 2 sensor. | |
void | v_pushb3_stop (void) |
Stop the push button 1 sensor. |
Bool b_pushb1_get_value | ( | xLogDef * | pxLog | ) |
Get a pushbutton current state.
pxLog | a Log structure. The id field identifies the pushbutton. |
Definition at line 360 of file pushb.c.
References acpc_pushb_events, b_pushb1, LogDef::pcStringLog, and LogDef::pfFreeStringLog.
Referenced by b_sensor_get_value().
00361 { 00362 // Build the log string. 00363 pxLog->pfFreeStringLog = NULL; // We use a constant. 00364 pxLog->pcStringLog = (portCHAR *)acpc_pushb_events[b_pushb1]; 00365 00366 return( TRUE ); 00367 }
Bool b_pushb1_init | ( | void | ) |
Init the push button 1 sensor.
Definition at line 133 of file pushb.c.
References bAlarm1, config_file_get_value(), PB1_POSITION, SENSOR_PB1_CONFIG_FILE, vpushb_ISR(), x_supervisor_SemaphoreGive(), x_supervisor_SemaphoreTake(), and xCFGMutex.
00134 { 00135 portCHAR token[6]; 00136 00137 // Get the xCFGMutex. 00138 if( pdTRUE == x_supervisor_SemaphoreTake( xCFGMutex, 20 ) ) 00139 { 00140 // get the field 00141 if (config_file_get_value(SENSOR_PB1_CONFIG_FILE, "alarm" , token) >= 0) 00142 { 00143 // update value 00144 if (!strcmp(token, "on")) 00145 { 00146 bAlarm1 = pdTRUE; 00147 } 00148 } 00149 // Release the xCFGMutex. 00150 x_supervisor_SemaphoreGive( xCFGMutex ); 00151 } 00152 /* configure push button to produce IT on input change */ 00153 gpio_enable_pin_interrupt(PB1_POSITION , GPIO_PIN_CHANGE); 00154 /* Disable all interrupts */ 00155 Disable_global_interrupt(); 00156 /* register push button 1 handler on level 3 */ 00157 INTC_register_interrupt( (__int_handler)&vpushb_ISR, AVR32_GPIO_IRQ_0 + (PB1_POSITION/8), AVR32_INTC_INT3); 00158 /* Enable all interrupts */ 00159 Enable_global_interrupt(); 00160 return (TRUE); 00161 }
Bool b_pushb2_get_value | ( | xLogDef * | pxLog | ) |
Get a pushbutton current state.
pxLog | a Log structure. The id field identifies the pushbutton. |
Definition at line 376 of file pushb.c.
References acpc_pushb_events, b_pushb2, LogDef::pcStringLog, and LogDef::pfFreeStringLog.
Referenced by b_sensor_get_value().
00377 { 00378 // Build the log string. 00379 pxLog->pfFreeStringLog = NULL; // We use a constant. 00380 pxLog->pcStringLog = (portCHAR *)acpc_pushb_events[b_pushb2]; 00381 00382 return( TRUE ); 00383 }
Bool b_pushb2_init | ( | void | ) |
Init the push button 2 sensor.
Definition at line 177 of file pushb.c.
References bAlarm2, config_file_get_value(), PB2_POSITION, SENSOR_PB2_CONFIG_FILE, vpushb_ISR(), x_supervisor_SemaphoreGive(), x_supervisor_SemaphoreTake(), and xCFGMutex.
00178 { 00179 portCHAR token[6]; 00180 00181 // Get the xCFGMutex. 00182 if( pdTRUE == x_supervisor_SemaphoreTake( xCFGMutex, 20 ) ) 00183 { 00184 // get the field 00185 if (config_file_get_value(SENSOR_PB2_CONFIG_FILE, "alarm" , token) >= 0) 00186 { 00187 // update value 00188 if (!strcmp(token, "on")) 00189 { 00190 bAlarm2 = pdTRUE; 00191 } 00192 } 00193 // Release the xCFGMutex. 00194 x_supervisor_SemaphoreGive( xCFGMutex ); 00195 } 00196 /* configure push button to produce IT on input change */ 00197 gpio_enable_pin_interrupt(PB2_POSITION , GPIO_PIN_CHANGE); 00198 /* Disable all interrupts */ 00199 Disable_global_interrupt(); 00200 /* register push button 2 handler on level 3 */ 00201 INTC_register_interrupt( (__int_handler)&vpushb_ISR, AVR32_GPIO_IRQ_0 + (PB2_POSITION/8), AVR32_INTC_INT3); 00202 /* Enable all interrupts */ 00203 Enable_global_interrupt(); 00204 return (TRUE); 00205 }
Bool b_pushb3_get_value | ( | xLogDef * | pxLog | ) |
Get a pushbutton current state.
pxLog | a Log structure. The id field identifies the pushbutton. |
Definition at line 392 of file pushb.c.
References acpc_pushb_events, b_pushb3, LogDef::pcStringLog, and LogDef::pfFreeStringLog.
Referenced by b_sensor_get_value().
00393 { 00394 // Build the log string. 00395 pxLog->pfFreeStringLog = NULL; // We use a constant. 00396 pxLog->pcStringLog = (portCHAR *)acpc_pushb_events[b_pushb3]; 00397 00398 return( TRUE ); 00399 }
Bool b_pushb3_init | ( | void | ) |
Init the push button 3 sensor.
Definition at line 221 of file pushb.c.
References bAlarm3, config_file_get_value(), PB3_POSITION, SENSOR_PB3_CONFIG_FILE, vpushb_ISR(), x_supervisor_SemaphoreGive(), x_supervisor_SemaphoreTake(), and xCFGMutex.
00222 { 00223 portCHAR token[6]; 00224 00225 // Get the xCFGMutex. 00226 if( pdTRUE == x_supervisor_SemaphoreTake( xCFGMutex, 20 ) ) 00227 { 00228 // get the field 00229 if (config_file_get_value(SENSOR_PB3_CONFIG_FILE, "alarm" , token) >= 0) 00230 { 00231 // update value 00232 if (!strcmp(token, "on")) 00233 { 00234 bAlarm3 = pdTRUE; 00235 } 00236 } 00237 // Release the xCFGMutex. 00238 x_supervisor_SemaphoreGive( xCFGMutex ); 00239 } 00240 /* configure push button to produce IT on input change */ 00241 gpio_enable_pin_interrupt(PB3_POSITION , GPIO_PIN_CHANGE); 00242 /* Disable all interrupts */ 00243 Disable_global_interrupt(); 00244 /* register push button 3 handler on level 3 */ 00245 INTC_register_interrupt( (__int_handler)&vpushb_ISR, AVR32_GPIO_IRQ_0 + (PB3_POSITION/8), AVR32_INTC_INT3); 00246 /* Enable all interrupts */ 00247 Enable_global_interrupt(); 00248 return (TRUE); 00249 }
eExecStatus e_pushb1_get_config | ( | signed portCHAR ** | ppcStringReply | ) |
Get the pushbutton1 sensor config.
ppcStringReply | Input/Output. The response string. NEVER NULL AS INPUT. A malloc for the response string is performed here; the caller must free this string. |
Definition at line 269 of file pushb.c.
References bAlarm1, and prv_e_pushb_get_config().
00270 { 00271 return( prv_e_pushb_get_config( ppcStringReply, bAlarm1 ) ); 00272 }
eExecStatus e_pushb1_set_config | ( | signed portCHAR ** | ppcStringReply, | |
int | ac, | |||
signed portCHAR * | av[] | |||
) |
Set the sensor config.
ppcStringReply | Input/Output. The response string. NEVER NULL AS INPUT. | |
ac | Input. Number of args | |
av | Input. pointer to args |
ac | Input. The argument counter. For this command, should be 2. | |
av | Input. The argument vector. | |
ppcStringReply | Input/Output. The response string. If Input is NULL, no response string will be output. Else a malloc for the response string is performed here; the caller must free this string. |
Definition at line 318 of file pushb.c.
References bAlarm1, prv_e_pushb_set_config(), and SENSOR_PB1_CONFIG_FILE.
00319 { 00320 return (prv_e_pushb_set_config(&bAlarm1, SENSOR_PB1_CONFIG_FILE, ppcStringReply, ac, av)); 00321 }
eExecStatus e_pushb2_get_config | ( | signed portCHAR ** | ppcStringReply | ) |
Get the pushbutton2 sensor config.
ppcStringReply | Input/Output. The response string. NEVER NULL AS INPUT. A malloc for the response string is performed here; the caller must free this string. |
Definition at line 284 of file pushb.c.
References bAlarm2, and prv_e_pushb_get_config().
00285 { 00286 return( prv_e_pushb_get_config( ppcStringReply, bAlarm2 ) ); 00287 }
eExecStatus e_pushb2_set_config | ( | signed portCHAR ** | ppcStringReply, | |
int | ac, | |||
signed portCHAR * | av[] | |||
) |
Set the sensor config.
ppcStringReply | Input/Output. The response string. NEVER NULL AS INPUT. | |
ac | Input. Number of args | |
av | Input. pointer to args |
ac | Input. The argument counter. For this command, should be 2. | |
av | Input. The argument vector. | |
ppcStringReply | Input/Output. The response string. |
Definition at line 333 of file pushb.c.
References bAlarm2, prv_e_pushb_set_config(), and SENSOR_PB2_CONFIG_FILE.
00334 { 00335 return (prv_e_pushb_set_config(&bAlarm2, SENSOR_PB2_CONFIG_FILE, ppcStringReply, ac, av)); 00336 }
eExecStatus e_pushb3_get_config | ( | signed portCHAR ** | ppcStringReply | ) |
Get the pushbutton3 sensor config.
ppcStringReply | Input/Output. The response string. NEVER NULL AS INPUT. A malloc for the response string is performed here; the caller must free this string. |
Definition at line 299 of file pushb.c.
References bAlarm3, and prv_e_pushb_get_config().
00300 { 00301 return( prv_e_pushb_get_config( ppcStringReply, bAlarm3 ) ); 00302 }
eExecStatus e_pushb3_set_config | ( | signed portCHAR ** | ppcStringReply, | |
int | ac, | |||
signed portCHAR * | av[] | |||
) |
Set the sensor config.
ppcStringReply | Input/Output. The response string. NEVER NULL AS INPUT. | |
ac | Input. Number of args | |
av | Input. pointer to args |
ac | Input. The argument counter. For this command, should be 2. | |
av | Input. The argument vector. | |
ppcStringReply | Input/Output. The response string. |
Definition at line 348 of file pushb.c.
References bAlarm3, prv_e_pushb_set_config(), and SENSOR_PB3_CONFIG_FILE.
00349 { 00350 return (prv_e_pushb_set_config(&bAlarm3, SENSOR_PB3_CONFIG_FILE, ppcStringReply, ac, av)); 00351 }
void v_pushb1_stop | ( | void | ) |
Stop the push button 1 sensor.
Definition at line 166 of file pushb.c.
References PB1_POSITION.
00167 { 00168 /* Disable the IT. */ 00169 gpio_disable_pin_interrupt( PB1_POSITION ); 00170 }
void v_pushb2_stop | ( | void | ) |
Stop the push button 2 sensor.
Definition at line 210 of file pushb.c.
References PB2_POSITION.
00211 { 00212 /* Disable the IT. */ 00213 gpio_disable_pin_interrupt( PB2_POSITION ); 00214 }
void v_pushb3_stop | ( | void | ) |
Stop the push button 1 sensor.
Definition at line 254 of file pushb.c.
References PB3_POSITION.
00255 { 00256 /* Disable the IT. */ 00257 gpio_disable_pin_interrupt( PB3_POSITION ); 00258 }