|
HP85 GPIB Disk Emulator
1.0
HP85GPIBDiskEmulator
|
I2C Interrupt driven driver Total rewrite Reference AVR315 for technical details. More...
#include "user_config.h"Go to the source code of this file.
Typedefs | |
| typedef int8_t(* | i2c_callback_t) (void) |
| I2C task list @ brief I2C callback function Used when automattically sending several transactions. More... | |
Functions | |
| uint8_t | i2c_check_op (int8_t index) |
| Check if I2C structure pointer is valid. More... | |
| void | i2c_task_init () |
| Initialize I2C task op list NOTE: We ASSUME all i2c_task_op[].buf are statically allocated. More... | |
| void | i2c_task_free_ops () |
| Free all allocated memory for i2c_[] pointers NOTE: We ASSUME all i2c_task_op[].buf are statically allocated. More... | |
| i2c_op_t * | i2c_task_op_add (uint8_t address, uint8_t mode, uint8_t *buf, uint8_t len) |
| I2C setup new OP but do not run it yet. More... | |
| int8_t | i2c_task_next_op () |
| I2C task ISR callback function. More... | |
| void | i2c_task_run () |
| Run all valid i2c_task_op[] tasks. More... | |
| void | i2c_init (uint32_t speed) |
| I2C initialize Clear all i2c_task_op[] pointers and disables I2C tasks. More... | |
| int8_t | i2c_ok () |
| check if I2C trasnaction detected an error More... | |
| int8_t | i2c_done () |
| Is i2c structure done sending/receiving ? More... | |
| int8_t | i2c_task_done () |
| Are all i2c_task_op[] pointers done sending/receiving ? More... | |
| uint8_t | i2c_fn (uint8_t address, uint8_t mode, uint8_t *buf, uint8_t len) |
| I2C setup new OP but do not run it yet. More... | |
| void | i2c_send_start () |
| Send I2C START and enable interrupts. More... | |
| void | i2c_send_stop () |
| Send I2C STOP and disable interrupts. More... | |
| static void | i2c_next () |
| Is there anything else to send ? Called after I2C transaction finishes. More... | |
| void | i2c_timer () |
| I2C timer task - check for I2C operation timeouts. More... | |
| ISR (TWI_vect) | |
| I2C ISR for send/receive. More... | |
| void | i2c_print_error (i2c_op_t *o) |
| Display Errors for i2c_task_op[index]. More... | |
| void | i2c_display_task_errors () |
| Display any task errors. More... | |
Variables | |
| i2c_op_t | i2c |
| I2C interrupt state registers. More... | |
| i2c_callback_t | i2c_callback = (i2c_callback_t) NULL |
| i2c_task_t | i2c_task = { 0,0,0,0 } |
| I2C task state. More... | |
| i2c_op_t * | i2c_task_op [I2C_OPS] = { NULL } |
| I2C task list. More... | |
| static int8_t | i2c_init_status = 0 |
I2C Interrupt driven driver Total rewrite Reference AVR315 for technical details.
I2C Interrupt driven driver.
Definition in file i2c.c.
| typedef int8_t(* i2c_callback_t) (void) |
| uint8_t i2c_check_op | ( | int8_t | index | ) |
Check if I2C structure pointer is valid.
| [in] | index | index of i2c_task_op[] array |
Definition at line 40 of file i2c.c.
Referenced by i2c_task_free_ops(), i2c_task_next_op(), and i2c_task_run().
| void i2c_display_task_errors | ( | ) |
| int8_t i2c_done | ( | ) |
| uint8_t i2c_fn | ( | uint8_t | address, |
| uint8_t | mode, | ||
| uint8_t * | buf, | ||
| uint8_t | len | ||
| ) |
I2C setup new OP but do not run it yet.
| [in] | address | I2C address |
| [in] | mode | TW_READ or TW_WRITE |
| [in] | *buf | pointer to buffer for send or receive |
| [in] | len | size of buffer to read or write |
Definition at line 407 of file i2c.c.
Referenced by i2c_rtc_read(), and i2c_rtc_write().
| void i2c_init | ( | uint32_t | speed | ) |
I2C initialize Clear all i2c_task_op[] pointers and disables I2C tasks.
=========================================================================
Definition at line 316 of file i2c.c.
Referenced by i2c_rtc_init(), and main().
|
static |
| int8_t i2c_ok | ( | ) |
| void i2c_print_error | ( | i2c_op_t * | o | ) |
Display Errors for i2c_task_op[index].
| [in] | index | index of i2c_task_op[] array |
Definition at line 660 of file i2c.c.
Referenced by i2c_display_task_errors().
| void i2c_send_start | ( | ) |
Send I2C START and enable interrupts.
Definition at line 451 of file i2c.c.
Referenced by i2c_fn(), i2c_task_next_op(), and i2c_task_run().
| void i2c_send_stop | ( | ) |
Send I2C STOP and disable interrupts.
Definition at line 468 of file i2c.c.
Referenced by i2c_next(), i2c_task_next_op(), and ISR().
| int8_t i2c_task_done | ( | ) |
| void i2c_task_free_ops | ( | ) |
| void i2c_task_init | ( | ) |
| int8_t i2c_task_next_op | ( | ) |
I2C task ISR callback function.
Definition at line 163 of file i2c.c.
Referenced by i2c_task_run().
| i2c_op_t* i2c_task_op_add | ( | uint8_t | address, |
| uint8_t | mode, | ||
| uint8_t * | buf, | ||
| uint8_t | len | ||
| ) |
| void i2c_task_run | ( | ) |
| void i2c_timer | ( | ) |
I2C timer task - check for I2C operation timeouts.
Definition at line 503 of file i2c.c.
Referenced by i2c_init().
| i2c_op_t i2c |
I2C interrupt state registers.
Definition at line 22 of file i2c.c.
Referenced by i2c_done(), i2c_fn(), i2c_init(), i2c_ok(), i2c_print_error(), i2c_send_start(), i2c_send_stop(), i2c_task_next_op(), i2c_task_run(), i2c_timer(), and ISR().
| i2c_callback_t i2c_callback = (i2c_callback_t) NULL |
Definition at line 28 of file i2c.c.
Referenced by i2c_fn(), i2c_next(), and i2c_task_run().
|
static |
Definition at line 309 of file i2c.c.
Referenced by i2c_init().
| i2c_task_t i2c_task = { 0,0,0,0 } |
I2C task state.
Definition at line 31 of file i2c.c.
Referenced by i2c_display_task_errors(), i2c_init(), i2c_task_done(), i2c_task_init(), i2c_task_next_op(), i2c_task_run(), ISR(), and main().
I2C task list.
Definition at line 33 of file i2c.c.
Referenced by i2c_check_op(), i2c_display_task_errors(), i2c_init(), i2c_task_free_ops(), i2c_task_init(), i2c_task_next_op(), and i2c_task_run().
1.8.17