bool SHT11::send_byte(uint_fast8_t b) { for (int i=0; i<8; i++) { uint8_t tmp = b & 0x80; data_ = b & 0x80; SHT11_setup_delay(); sck_ = 1; SHT11_clock_delay(); sck_ = 0; SHT11_setup_delay(); b <<= 1; } data_ = 1; SHT11_setup_delay(); sck_ = 1; //read ack SHT11_setup_delay(); uint8_t error = data_; dbg_write_u8(&error, 1); sck_ = 0; SHT11_setup_delay(); delay_ms(10); }
int main(void) { dbg_write_str("hello world"); dbg_write_char('t'); dbg_write_char('e'); dbg_write_char('s'); dbg_write_char('t'); dbg_write_char('\n'); unsigned long test_u32 = 0x01234567; dbg_write_u32(&test_u32, 1); static const unsigned short test_u16[] = {0x0123, 0x4567, 0x89AB, 0xCDEF, 0x0123, 0x4567, 0x89AB, 0xCDEF}; dbg_write_u16(test_u16, 8); static const unsigned char test_u8[] = {0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88, 0x99, 0xAA, 0xBB, 0xCC, 0XDD, 0xEE, 0xFF}; dbg_write_u8(test_u8, 16); while(1) { dbg_trace_point(0); } }