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