42#define CHIP_NAME "Renesas X9CXX"
43#define MANUFACTURER_NAME "Renesas"
44#define SUPPLY_VOLTAGE_MIN 4.5f
45#define SUPPLY_VOLTAGE_MAX 5.5f
46#define MAX_CURRENT 3.0f
47#define TEMPERATURE_MIN -40.0f
48#define TEMPERATURE_MAX 85.0f
49#define DRIVER_VERSION 1000
60static uint8_t a_x9cxx_step_prev(
x9cxx_handle_t *handle, uint8_t inc)
128 if (handle->
step > 99)
135 if (handle->
step != 0)
190 for (i = 0; i < 100; i++)
299 handle->
debug_print(
"x9cxx: cs_gpio_init is null.\n");
305 handle->
debug_print(
"x9cxx: cs_gpio_deinit is null.\n");
311 handle->
debug_print(
"x9cxx: cs_gpio_write is null.\n");
317 handle->
debug_print(
"x9cxx: up_down_gpio_init is null.\n");
323 handle->
debug_print(
"x9cxx: up_down_gpio_deinit is null.\n");
329 handle->
debug_print(
"x9cxx: up_down_gpio_write is null.\n");
335 handle->
debug_print(
"x9cxx: inc_gpio_init is null.\n");
341 handle->
debug_print(
"x9cxx: inc_gpio_deinit is null.\n");
347 handle->
debug_print(
"x9cxx: inc_gpio_write is null.\n");
366 handle->
debug_print(
"x9cxx: cs gpio init failed.\n");
372 handle->
debug_print(
"x9cxx: up down gpio init failed.\n");
379 handle->
debug_print(
"x9cxx: inc gpio init failed.\n");
388 handle->
debug_print(
"x9cxx: up down gpio write failed.\n");
398 handle->
debug_print(
"x9cxx: inc gpio write failed.\n");
408 handle->
debug_print(
"x9cxx: cs gpio write failed.\n");
445 handle->
debug_print(
"x9cxx: cs gpio deinit failed.\n");
451 handle->
debug_print(
"x9cxx: up down gpio deinit failed.\n");
457 handle->
debug_print(
"x9cxx: inc gpio deinit failed.\n");
490 res = a_x9cxx_reset(handle, 0);
500 res = a_x9cxx_store(handle);
510 res = a_x9cxx_no_store(handle);
546 res = a_x9cxx_reset(handle, 1);
556 res = a_x9cxx_store(handle);
566 res = a_x9cxx_no_store(handle);
608 res = a_x9cxx_step_prev(handle, 1);
615 for (i = 0; i < step; i++)
617 res = a_x9cxx_step(handle, 1);
628 res = a_x9cxx_store(handle);
638 res = a_x9cxx_no_store(handle);
680 res = a_x9cxx_step_prev(handle, 0);
687 for (i = 0; i < step; i++)
689 res = a_x9cxx_step(handle, 0);
700 res = a_x9cxx_store(handle);
710 res = a_x9cxx_no_store(handle);
743 if (handle->
valid == 0)
745 handle->
debug_print(
"x9cxx: step counter is invalid.\n");
750 *counter = handle->
step;
783 if (handle->
valid == 0)
785 handle->
debug_print(
"x9cxx: step counter is invalid.\n");
795 if (counter == handle->
step)
800 if (counter < handle->step)
802 res = a_x9cxx_step_prev(handle, 0);
809 while (counter < handle->step)
811 res = a_x9cxx_step(handle, 0);
822 res = a_x9cxx_step_prev(handle, 1);
829 while (counter > handle->
step)
831 res = a_x9cxx_step(handle, 1);
843 res = a_x9cxx_store(handle);
853 res = a_x9cxx_no_store(handle);
881 handle->
type = (uint32_t)type;
929 *step = (uint8_t)(ohm / ((
float)(handle->
type) / 99.0f));
956 *ohm = (float)(step) * ((float)(handle->
type) / 99.0f);
#define SUPPLY_VOLTAGE_MAX
#define MANUFACTURER_NAME
#define SUPPLY_VOLTAGE_MIN
#define CHIP_NAME
chip information definition
struct x9cxx_handle_s x9cxx_handle_t
x9cxx handle structure definition
uint8_t x9cxx_set_absolute_step_counter(x9cxx_handle_t *handle, uint8_t counter, x9cxx_bool_t store_enable)
set absolute step counter
uint8_t x9cxx_increment(x9cxx_handle_t *handle, uint8_t step, x9cxx_bool_t store_enable)
increment
struct x9cxx_info_s x9cxx_info_t
x9cxx information structure definition
uint8_t x9cxx_set_type(x9cxx_handle_t *handle, x9cxx_type_t type)
set chip type
x9cxx_type_t
x9cxx type enumeration definition
uint8_t x9cxx_get_step_counter(x9cxx_handle_t *handle, uint8_t *counter)
get step counter
#define X9CXX_STORE_DELAY_MS
x9cxx store delay definition
uint8_t x9cxx_decrement(x9cxx_handle_t *handle, uint8_t step, x9cxx_bool_t store_enable)
decrement
uint8_t x9cxx_get_type(x9cxx_handle_t *handle, x9cxx_type_t *type)
get chip type
uint8_t x9cxx_resistor_convert_to_register(x9cxx_handle_t *handle, float ohm, uint8_t *step)
resistor convert to register
uint8_t x9cxx_reset_to_min(x9cxx_handle_t *handle, x9cxx_bool_t store_enable)
reset to min
x9cxx_bool_t
x9cxx bool enumeration definition
#define X9CXX_OPERATE_DELAY_US
x9cxx operate delay definition
uint8_t x9cxx_info(x9cxx_info_t *info)
get chip's information
uint8_t x9cxx_init(x9cxx_handle_t *handle)
initialize the chip
uint8_t x9cxx_resistor_convert_to_data(x9cxx_handle_t *handle, uint8_t step, float *ohm)
resistor convert to data
#define X9CXX_STEP_DELAY_US
x9cxx step delay definition
uint8_t x9cxx_reset_to_max(x9cxx_handle_t *handle, x9cxx_bool_t store_enable)
reset to max
uint8_t x9cxx_deinit(x9cxx_handle_t *handle)
close the chip
uint8_t(* inc_gpio_init)(void)
void(* delay_ms)(uint32_t ms)
uint8_t(* cs_gpio_deinit)(void)
void(* debug_print)(const char *const fmt,...)
uint8_t(* inc_gpio_write)(uint8_t value)
void(* delay_us)(uint32_t us)
uint8_t(* up_down_gpio_write)(uint8_t value)
uint8_t(* cs_gpio_init)(void)
uint8_t(* up_down_gpio_deinit)(void)
uint8_t(* up_down_gpio_init)(void)
uint8_t(* inc_gpio_deinit)(void)
uint8_t(* cs_gpio_write)(uint8_t value)
float supply_voltage_max_v
char manufacturer_name[32]
float supply_voltage_min_v