Developer World
Spresense Arduino Library v3.3.0-b2e6327
AccelSensor.h
Go to the documentation of this file.
1/*
2 * AccelSensor.h - Sensing include file for the Spresense SDK
3 * Copyright 2019 Sony Semiconductor Solutions Corporation
4 *
5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Lesser General Public
7 * License as published by the Free Software Foundation; either
8 * version 2.1 of the License, or (at your option) any later version.
9 *
10 * This library is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Lesser General Public License for more details.
14 *
15 * You should have received a copy of the GNU Lesser General Public
16 * License along with this library; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
18 */
19
29#ifndef __ACCELSENSOR_H
30#define __ACCELSENSOR_H
31
32#include <SensorClient.h>
33
34
36{
37public:
38
44 bool begin(int id,
45 int rate,
46 int sample_watermark_num,
47 int size_per_sample = sizeof(struct accel_float_s));
48
53 int write_data(float x, float y, float z);
54
60 bool end(void);
61
62private:
63 bool begin(int id,
64 uint32_t subscriptions = 0,
65 int rate = 0,
66 int sample_watermark_num = 0,
67 int size_per_sample = 0);
68
69 struct accel_float_s
70 {
71 float x; /* X axis standard gravity acceleration.[G] */
72 float y; /* Y axis standard gravity acceleration.[G] */
73 float z; /* Z axis standard gravity acceleration.[G] */
74 };
75
76 int m_cnt; /* private counter */
77 unsigned long m_previous_time;
78 MemMgrLite::MemHandle m_mh;
79
80};
81
82extern AccelSensorClass AccelSensor;
83
84#endif /* __ACCELSENSOR_H */
Sensor Library Class for Arduino on Spresense.
Definition: AccelSensor.h:36
bool begin(int id, int rate, int sample_watermark_num, int size_per_sample=sizeof(struct accel_float_s))
Start sensing of Accelerometer.
bool end(void)
Stop sensing of Accelerometer.
int write_data(float x, float y, float z)
1 Sample data write.
Definition: SensorClient.h:160