view main/robots/odr-display/func.h @ 235:8af48f7c2f34 main

Initial commit for the odr-display node.
author Bob Cook <bob@bobcookdev.com>
date Sat, 12 Jul 2014 13:20:14 -0700
parents
children 43f43ebe35df
line wrap: on
line source

// ----------------------------------------------------------------------------------------
//
//  Copyright (C) 2014 Bob Cook
//    
//  Bob Cook Development, Robotics Library
//  http://www.bobcookdev.com/rl/
// 
//  Function prototypes.
//
//  Permission is hereby granted, free of charge, to any person obtaining a copy
//  of this software and associated documentation files (the "Software"), to deal
//  in the Software without restriction, including without limitation the rights
//  to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
//  copies of the Software, and to permit persons to whom the Software is
//  furnished to do so, subject to the following conditions:
// 
//  The above copyright notice and this permission notice shall be included in
//  all copies or substantial portions of the Software.
// 
//  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
//  IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
//  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
//  AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
//  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
//  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
//  THE SOFTWARE.
//
// ----------------------------------------------------------------------------------------

#if !defined( FUNC_H )
#define FUNC_H

#include <stdint.h>

// ----------------------------------------------------------------------------------------

typedef enum
{
    button_not_pressed_e = 0x00,
    button_center_e,
    button_up_e,
    button_down_e,
    button_left_e,
    button_right_e

} button_press_t;

void button_init();
void button_update();

bool           button_is_pressed();
button_press_t button_state();

// ----------------------------------------------------------------------------------------

void status_init();
void status_update();

void status_got_heartbeat( uint8_t node );
void status_got_emergency( uint8_t node );
void status_got_all_clear( uint8_t node );
void status_got_mgr_update();
void status_got_sonar_front_enabled();
void status_got_sonar_front_disabled();
void status_got_gps_fix( bool has_fix );

bool status_is_emergency();
bool status_is_mgr_up();
bool status_is_estop_active();
bool status_is_motion_ctl_alive();
bool status_is_sonar_front_up();
bool status_is_sonar_front_enabled();
bool status_is_gps_up();
bool status_does_gps_have_fix();

// ----------------------------------------------------------------------------------------

void display_init();
void display_refresh();

void display_sleep();
void display_wake();

void display_set_mgr_status( const char* msg, uint8_t length );
void display_clear_mgr_status();

void display_update_wheel_speed( int8_t front, int8_t rear );
void display_update_wheel_position( int8_t front, int8_t rear );

void display_update_sonar_front( uint8_t l, uint8_t c_l, uint8_t c_r, uint8_t r );

void display_update_yaw( int32_t value );
void display_update_pitch( int32_t value );
void display_update_roll( int32_t value );

void display_update_latitude( int16_t degrees, int32_t min_thousandths );
void display_update_longitude( int16_t degrees, int32_t min_thousandths );
void display_update_gps_fix( uint8_t satellites );

void display_update_button_1( bool down );
void display_update_button_2( bool down );

// ----------------------------------------------------------------------------------------

bool canmsg_init();
bool canmsg_did_error_occur();
bool canmsg_send_emergency();
bool canmsg_send_all_clear();
bool canmsg_send_heartbeat();
bool canmsg_send_button_status();
bool canmsg_process_pending();

// ----------------------------------------------------------------------------------------
#endif // #if !defined( FUNC_H )