bmp280 ds1307 hmc5883l update
This commit is contained in:
parent
d0ee1b06f3
commit
d93c441da0
10 changed files with 169 additions and 160 deletions
|
|
@ -11,11 +11,13 @@
|
|||
#include <stdint.h>
|
||||
#include <stdbool.h>
|
||||
#include <time.h>
|
||||
#include <i2c/i2c.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#define DS1307_ADDR 0x68
|
||||
/**
|
||||
* Squarewave frequency
|
||||
*/
|
||||
|
|
@ -31,62 +33,62 @@ typedef enum _ds1307_squarewave_freq_t
|
|||
* \brief Start/stop clock
|
||||
* \param start Start clock if true
|
||||
*/
|
||||
void ds1307_start(bool start);
|
||||
void ds1307_start(i2c_dev_t* dev, bool start);
|
||||
|
||||
/**
|
||||
* \brief Get current clock state
|
||||
* \return true if clock running
|
||||
*/
|
||||
bool ds1307_is_running();
|
||||
bool ds1307_is_running(i2c_dev_t* dev);
|
||||
|
||||
/**
|
||||
* \brief Get current time
|
||||
* \param time Pointer to the time struct to fill
|
||||
*/
|
||||
void ds1307_get_time(struct tm *time);
|
||||
void ds1307_get_time(i2c_dev_t* dev, struct tm *time);
|
||||
|
||||
/**
|
||||
* \brief Set time to RTC
|
||||
* \param time Pointer to the time struct
|
||||
*/
|
||||
void ds1307_set_time(const struct tm *time);
|
||||
void ds1307_set_time(i2c_dev_t* dev, const struct tm *time);
|
||||
|
||||
/**
|
||||
* \brief Enable or disable square-wave oscillator output
|
||||
* \param enable Enable oscillator if true
|
||||
*/
|
||||
void ds1307_enable_squarewave(bool enable);
|
||||
void ds1307_enable_squarewave(i2c_dev_t* dev, bool enable);
|
||||
|
||||
/**
|
||||
* \brief Get square-wave oscillator output
|
||||
* \return true if square-wave oscillator enabled
|
||||
*/
|
||||
bool ds1307_is_squarewave_enabled();
|
||||
bool ds1307_is_squarewave_enabled(i2c_dev_t* dev);
|
||||
|
||||
/**
|
||||
* \brief Set square-wave oscillator frequency
|
||||
* \param freq Frequency
|
||||
*/
|
||||
void ds1307_set_squarewave_freq(ds1307_squarewave_freq_t freq);
|
||||
void ds1307_set_squarewave_freq(i2c_dev_t* dev, ds1307_squarewave_freq_t freq);
|
||||
|
||||
/**
|
||||
* \brief Get current square-wave oscillator frequency
|
||||
* \return Frequency
|
||||
*/
|
||||
ds1307_squarewave_freq_t ds1307_get_squarewave_freq();
|
||||
ds1307_squarewave_freq_t ds1307_get_squarewave_freq(i2c_dev_t* dev);
|
||||
|
||||
/**
|
||||
* \brief Get current output level of the SQW/OUT pin
|
||||
* \return true if high
|
||||
*/
|
||||
bool ds1307_get_output();
|
||||
bool ds1307_get_output(i2c_dev_t* dev);
|
||||
|
||||
/**
|
||||
* \brief Set output level of the SQW/OUT pin
|
||||
* Set output level if square-wave output is disabled
|
||||
* \param value High level if true
|
||||
*/
|
||||
void ds1307_set_output(bool value);
|
||||
void ds1307_set_output(i2c_dev_t* dev, bool value);
|
||||
|
||||
/**
|
||||
* \brief Read RAM contents into the buffer
|
||||
|
|
@ -95,7 +97,7 @@ void ds1307_set_output(bool value);
|
|||
* \param len Bytes to read, 1..56
|
||||
* \return Non-zero if error occured
|
||||
*/
|
||||
int ds1307_read_ram(uint8_t offset, uint8_t *buf, uint8_t len);
|
||||
int ds1307_read_ram(i2c_dev_t* dev, uint8_t offset, uint8_t *buf, uint8_t len);
|
||||
|
||||
/**
|
||||
* \brief Write buffer to RTC RAM
|
||||
|
|
@ -104,7 +106,7 @@ int ds1307_read_ram(uint8_t offset, uint8_t *buf, uint8_t len);
|
|||
* \param len Bytes to write, 1..56
|
||||
* \return Non-zero if error occured
|
||||
*/
|
||||
int ds1307_write_ram(uint8_t offset, uint8_t *buf, uint8_t len);
|
||||
int ds1307_write_ram(i2c_dev_t* dev, uint8_t offset, uint8_t *buf, uint8_t len);
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue