Skip to content

Commit

Permalink
refactor(model): Rename model class to a shorter version
Browse files Browse the repository at this point in the history
  • Loading branch information
nedseb committed Oct 4, 2024
1 parent ea74f31 commit 5c260cc
Show file tree
Hide file tree
Showing 41 changed files with 73 additions and 103 deletions.
18 changes: 8 additions & 10 deletions model/STM32STEAM32_WB55RG.cpp → model/STEAM32_WB55RG.cpp
Original file line number Diff line number Diff line change
@@ -1,18 +1,16 @@
#include "STM32STEAM32_WB55RG.h"
#include "STEAM32_WB55RG.h"

using namespace codal;

void STM32PNUCLEO_WB55RG_dmesg_flush();

STM32STEAM32_WB55RG* codal::default_device_instance = nullptr;
STEAM32_WB55RG* codal::default_device_instance = nullptr;

/**
* Constructor.
*
* Create a representation of a device, which includes member variables
* that represent various device drivers used to control aspects of the STM32 IOT node.
*/
STM32STEAM32_WB55RG::STM32STEAM32_WB55RG()
STEAM32_WB55RG::STEAM32_WB55RG()
: lowLevelTimer(TIM2, TIM2_IRQn),
timer(lowLevelTimer),
io(),
Expand All @@ -37,20 +35,20 @@ STM32STEAM32_WB55RG::STM32STEAM32_WB55RG()
* static context i.e. in a constructor.
*
* @code
* STM32STEAM32_WB55RG.init();
* STEAM32_WB55RG.init();
* @endcode
*
* @note This method must be called before user code utilises any functionality
* contained within the STM32STEAM32_WB55RG class.
* contained within the STEAM32_WB55RG class.
*/
int STM32STEAM32_WB55RG::init()
int STEAM32_WB55RG::init()
{
if ((status & DEVICE_INITIALIZED) != 0) {
return DEVICE_NOT_SUPPORTED;
}
status |= DEVICE_INITIALIZED;

// codal_dmesg_set_flush_fn(STM32STEAM32_WB55RG_dmesg_flush);
// codal_dmesg_set_flush_fn(STEAM32_WB55RG_dmesg_flush);

// Bring up fiber scheduler.
scheduler_init(messageBus);
Expand All @@ -68,7 +66,7 @@ int STM32STEAM32_WB55RG::init()

extern "C" int __io_putchar(int ch);

void STM32STEAM32_WB55RG_dmesg_flush()
void STEAM32_WB55RG_dmesg_flush()
{
#if CONFIG_ENABLED(DMESG_SERIAL_DEBUG)
#if DEVICE_DMESG_BUFFER_SIZE > 0
Expand Down
14 changes: 6 additions & 8 deletions model/STM32STEAM32_WB55RG.h → model/STEAM32_WB55RG.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
#ifndef STM32PNUCLEO_WB55RG_H
#define STM32PNUCLEO_WB55RG_H
#pragma once

#include "Button.h"
#include "CodalComponent.h"
Expand All @@ -9,10 +8,10 @@
#include "Event.h"
#include "MessageBus.h"
#include "NotifyEvents.h"
#include "STEAM32_WB55RG_IO.h"
#include "STM32I2C.h"
#include "STM32LowLevelTimer.h"
#include "STM32SPI.h"
#include "STM32STEAM32_WB55RG_IO.h"
#include "STM32Serial.h"
#include "Timer.h"
#include "stm32_def.h"
Expand All @@ -27,12 +26,12 @@
* used to control aspects of the STM32 IOT node.
*/
namespace codal {
class STM32STEAM32_WB55RG : public CodalComponent {
class STEAM32_WB55RG : public CodalComponent {
public:
STM32LowLevelTimer lowLevelTimer;
Timer timer;
MessageBus messageBus;
STM32STEAM32_WB55RG_IO io;
STEAM32_WB55RG_IO io;

STM32Serial serial;
STM32I2C i2c1;
Expand All @@ -44,7 +43,7 @@ class STM32STEAM32_WB55RG : public CodalComponent {
/**
* Constructor.
*/
STM32STEAM32_WB55RG();
STEAM32_WB55RG();

/**
* Post constructor initialisation method.
Expand Down Expand Up @@ -89,6 +88,5 @@ class STM32STEAM32_WB55RG : public CodalComponent {
CODAL_TIMESTAMP systemTime() { return system_timer_current_time(); }
};

extern STM32STEAM32_WB55RG* default_device_instance;
extern STEAM32_WB55RG* default_device_instance;
} // namespace codal
#endif
26 changes: 2 additions & 24 deletions model/STM32STEAM32_WB55RG_IO.cpp → model/STEAM32_WB55RG_IO.cpp
Original file line number Diff line number Diff line change
@@ -1,31 +1,9 @@
/*
The MIT License (MIT)
Permission is hereby granted, free of charge, to any person obtaining a
copy of this software and associated documentation files (the "Software"),
to deal in the Software without restriction, including without limitation
the rights to use, copy, modify, merge, publish, distribute, sublicense,
and/or sell copies of the Software, and to permit persons to whom the
Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
DEALINGS IN THE SOFTWARE.
*/

/**
* Class definition for STM32 IOT node IO.
* Represents a collection of all I/O pins on the device.
*/

#include "STM32STEAM32_WB55RG_IO.h"
#include "STEAM32_WB55RG_IO.h"

namespace codal {

Expand All @@ -37,7 +15,7 @@ namespace codal {
* Accepts a sequence of unique ID's used to distinguish events raised
* by Pin instances on the default EventModel.
*/
STM32STEAM32_WB55RG_IO::STM32STEAM32_WB55RG_IO()
STEAM32_WB55RG_IO::STEAM32_WB55RG_IO()
: PA_0(ID_PIN_PA0, PinNumber::PA_0, PIN_CAPABILITY_DIGITAL),
PA_1(ID_PIN_PA1, PinNumber::PA_1, PIN_CAPABILITY_DIGITAL),
PA_2(ID_PIN_PA2, PinNumber::PA_2, PIN_CAPABILITY_DIGITAL), // Enable ANALOG = bug with TIM2 (due to PWM)
Expand Down
9 changes: 3 additions & 6 deletions model/STM32STEAM32_WB55RG_IO.h → model/STEAM32_WB55RG_IO.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
#ifndef STM32_IOT_NODE_IO_H
#define STM32_IOT_NODE_IO_H
#pragma once

#include "STM32Pin.h"
//
Expand Down Expand Up @@ -76,12 +75,12 @@ namespace codal {
/**
* Represents a collection of all I/O pins exposed by the device.
*/
class STM32STEAM32_WB55RG_IO {
class STEAM32_WB55RG_IO {
public:
/**
* Constructor.
*/
STM32STEAM32_WB55RG_IO();
STEAM32_WB55RG_IO();

STM32Pin PA_0;
STM32Pin PA_1;
Expand Down Expand Up @@ -130,5 +129,3 @@ class STM32STEAM32_WB55RG_IO {
STM32Pin NC;
};
} // namespace codal

#endif
2 changes: 1 addition & 1 deletion samples/BLE/BLE_Broadcast/BLE_Broadcast_Sample.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
#include "STM32Serial.h"
#include "ble_utils.h"

void BLE_Broadcast_Sample_main(codal::STM32STEAM32_WB55RG& steam32)
void BLE_Broadcast_Sample_main(codal::STEAM32_WB55RG& steam32)
{
steam32.serial.init(115200);

Expand Down
4 changes: 2 additions & 2 deletions samples/BLE/BLE_Broadcast/BLE_Broadcast_Sample.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#include "STM32STEAM32_WB55RG.h"
#include "STEAM32_WB55RG.h"

#ifndef BLE_BROADCAST_SAMPLE_H
#define BLE_BROADCAST_SAMPLE_H
Expand All @@ -7,6 +7,6 @@
#define SAMPLE_MAIN BLE_Broadcast_Sample_main
#endif

void BLE_Broadcast_Sample_main(codal::STM32STEAM32_WB55RG& steam32);
void BLE_Broadcast_Sample_main(codal::STEAM32_WB55RG& steam32);

#endif
2 changes: 1 addition & 1 deletion samples/Basic/Blink/BlinkSample.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
using namespace std;
using namespace codal;

void BlinkSample_main(codal::STM32STEAM32_WB55RG& steam32)
void BlinkSample_main(codal::STEAM32_WB55RG& steam32)
{
bool state = false;

Expand Down
4 changes: 2 additions & 2 deletions samples/Basic/Blink/BlinkSample.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#include "STM32STEAM32_WB55RG.h"
#include "STEAM32_WB55RG.h"

#ifndef BLINK_SAMPLE_H
#define BLINK_SAMPLE_H
Expand All @@ -7,6 +7,6 @@
#define SAMPLE_MAIN BlinkSample_main
#endif

void BlinkSample_main(codal::STM32STEAM32_WB55RG& steam32);
void BlinkSample_main(codal::STEAM32_WB55RG& steam32);

#endif
2 changes: 1 addition & 1 deletion samples/Basic/Buttons/ButtonSample.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
using namespace std;
using namespace codal;

void ButtonSample_main(codal::STM32STEAM32_WB55RG& steam32)
void ButtonSample_main(codal::STEAM32_WB55RG& steam32)
{
STM32Pin& led_red = steam32.io.PC_12;
STM32Pin& led_green = steam32.io.PC_11;
Expand Down
4 changes: 2 additions & 2 deletions samples/Basic/Buttons/ButtonSample.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#include "STM32STEAM32_WB55RG.h"
#include "STEAM32_WB55RG.h"

#ifndef BUTTON_SAMPLE_H
#define BUTTON_SAMPLE_H
Expand All @@ -7,6 +7,6 @@
#define SAMPLE_MAIN ButtonSample_main
#endif

void ButtonSample_main(codal::STM32STEAM32_WB55RG& steam32);
void ButtonSample_main(codal::STEAM32_WB55RG& steam32);

#endif
2 changes: 1 addition & 1 deletion samples/Basic/ScannerI2C/ScannerI2C.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

#include <cstdio>

void ScannerI2C(codal::STM32STEAM32_WB55RG& steam32)
void ScannerI2C(codal::STEAM32_WB55RG& steam32)
{
steam32.serial.init(115200);

Expand Down
4 changes: 2 additions & 2 deletions samples/Basic/ScannerI2C/ScannerI2C.h
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
#pragma once

#include "STM32STEAM32_WB55RG.h"
#include "STEAM32_WB55RG.h"

#ifndef SAMPLE_MAIN
#define SAMPLE_MAIN ScannerI2C
#endif

void ScannerI2C(codal::STM32STEAM32_WB55RG& steam32);
void ScannerI2C(codal::STEAM32_WB55RG& steam32);
2 changes: 1 addition & 1 deletion samples/Basic/Serial/SerialSample.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

#include "STM32Serial.h"

void SerialSample_main(codal::STM32STEAM32_WB55RG& steam32)
void SerialSample_main(codal::STEAM32_WB55RG& steam32)
{
steam32.serial.init(115200);

Expand Down
4 changes: 2 additions & 2 deletions samples/Basic/Serial/SerialSample.h
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#pragma once
#include "STM32STEAM32_WB55RG.h"
#include "STEAM32_WB55RG.h"

#ifndef SAMPLE_MAIN
#define SAMPLE_MAIN SerialSample_main
#endif

void SerialSample_main(codal::STM32STEAM32_WB55RG& steam32);
void SerialSample_main(codal::STEAM32_WB55RG& steam32);
2 changes: 1 addition & 1 deletion samples/Basic/SingleWireSerial/SingleWireSerialSample.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ void set_serial_mode(codal::STM32SingleWireSerial& sws, bool is_tx)
}
}

void SingleSerialSerialSample_main(codal::STM32STEAM32_WB55RG& steam32)
void SingleSerialSerialSample_main(codal::STEAM32_WB55RG& steam32)
{
bool is_sserial_tx = false;
codal::STM32SingleWireSerial sserial(steam32.io.PB_6);
Expand Down
4 changes: 2 additions & 2 deletions samples/Basic/SingleWireSerial/SingleWireSerialSample.h
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#pragma once
#include "STM32STEAM32_WB55RG.h"
#include "STEAM32_WB55RG.h"

#ifndef SAMPLE_MAIN
#define SAMPLE_MAIN SingleSerialSerialSample_main
#endif

void SingleSerialSerialSample_main(codal::STM32STEAM32_WB55RG& steam32);
void SingleSerialSerialSample_main(codal::STEAM32_WB55RG& steam32);
2 changes: 1 addition & 1 deletion samples/Demo/demo_sample.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1208,7 +1208,7 @@ void show_qwic()
}
}

void Demo_main(codal::STM32STEAM32_WB55RG& steam32)
void Demo_main(codal::STEAM32_WB55RG& steam32)
{
i2c_qwiic = &steam32.i2c3;
spi = &steam32.spi1;
Expand Down
4 changes: 2 additions & 2 deletions samples/Demo/demo_sample.h
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#pragma once
#include "STM32STEAM32_WB55RG.h"
#include "STEAM32_WB55RG.h"

#ifndef SAMPLE_MAIN
#define SAMPLE_MAIN Demo_main
#endif

void Demo_main(codal::STM32STEAM32_WB55RG& steam32);
void Demo_main(codal::STEAM32_WB55RG& steam32);
2 changes: 1 addition & 1 deletion samples/Display/OLED_SSD1327/OLED_SSD1327.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -445,7 +445,7 @@ uint8_t pic[128][64] = {
#include "VL53L1X.h"
#include "WSEN-PADS.h"

void OledSample1327_main(codal::STM32STEAM32_WB55RG& steam32)
void OledSample1327_main(codal::STEAM32_WB55RG& steam32)
{
STM32SPI& spi = steam32.spi1;
STM32Pin& cs = steam32.io.PD_0;
Expand Down
4 changes: 2 additions & 2 deletions samples/Display/OLED_SSD1327/OLED_SSD1327.h
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
#pragma once

#include "STM32STEAM32_WB55RG.h"
#include "STEAM32_WB55RG.h"

#ifndef SAMPLE_MAIN
#define SAMPLE_MAIN OledSample1327_main
#endif

void OledSample1327_main(codal::STM32STEAM32_WB55RG& steam32);
void OledSample1327_main(codal::STEAM32_WB55RG& steam32);
2 changes: 1 addition & 1 deletion samples/Peripherals/APDS9960/APDS9960_sample.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
#include "APDS9960.h"
#include "ssd1327.h"

void APDS9960_SampleMain(codal::STM32STEAM32_WB55RG& steam32)
void APDS9960_SampleMain(codal::STEAM32_WB55RG& steam32)
{
steam32.serial.init(115200);

Expand Down
4 changes: 2 additions & 2 deletions samples/Peripherals/APDS9960/APDS9960_sample.h
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
#pragma once

#include "STM32STEAM32_WB55RG.h"
#include "STEAM32_WB55RG.h"

#ifndef SAMPLE_MAIN
#define SAMPLE_MAIN APDS9960_SampleMain
#endif

void APDS9960_SampleMain(codal::STM32STEAM32_WB55RG& steam32);
void APDS9960_SampleMain(codal::STEAM32_WB55RG& steam32);
2 changes: 1 addition & 1 deletion samples/Peripherals/BQ27441/BQ27441_sample.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

#include "BQ27441.h"

void BQ27441_SampleMain(codal::STM32STEAM32_WB55RG& steam32)
void BQ27441_SampleMain(codal::STEAM32_WB55RG& steam32)
{
steam32.serial.init(115200);
steam32.sleep(2000);
Expand Down
4 changes: 2 additions & 2 deletions samples/Peripherals/BQ27441/BQ27441_sample.h
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
#pragma once

#include "STM32STEAM32_WB55RG.h"
#include "STEAM32_WB55RG.h"

#ifndef SAMPLE_MAIN
#define SAMPLE_MAIN BQ27441_SampleMain
#endif

void BQ27441_SampleMain(codal::STM32STEAM32_WB55RG& steam32);
void BQ27441_SampleMain(codal::STEAM32_WB55RG& steam32);
Loading

0 comments on commit 5c260cc

Please sign in to comment.