Project

General

Profile

Revision 1496

Reverted "libdragonfly" folder back to version before Init Checking was implemented and did "make dist" to recompile the library. BOM LEDs now shine
correctly.

View differences:

rangefinder.c
59 59
*/
60 60
#include <avr/pgmspace.h>
61 61

  
62
#include "dragonfly_defs.h"
62
#include "rangefinder.h"
63 63
#include "analog.h"
64 64
#include "dio.h"
65
#include "rangefinder.h"
66 65

  
67
unsigned char range_initd=0;
68

  
69

  
70 66
/*
71 67
  read_distance returns the 8-bit reading from the rangefinder
72 68
  parameters:
......
116 112
 * Initializes the rangefinders. This must be called before
117 113
 * range_read_distance.
118 114
 *
119
 * @return 0 if init succesfull, an error code otherwise
120
 *
121 115
 * @see range_read_distance
122 116
 **/
123
int range_init(void)
117
void range_init(void)
124 118
{
125
  if(range_initd)
126
    return ERROR_INIT_ALREADY_INITD;
127

  
128 119
  digital_output(_PIN_B4,0);
129

  
130
  range_initd=1;
131
  return 0;
132 120
}
133 121

  
134 122
/**
......
138 126
 * @param range_id the rangefinder to use. This should be one
139 127
 * of the constants IR1 - IR5.
140 128
 *
141
 * @return the distance measured by the rangefinder, or an error code
129
 * @return the distance measured by the rangefinder
142 130
 *
143 131
 * @see range_init
144 132
 **/
145 133
int range_read_distance(int range_id) {
146
  if(!range_initd)
147
    return -3;
148

  
149 134
  return linearize_distance(analog8(range_id));
150 135
}
151 136

  

Also available in: Unified diff