dev/irq #8
@ -3,7 +3,7 @@
|
||||
|
||||
#include <cstdint>
|
||||
|
||||
namespace interfaces {
|
||||
namespace pinetime::interfaces {
|
||||
|
||||
class GpioInterface
|
||||
{
|
||||
|
@ -3,7 +3,7 @@
|
||||
|
||||
#include <cstdint>
|
||||
|
||||
namespace interfaces {
|
||||
namespace pinetime::interfaces {
|
||||
|
||||
class SpiInterface
|
||||
{
|
||||
|
@ -5,7 +5,7 @@
|
||||
#include "platform/nrf52/gpio.h"
|
||||
#include "platform/nrf52/spi.h"
|
||||
|
||||
namespace hal = platform::nrf52;
|
||||
namespace hal = pinetime::platform::nrf52;
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
@ -7,7 +7,7 @@ extern "C" {
|
||||
NRF_GPIO_Type *const GPIO_REGS = reinterpret_cast<NRF_GPIO_Type *>(NRF_P0_BASE);
|
||||
}
|
||||
|
||||
using namespace platform::nrf52;
|
||||
using namespace pinetime::platform::nrf52;
|
||||
|
||||
Gpio::Gpio(uint32_t pin)
|
||||
: pin_number(pin)
|
||||
|
@ -3,9 +3,9 @@
|
||||
|
||||
#include "gpio_interface.h"
|
||||
|
||||
namespace platform::nrf52 {
|
||||
namespace pinetime::platform::nrf52 {
|
||||
|
||||
class Gpio : public interfaces::GpioInterface
|
||||
class Gpio : public pinetime::interfaces::GpioInterface
|
||||
{
|
||||
public:
|
||||
inline Gpio() {}
|
||||
|
@ -9,9 +9,9 @@ extern "C" {
|
||||
NRF_SPI_Type *SPI_REGS = reinterpret_cast<NRF_SPI_Type *>(NRF_SPI0_BASE);
|
||||
}
|
||||
|
||||
using namespace platform::nrf52;
|
||||
using namespace pinetime::platform::nrf52;
|
||||
|
||||
Spi::Spi(uint32_t instance, uint32_t sck, uint32_t mosi, uint32_t miso, interfaces::GpioInterface & cs)
|
||||
Spi::Spi(uint32_t instance, uint32_t sck, uint32_t mosi, uint32_t miso, pinetime::interfaces::GpioInterface & cs)
|
||||
: chip_select(cs)
|
||||
{
|
||||
assert(instance < 3);
|
||||
|
@ -4,12 +4,12 @@
|
||||
#include "gpio_interface.h"
|
||||
#include "spi_interface.h"
|
||||
|
||||
namespace platform::nrf52 {
|
||||
namespace pinetime::platform::nrf52 {
|
||||
|
||||
class Spi : public interfaces::SpiInterface
|
||||
class Spi : public pinetime::interfaces::SpiInterface
|
||||
{
|
||||
public:
|
||||
Spi(uint32_t instance, uint32_t sck, uint32_t mosi, uint32_t miso, interfaces::GpioInterface & cs);
|
||||
Spi(uint32_t instance, uint32_t sck, uint32_t mosi, uint32_t miso, pinetime::interfaces::GpioInterface & cs);
|
||||
~Spi();
|
||||
void send(const uint8_t * buffer, uint32_t len) override;
|
||||
void recv(uint8_t * buffer, uint32_t len) override;
|
||||
@ -17,7 +17,7 @@ public:
|
||||
private:
|
||||
uint32_t transfer(uint32_t);
|
||||
|
||||
interfaces::GpioInterface & chip_select;
|
||||
pinetime::interfaces::GpioInterface & chip_select;
|
||||
};
|
||||
|
||||
}
|
||||
|
@ -3,10 +3,10 @@
|
||||
#include "delay.h"
|
||||
#include "st7789.h"
|
||||
|
||||
St7789::St7789(interfaces::SpiInterface & spi_if,
|
||||
interfaces::GpioInterface & rst,
|
||||
interfaces::GpioInterface & dc,
|
||||
interfaces::GpioInterface & bl)
|
||||
St7789::St7789(pinetime::interfaces::SpiInterface & spi_if,
|
||||
pinetime::interfaces::GpioInterface & rst,
|
||||
pinetime::interfaces::GpioInterface & dc,
|
||||
pinetime::interfaces::GpioInterface & bl)
|
||||
: spi(spi_if)
|
||||
, reset(rst)
|
||||
, data_command(dc)
|
||||
|
16
src/st7789.h
16
src/st7789.h
@ -8,19 +8,19 @@
|
||||
class St7789
|
||||
{
|
||||
public:
|
||||
St7789(interfaces::SpiInterface &,
|
||||
interfaces::GpioInterface &,
|
||||
interfaces::GpioInterface &,
|
||||
interfaces::GpioInterface &);
|
||||
St7789(pinetime::interfaces::SpiInterface &,
|
||||
pinetime::interfaces::GpioInterface &,
|
||||
pinetime::interfaces::GpioInterface &,
|
||||
pinetime::interfaces::GpioInterface &);
|
||||
|
||||
void init();
|
||||
void clear(uint16_t Color);
|
||||
|
||||
private:
|
||||
interfaces::SpiInterface & spi;
|
||||
interfaces::GpioInterface & reset;
|
||||
interfaces::GpioInterface & data_command;
|
||||
interfaces::GpioInterface & backlight;
|
||||
pinetime::interfaces::SpiInterface & spi;
|
||||
pinetime::interfaces::GpioInterface & reset;
|
||||
pinetime::interfaces::GpioInterface & data_command;
|
||||
pinetime::interfaces::GpioInterface & backlight;
|
||||
|
||||
void send_cmd(uint8_t);
|
||||
void send_data(uint8_t);
|
||||
|
Loading…
Reference in New Issue
Block a user