contrib/firmware: add 'send not acknowledged' function to the i2c bit-banging implementation

Change-Id: I60597ebc126da4acb00654513b96f52261253e12
Signed-off-by: Ahmed BOUDJELIDA <aboudjelida@nanoxplore.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/7811
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
This commit is contained in:
Ahmed BOUDJELIDA 2023-10-16 11:05:59 +02:00 committed by Antonio Borneo
parent a69a4e23f4
commit bb27677219
3 changed files with 14 additions and 0 deletions

View File

@ -19,6 +19,7 @@ void repeated_start(void);
void stop_cd(void);
void clock_cd(void);
void send_ack(void);
void send_nack(void);
bool get_ack(void);
uint8_t get_address(uint8_t adr, uint8_t rdwr);

View File

@ -60,6 +60,16 @@ void send_ack(void)
delay_us(1);
}
void send_nack(void)
{
PIN_SDA = 1;
delay_us(1);
PIN_SCL = 1;
delay_us(1);
PIN_SCL = 0;
delay_us(1);
}
bool get_ack(void)
{
PIN_SDA_DIR = 1;

View File

@ -798,6 +798,9 @@ void i2c_recieve(void)
EP8FIFOBUF[count - 1] = receive_byte();
/* send Nack: */
send_nack();
/* stop */
stop_cd();