Skip to content

Commit

Permalink
tweak for native build
Browse files Browse the repository at this point in the history
  • Loading branch information
lovyan03 committed Jul 18, 2023
1 parent 854c0b6 commit 3715a68
Showing 1 changed file with 58 additions and 0 deletions.
58 changes: 58 additions & 0 deletions src/lgfx/v1/platforms/sdl/Bus_I2C.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
/*----------------------------------------------------------------------------/
Lovyan GFX - Graphics library for embedded devices.
Original Source:
https://github.com/lovyan03/LovyanGFX/
Licence:
[FreeBSD](https://github.com/lovyan03/LovyanGFX/blob/master/license.txt)
Author:
[lovyan03](https://twitter.com/lovyan03)
Contributors:
[ciniml](https://github.com/ciniml)
[mongonta0716](https://github.com/mongonta0716)
[tobozo](https://github.com/tobozo)
/----------------------------------------------------------------------------*/
#pragma once

#include "../../Bus.hpp"
#include "../common.hpp"

namespace lgfx
{
inline namespace v1
{
//----------------------------------------------------------------------------

class Bus_I2C : public Bus_NULL
{
public:
struct config_t
{
uint32_t freq_write = 400000;
uint32_t freq_read = 400000;
int16_t pin_scl = 22;
int16_t pin_sda = 21;
uint8_t i2c_port = 0;
uint8_t i2c_addr = 0x3C;
uint32_t prefix_cmd = 0x00;
uint32_t prefix_data = 0x40;
uint32_t prefix_len = 1;
};

const config_t& config(void) const { return _cfg; }

void config(const config_t& config);

bus_type_t busType(void) const override { return bus_type_t::bus_i2c; }

protected:

config_t _cfg;
};

//----------------------------------------------------------------------------
}
}

0 comments on commit 3715a68

Please sign in to comment.