pico-scale
hx711_scale_adaptor.c File Reference
#include <assert.h>
#include <stdbool.h>
#include <stddef.h>
#include <stdint.h>
#include "../extern/hx711-pico-c/include/common.h"
#include "../include/hx711_scale_adaptor.h"

Go to the source code of this file.

Functions

bool hx711_scale_adaptor_init (hx711_scale_adaptor_t *const hxa, hx711_t *const hx)
 
scale_adaptor_thx711_scale_adaptor_get_base (hx711_scale_adaptor_t *const hxa)
 
bool hx711_scale_adaptor_get_value_timeout (scale_adaptor_t *const sa, int32_t *const value, const uint timeout)
 
bool hx711_scale_adaptor_get_value (scale_adaptor_t *const sa, int32_t *const value)
 

Function Documentation

◆ hx711_scale_adaptor_get_base()

scale_adaptor_t* hx711_scale_adaptor_get_base ( hx711_scale_adaptor_t *const  hxa)

Definition at line 47 of file hx711_scale_adaptor.c.

48  {
49  assert(hxa != NULL);
50  return &hxa->_sa;
51 }

References hx711_scale_adaptor_t::_sa.

◆ hx711_scale_adaptor_get_value()

bool hx711_scale_adaptor_get_value ( scale_adaptor_t *const  sa,
int32_t *const  value 
)

Definition at line 66 of file hx711_scale_adaptor.c.

68  {
69 
70  assert(sa != NULL);
71  assert(value != NULL);
72 
74  *value = hx711_get_value(hxa->_hx);
75 
76  return true;
77 
78 }
void * scale_adaptor_get_data(scale_adaptor_t *const sa)
Definition: scale_adaptor.c:35

References hx711_scale_adaptor_t::_hx, and scale_adaptor_get_data().

Referenced by hx711_scale_adaptor_init().

◆ hx711_scale_adaptor_get_value_timeout()

bool hx711_scale_adaptor_get_value_timeout ( scale_adaptor_t *const  sa,
int32_t *const  value,
const uint  timeout 
)

Definition at line 53 of file hx711_scale_adaptor.c.

56  {
57 
58  assert(sa != NULL);
59  assert(value != NULL);
60 
62  return hx711_get_value_timeout(hxa->_hx, value, timeout);
63 
64 }

References hx711_scale_adaptor_t::_hx, and scale_adaptor_get_data().

Referenced by hx711_scale_adaptor_init().

◆ hx711_scale_adaptor_init()

bool hx711_scale_adaptor_init ( hx711_scale_adaptor_t *const  hxa,
hx711_t *const  hx 
)

Definition at line 30 of file hx711_scale_adaptor.c.

32  {
33 
34  assert(hxa != NULL);
35  assert(hx != NULL);
36 
37  hxa->_hx = hx;
38 
39  scale_adaptor_init(&hxa->_sa, hxa);
42 
43  return true;
44 
45 }
bool hx711_scale_adaptor_get_value(scale_adaptor_t *const sa, int32_t *const value)
bool hx711_scale_adaptor_get_value_timeout(scale_adaptor_t *const sa, int32_t *const value, const uint timeout)
bool scale_adaptor_init(scale_adaptor_t *const sa, void *data)
Definition: scale_adaptor.c:27
bool(* get_value)(struct scale_adaptor *const sa, int32_t *const value)
Function pointer to function.
Definition: scale_adaptor.h:46
bool(* get_value_timeout)(struct scale_adaptor *const sa, int32_t *const value, const uint timeout)
Function pointer to function.
Definition: scale_adaptor.h:56

References hx711_scale_adaptor_t::_hx, hx711_scale_adaptor_t::_sa, scale_adaptor::get_value, scale_adaptor::get_value_timeout, hx711_scale_adaptor_get_value(), hx711_scale_adaptor_get_value_timeout(), and scale_adaptor_init().