text:
Neville Kidd
The Emmy Award-winning cinematographer talks to BAFTA-nominated producer Marcus Wilson about being a director of photography.
Neville Kidd talks about the craft of cinematography and why every shot has to be a still in its own right. Neville, who was director of photography on Sherlock, Doctor Who and Outlander, is talking to BAFTA-nominated producer Marcus Wilson (Luther, Doctor Who, The A Word, Life on Mars). He discusses why changing lenses on a 3D rig is so challenging and how he builds a world with the production designer and works with a gaffer.
Neville also gives his top piece of advice for people entering the camera department and for ways of preparing for a career in the industry following the Covid-19 lockdown.
The session, recorded on 6 May 2020, is part ScreenSkills HETV Skills Fund's series of online expert-led learning sessions, to support freelancers in developing their skills in high-end television (HETV) during the coronavirus crisis. It was introduced by Kaye Elliott, ScreenSkills HETV director.
For careers information, go to film and TV drama director of photography. If you are interested in the other roles mentioned, see gaffer and production designer.

redpajama_set_name: RedPajamaCommonCrawl


Banks led a broad slide in U.S. stocks Monday as an early rally faded, giving the benchmark Standard & Poor's 500 index its fourth loss in a row.
Healthcare and energy stocks also helped pull down the market, outweighing gains by technology and consumer-focused stocks. Crude oil prices eked out a small gain after spending most of the day in the red.
The latest losses came as traders geared up for a busy week of company earnings reports that should help answer how corporate America is coping with rising interest rates, inflation and the effects of global trade disputes.
The S&P 500 fell 11.90 points, or 0.4%, to 2,755.88. The index is on track for its worst month in more than three years. The Dow Jones industrial average fell 126.93 points, or 0.5%, to 25,317.41. The tech-heavy Nasdaq recovered from an early tumble, ending the day with a gain of 19.60 points, or 0.3%, at 7,468.63.
The Russell 2000 index of smaller-company stocks fell 2.54 points, or 0.2%, to 1,539.50 — its the lowest close since April. The index is now up just 0.3% for the year.
Investors have been worried in recent weeks about potential threats to corporate growth, including rising interest rates, the U.S.-China trade war and some sluggish reports about housing construction and sales.
This week marks the busiest stretch of the quarterly earnings calendar as many big-name companies report their latest results, including Caterpillar, Amazon and Alphabet, Google's parent company.
Nearly 17% of companies in the S&P 500 had served up third-quarter results as of Monday. Of those, 54% delivered earnings and revenue that topped Wall Street's forecasts, according to S&P Global Market Intelligence.
Investors are most focused on what companies have to say about any effects the U.S.-China trade war, a stronger dollar and rising interest rates are likely to have in 2019.
"Everybody's trying to get a fix on what 2019 earnings are going to be, because they're sure as heck not going to be what earnings growth was this year," Wren said. "You're not going to have a big tax-induced sugar high like you're having this year," he said, referring to the effects of the corporate tax cut championed by President Trump and passed by the GOP.
So far, most companies have said that they expect minimal effect from the hundreds of billions in tariffs that the United States and China have imposed on each other's goods, "though some have taken a more negative tone about what lies ahead," said a research note published Monday by RBC Capital Markets.
The key concerns cited by companies that issued quarterly results so far this earnings season include higher labor costs and the prices of commodities, transportation and shipping.
Banks and other financial companies took the heaviest losses Monday. Synchrony Financial shares slid 6% to $29.47.
Energy stocks fell as the price of crude oil spent most of the day lower. Newfield Exploration declined 3% to $22.91.
After a sluggish start, technology stocks rebounded. Advanced Micro Devices climbed 5.8% to $25.03.
Hasbro slid 3.1% to $95.01 after the toy maker reported disappointing third-quarter results, partly due to lost sales following the demise of Toys R Us. Hasbro also said it will cut jobs as it deals with the effects of Toys R Us' bankruptcy. Rival toy maker Mattel slipped 0.8% to $14.10.
Traders hammered Bristol-Myers Squibb after the drugmaker said regulators want three more months to review data from a potential lung cancer treatment regimen. The stock skidded 6.3% to $50.88.
Fiat Chrysler Automobiles ticked up 3.7% to $16.09 after the automaker agreed to sell its components business, Magneti Marelli, to Japan's Calsonic Kansei for about $7 billion.
Bond prices didn't move much. The yield on the 10-year Treasury held steady at 3.19%.
Benchmark U.S. crude recovered from an early skid. It settled with a gain of 0.1% at $69.17 a barrel in New York. Brent crude, used to price international oils, rose 0.1% to $79.83 a barrel in London.
Wholesale gasoline fell 0.4% to $1.91 a gallon. Heating oil rose 0.7% to $2.32 a gallon. Natural gas slid 3.4% to $3.14 per 1,000 cubic feet.
Gold fell 0.3% to $1,224.60 an ounce. Silver fell 0.4% to $14.59 an ounce. Copper rose 0.3% to $2.79 a pound.
The dollar strengthened to 112.82 yen from 112.60 yen. The euro fell to $1.1466 from $1.1510.


Indulge in smooth, glowing skin. Nyakio's Kenyan Coffee Body Scrub is an energizing body scrub that blends exfoliating Kenyan coffee and sugar with nourishing shea butter and baobab oil to envelop skin in a luxurious experience. Dull, dry skin gets polished away, leaving behind a silky layer of moisture.
Massage onto wet skin in a circular motion, concentrating on dry, rough areas. Rinse well with warm water to reveal soft, radiant skin.
Nyakio's Tip: "It's like neck to toe instant anti-aging! For my extra dry, rough spots like my heels and feet, I use 2-3x a week in the morning and I am sandal ready!"
Sugar, Water, Glycerin (Vegetable), lsopropyl Myristate, Ricinus Communis (Castor) Seed Oil, Carthamus Tinctorius (Safflower) Seed Oil, Corn Syrup, Coffea Arabica (Coffee) Seed Powder, Caramel, Glyceryl Caprylate, Xanthan Gum, Hydrogenated Castor Oil, Cera Alba, Copernicia Cerifera (Carnauba) Wax, Butyrospermum Parkii (Shea) Butter*+, Prunus Amygdalus Dulcis (Sweet Almond) Oil, Helianthus Annuus (Sunflower) Seed Oil, Citrus Paradisi (Grapefruit) Peel Oil, Persea Gratissima (Avocado) Oil, Ricinodendron Rautanenii (Mongongo) Seed Oil, Adansonia Digitata Seed (Baobab) Oil, Sodium Palm Kernelate, Sodium Shea Butterate, Sodium Cocoate, Theobroma Cacao (Cocoa) Pod Ash, Caprylhydroxamic Acid, Caprylyl Glycol, Coffea Arabica (Coffee) Extract, Tamarindus lndica Fruit (Tamarind) Extract, Sodium Benzoate, Glyceryl Undecylenate, Fragrance (Essential Oil Blend).


text:
The Ontario election: What does Ford's nation have in store for mining? – by Greg Klein (Resource Clips – June 7, 2018)
June 8, 2018 in Canadian Regional Media and Web Publications, Ontario Mining, Ontario's Ring of Fire Mineral Discovery, Stan Sudol Columns/Media References and Appearances
http://resourceclips.com/
He reportedly promised to get Ring of Fire development started even if he had to climb onto a bulldozer to blaze a trail himself. Now Doug Ford and Ontario's Progressive Conservatives have won a resounding majority, already apparent less than half an hour after polls closed and five days after Liberal leader Kathleen Wynne conceded defeat.
Canada-wide, this has probably been the most closely watched provincial election outside Quebec for many years. Celebrated by some as a populist and disliked by the establishment for the same reason, Ford was nevertheless granted a degree of civility that the media generally begrudged his late brother, former Toronto mayor Rob Ford. Although a veteran of municipal politics and a long-time PC member, this marks Doug Ford's first foray as a provincial candidate.
Elegant for its simplicity was his party's five-point plan, starting with "scrap the carbon tax." He'd "cut gas prices by 10 cents a litre, reduce middle class income taxes by 20%, cut your hydro bills by 12%," create "quality" jobs, slash government waste and "end hallway health care" with new beds and additional treatment.
No doubt more details will come. But his Ring of Fire rhetoric drew criticism for a lack of specifics. At a debate on Northern issues last month, the Ottawa Citizen quoted him saying, "For years, all we've heard is talk, talk, talk.
No action whatsoever. We're going to work with the people of the North, we're going to work with the First Nations, we're going to respect the treaties that are in place right now. But we're not going to talk. We're going to get in there, after the agreements, and get to work."
For the rest of this article: http://resourceclips.com/2018/06/07/the-ontario-election-what-does-ford%E2%80%99s-nation-have-in-store-for-mining/
Tariffs on steel and aluminum might cost the U.S. 400,000 jobs — and Canada could get hit too – by Jessica Vomiero (Global News – June 6, 2018)
ALTERNATIVES TO COBALT, THE BLOOD DIAMOND OF BATTERIES – by Ellen Airhart (Wired Magazine – June 7, 2018)


text:
The Next Lamborghini Huracan 'Will Need' To Go Hybrid
Filed to:lamborghini
It's readily apparent that electrification is the immediate future of cars, and more than likely our gateway drug to full-on electric cars going mainstream. And that trend may be fine. It's hard to argue against SUVs and sedans and even trucks going hybrid; they're normal cars, so why not? But what about high-end performance cars like the Lamborghini Huracan?
Apparently that's the plan for the next Huracan or its successor, due out in 2022. And while there's a new "next [Car X] could go hybrid" story out every day lately, this piece from Autocar sure makes it sound like that's the current plan for this model:
The next Aventador, due before the second-generation Huracán, will retain its naturally aspirated V12 engine, so the Huracán's successor will be the first Lamborghini sports car to be an advanced plug-in hybrid.
Talking to Autocar, Lamborghini boss Stefano Domenicali said: "The [next] Huracán – that car will need hybridisation. Hybridisation is the answer, not [full] electric."
Referring to its current engines, Domenicali said: "There is still a lot of potential for the V12. The right approach for us is to have the V10 and V12 to suit our customers and then be ready to switch [to a hybrid] at the right moment."
The current Huracan has a 5.2-liter naturally aspirated V10 and around 600 horsepower, depending on the version you get.
That story notes that Lamborghini's parent company the Volkswagen Group is going big on electrification and EVs in general, and that Lamborghini itself is partnering with MIT to develop lightweight composite materials and new energy storage solutions. The idea is range, Autocar says; an electrified performance car needs to be able to run a ton of laps without losing all its juice early on.
There's two ways to look at this news. On one hand, I find it very hard to see a market for an electrified Lamborghini Huracan, even if that is something Lamborghini has to do for emissions and fuel economy and corporate image reasons.
I'll tell you that Lamborghini desperately wants to be seen as this great track-focused brand, but we all know who really buys these things: YouTube dipshits in Miami and bros whose startups just went public. And none of those people give a shit about hybrid cars; they want to be seen and heard in the Lamborghini and that's it. (Look at the reactions to the new hybrid Acura NSX too. It's fantastic, but often totally dismissed by purists who haven't even driven it.)
On the other hand, I've been critical of Lamborghini in recent years for falling behind some of its competitors in terms of technology—and relevance. Compared to the stuff you see from McLaren or Pagani or Koenigsegg or even Ferrari, Lamborghini's not really the one pushing the envelope anymore.
Going electrified and doing it well could help Lamborghini catch up to some of these hybrid hypercars, and maybe even prove that hybrid performance cars not only work but do have a future in the car landscape. I'd rather see that than brands give up on speed entirely, which is the sense we all seemed to get from the Tokyo Motor Show last week.
Long as they keep the naturally aspirated V12 around too, obviously.
More from Jalopnik
Even Rich Instagram Fools Could Track The 740 HP Lamborghini Aventador S
Deadmau5's Nyanborghini Purracan Is For Sale You Guys!!!
The Lamborghini Countach Is Great Because It Was Terrible
Editor-in-Chief at Jalopnik. 2002 Toyota 4Runner.


A couple or so months ago, we invited representatives of the transport refrigeration industry for a discussion on macro issues concerning them. Not surprisingly, as has been the case with other sectors, the representatives spoke of a need for a better regulatory framework as a core solution to several challenges. One of the most frequent temperature-abuse scenarios, they said, took place not within urban centres but at the border, where waiting trucks, filled to the belly with temperature-sensitive foods, ran roughshod over concerns expressed by microbiologists and the broader food safety community.
Within the cities, the issue had to do with the frequent opening and closing of refrigerated delivery vans, which caused temperature-sensitive foods to get spoilt.
Either way – that is, temperature abuse at the border or within urban centres – the technology for better monitoring and reporting was available, and that it was just a matter of adopting them, the representatives said.
The push for adopting them, the representatives agreed, would have to come from regulation and, equally important, from self-discipline among the owners of the fleets of trucks and vans. So while regulation is a key aspect, so is a proper food safety culture, where everyone understands the implications of unhygienic food and takes a holistic view of things.
In the context of transport refrigeration, proper food safety measures go beyond ensuring that trucks are not over-stacked with pallets in a manner as to impede airflow or that there is a proper interlocking mechanism in place in the case of the insulated panels that make up the body of the trucks; they also include regulations and human behaviour – a case of success being possible only if all the boxes are ticked.
Getting things right is important not only from a health point of view but also from a tourism perspective. In the case of a place like Dubai, which counts on tourism as one of the pillars of its economy, a food-related outbreak is unwelcome; it is, hence, vital that regulation and vigilance are at their comprehensive and absolute best along with an all-pervading food safety culture.


Im super nice and mellow, and i will always be a weirdo shy kid at heart. I am also honest, I dont believe in just throwing some design on your body that was traced from google images. I think tattoos should be custom and creative! If you feel this way too and would like to contact me about a tattoo, feel free to book with me now!
If you saw a design that I have done and want that as a tattoo, please specify what it is. Also if you have reference of what you want, please feel free to include them in your e-mail, but please keep in mind that I will use your reference as inspiration and ultimately draw a custom design.
My rate is $100/per hour. Only after you give me specifics about the tattoo you desire I can give you a rough estimate. If you have a budget, please let me know ahead of time.


Admit card are available for all applicants from here. Admit card download link is given here.
Just enter in the link and login with your username & password which are issued at the time of application submission.
If you forgot you user ID and password follow the given instruction.
and fill the box with appropriate information and press submit. You will get your desire ID also password by mobile sms.
Primary assisstant teachers exam will be held by digital method (question formulate and distribute).
Government primary school assistant teacher recruitment circular was published in 24 May 2016 and application submission has been completed in 30 June 2016.
We have informed you that the previous government pre-primary assistant teacher recruitment for all district written result already has been published. Final results are available here.
preprimary password ti haris felechi akhon kivabe pabo.
I need Government Primary School Assistant Teacher exam date .
It's so urgent for us .


text:
West Nile Virus More Widespread In Connecticut This Year
Filed Under:Connecticut, Fran Schneidau, Heat, mosquito, mosquitos, Theodore Andreadis, Weather Stories, West Nile virus
HARTFORD, CT (WCBS 880) – The number of mosquitos testing positive for West Nile Virus is up this year and the virus is more widespread than last, cropping now in south central Connecticut communities.
WCBS 880 Connecticut Bureau Chief Fran Schneidau On The Story https://newyork.cbslocal.com/wp-content/uploads/sites/14578484/2011/08/schneidau_westnile1w_midday_110803.mp3
Hot weather is the primary reason for the abundance of mosquitos that have been trapped and infected with West Nile Virus this summer, says the state's chief entomologist, Dr. Theodore Andreadis.
"If we continue with warm temperatures, in the 90s and upper 80s, we're fully expecting that the virus will increase in abundance and we're going to see this throughout the region," says Dr. Andreadis.
He says the next three weeks will be critical.
It's the season when, traditionally, we see the virus expand.
"That's when the public is at greatest risk," he tells WCBS 880 Connecticut Bureau Chief Fran Schneidau.
He says the hotspot is always the I-95 corridor since the primary carrier of the virus is a mosquito that thrives in urban storm drains and catch basins.
He says to use protective sprays when outdoors.
There are not yet any human cases of West Nile Virus in Connecticut this year.
Are you concerned? Let us know below…


I was reading the April addition of the Company Director Magazine and come across an interview with Kathleen Conlon who talked to Tony Featherstone about boardroom diversity, the risks of policy on the run, strategy formation and how emerging directors can find their first board position.
By way of background, Kathleen Conlon is a management consultant and board director who is known as a global thought leader in operational and change management.
I was heartened to read her comments about boardroom diversity. She points out how compared to other professional services such as law and accounting, the consulting industry provides fewer board directors. She argues this is puzzling given the need for a director to be able to assess and test complex organisational strategies with limited information and time.
She also contends that too many boards have a narrow specification for directors. This is an issue that emerged at both our Engaging of Young Leaders on Aged Care Boards Unconventions ("Finding Potential" and "Innovation on Aged Care Boards: Challenge Yourself").
Conlon contends that rather than focus on those with operational experience the focus should be on board members attributes: the ability to think independently, be curious, work well in a team setting and be a leader. I support her views and argue that when organisations recruit board members, we need to consider the types of question to ask to illicit this information from potential candidates. I also suggest to our young leaders – think about how you can demonstrate these attributes when you are being interviewed for a board or committee position.
I have strong views about the need to engage young leaders on Boards and Conlon has strong views on the gender diversity debate. One of our common denominators is 'groupthink'. Conlon argues that the treat of quotas for women on boards is needed to maintain pressure on companies who lag behind on this issue; she suggests that if this is lifted all the recent good on this issue could be undone.
Do we need to have age quotas on our Boards and committees?
What are the conversations we need to have and who with?
Are we seeking to shift standard practices and processes - doing what we already do better with new value?
Are our young leaders 'new offers' to any boards or committees. Are young leaders the new competitive value or are they new 'strategies' for changing the board game?


text: Q: How to compose several UIImageViews nicely in an UITableViewCell? I have an UITable view which shows news feed. In each cell there could be no images at all, or 1-5 images. How can I make it work as shown on the screenshots?

redpajama_set_name: RedPajamaStackExchange


How to obtain those goals: Some things you can't control and that can be especially true when it comes to injuries. However, one way Gordon can avoid injuries is to not take too any unnecessary risks. By this I mean don't go diving out of bounds to save a loose ball. I know some people may disagree with what I am saying, but Gordon is a bigger asset to the Pelicans healthy than sitting on the bench. Of course that example is circumstantial. If that loose ball occurred in the final minute of a game in late March with New Orleans fighting for playoff positioning, then Gordon should take the risk and dive for that loose ball. It's those throw away loose balls in the middle of the second quarter in December that he should avoid altogether.
Gordon is very important to this Pelicans team, as he is basically the team's best guard and arguably their second best player at the moment. With Tyreke Evans out a couple months and Jrue Holiday being put on a minutes restriction, Gordon needs to be healthy and play well these first few months so the Pelicans don't fall behind early in the season. That means Gordon may have to reach back and play aggressively (drive to the basket, generate more free throws) for the first few months so any and all unnecessary risks need to be eliminated. When Evans returns and Holiday is off his minutes restriction, Gordon can reprise his role from last season, a knockdown three-point shooter. Last season was a career year from behind the arc and while I doubt he will near 45% again this year, as long as he doesn't neglect that part of his game the first part of the season when he's playing more aggressively, he should find his stroke and average around 40% for the rest of the season.
Predicted stats: 14.3ppg, 3.1rpg, 4.2apg, 46% FG, 40% 3FG, 83% FT.
How to obtain those goals: Coming into the NBA, it was thought that Oladipo was guaranteed to be a great defensive player who could become a great overall player if he developed his offensive game. Two years in and it turned out that the opposite was true. Oladipo has blown away expectations offensively, nearly averaging 18 points in his sophomore campaign and shooting decently from three-point range until a late-season slump brought down his shooting average. It has actually been the defensive side of his game that has troubled Oladipo. To a lot of people's surprise, the Orlando Magic actually gave up 4.6 less points per 100 possessions when Oladipo was off the floor than they did when he was on the floor. Part of the reason has been that Oladipo has focused more on the offensive side of the ball because the Magic had a very hard time scoring for most of the season, but he no longer has that excuse. In addition to rookie Mario Hezonja and an improving Elfrid Payton likely to make the offense more lethal, the Magic brought in new head coach Scott Skiles, who is one of the better defensive NBA coaches in the league. Oladipo needs to learn everything he can from Skiles and regain his defensive form, because if he does he has the potential to become the superstar this team needs.
While Oladipo has been a successful offensive player, there are still a few things he needs to fix. He still needs to be a more consistent shooter. While not as bad as his rookie season, Oladipo still had far too many games where he just kept putting up brick after brick. That leads me to the other part of his game that needs fixing: forced turnovers. Oladipo improved a lot in terms of ball security last season, but he can improve even more this season. Part of that is realizing that while it doesn't show up as a turnover on the stat sheet, a bad shot is basically the same thing as a turnover. Oladipo needs to play more disciplined offensively and if he can do that he will become a more efficient scorer.
Predicted stats: 18.6ppg, 5.1rpg, 4.7apg, 48% FG, 37% 3FG, 84% FT.
How to obtain those goals: Although the goals I laid out for Vonleh may seem silly, you need to remember that this guy, or should I say kid, isn't even old enough to legally drink. Vonleh just turned 20 years old two months ago, making him around the same age as many of this year's rookies. For the most part he still is a rookie after he wasted away on the Hornets bench neither being good enough to play in the NBA but at the same time too talented to play in the NBA's D-League. While Vonleh is still a backup in Portland, his role is much more different and much more beneficial for his growth. He will be a part of the Trail Blazer's second team lineup and will routinely see 10-15 minutes each game against other team's first and second unit players. This should help develop Vonleh more than when he was just playing in garbage time, when you can't guarantee that the opponent will be going all out, especially if they are the ones with the big lead. Vonleh needs to take advantage of this opportunity so that when he eventually gets his chance at starting he will have experience playing against high-level competition.
That brings us to Vonleh's game. The former Big Ten Freshman of the Year was a lottery pick in 2014 for his upside, especially as a rebounder and a three-point shooter. While last season was a disappointing year for Vonleh, he did confirm to everyone that his rebounding skills will easily transfer to the NBA, averaging nearly 12 rebounds when adjusted to 40 minutes per game. Now he needs to work on his outside shot. While he didn't shoot badly from behind the arc, it's the fact that we don't have that much of a sample size to judge him. Vonleh's potential to stretch the floor makes him a valuable player, and if Vonleh wants to be starting by the end of this season or the start of next season, he'll need to prove that he can consistently hit three-pointers, which means he needs to focus on that part of his game in practice until shooting threes becomes natural for him.
Predicted stats: 5.1ppg, 5.7rpg, 0.8apg, 48% FG, 35% 3FG, 71% FT.
How to obtain those goals: Just like Oladipo, Zeller has also defied expectations, but for the exact opposite reason. Expected to be an offensive threat who would struggle to defend bigger players, Zeller ranked as one of the 25 best defensive players in the NBA according to Defensive Plus-Minus (+2.5). Subjective and complicated stats aside, Coach Steve Clifford, a coach who values defense heavily, is expected to still start Zeller at power forward even after an offseason where the Hornets brought in big men such as Frank Kaminsky, Tyler Hansbrough, and Spencer Hawes. Despite each one likely being an upgrade over Zeller offensively, Zeller's defense is so crucial for the Hornets that Clifford will live with Zeller's offensive shortcomings. Now that speaks volumes of a players defensive skill.
Now about those offensive shortcomings. Zeller holds the Indiana University record for best career shooting percentage. While college performance doesn't always translate to NBA performance, there is a big drop off from being a 59% shooter in college to being a 44% shooter in the NBA. Those scouting reports that talked about Zeller struggling against bigger players were correct, but it has been bigger defenders that have given Zeller problems. Last season, Zeller shot better away from the basket than he did under the basket. You read that correctly: Zeller made 46.1% of his shots last season but when only counting layup attempts he shot 42.6%. Zeller has two options, either he bulks up and continues to try and battle in the post, or he can finally use his range to good use and become a stretch-four or a stretch-five. This is the season Zeller has to choose and it seems he has chosen the stretch big man route which I think is for the best. While it would be great to see Zeller dominate the post like he did back when he was donning the candy stripe pants, Zeller knows his niche in the NBA is currently his defense, as his athleticism and mobility let him guard both traditional and stretch power forwards. Bulking up would only slow him down and take away from his defensive versatility. If Zeller can start knocking down threes (he hit only one three last season but he hit dozens of 20-footers), we may start to see Zeller's full potential.
Predicted stats: 9.2ppg, 7.4rpg, 2.0apg, 54% FG, 33% 3FG, 79% FT.
Good info on all players. Enjoyed the read & look forward to updates. Keep up the good work.


text:
/***************************************************************************//**
* \file cy_scb_uart.h
* \version 2.10
*
* Provides UART API declarations of the SCB driver.
*
********************************************************************************
* \copyright
* Copyright 2016-2018, Cypress Semiconductor Corporation.  All rights reserved.
* SPDX-License-Identifier: Apache-2.0
*******************************************************************************/

/**
* \addtogroup group_scb_uart
* \{
* Driver API for UART
*
* UART - Universal Synchronous/Asynchronous Receiver/Transmitter,
* commonly referred to as RS-232.
*
* Three different UART-like serial interface protocols are supported:
* * UART - the standard mode with an optional UART Hardware flow control.
* * SmartCard - the transfer is similar to the UART transfer,
*   but a NACK (negative acknowledgment) may be sent from the
*   receiver to the transmitter. Both transmitter and receiver drive the same
*   line, although never at the same time.
* * IrDA - the Infra-red Data Association protocol adds a modulation
*   scheme to the UART signaling. At the transmitter, bits are modulated.
*   At the receiver, bits are demodulated. The modulation scheme uses the
*   Return-to-Zero-Inverted (RZI) format. Bit value "0" is signaled by a
*   short "1" pulse on the line and bit value "1" is signaled by holding
*   the line to "0".
*
* \section group_scb_uart_configuration Configuration Considerations
* The UART driver configuration can be divided to number of sequential
* steps listed below:
* * \ref group_scb_uart_config
* * \ref group_scb_uart_pins
* * \ref group_scb_uart_clock
* * \ref group_scb_uart_data_rate
* * \ref group_scb_uart_intr
* * \ref group_scb_uart_enable
*
* \note
* UART driver is built on top of the SCB hardware block. The SCB5 instance is
* used as an example for all code snippets. Modify the code to match your
* design.
*
* \subsection group_scb_uart_config Configure UART
* To set up the UART slave driver, provide the configuration parameters in the
* \ref cy_stc_scb_uart_config_t structure. For example: provide uartMode,
* oversample, dataWidth, enableMsbFirst, parity, and stopBits. The other
* parameters are optional for operation. To initialize the driver,
* call \ref Cy_SCB_UART_Init function providing a pointer to the filled
* \ref cy_stc_scb_uart_config_t structure and allocated \ref cy_stc_scb_uart_context_t.
*
* \snippet SCB_CompDatasheet_sut_01_revA.cydsn\uart_snippets.c UART_CFG
*
* \subsection group_scb_uart_pins Assign and Configure Pins
* Only dedicated SCB pins can be used for UART operation. The HSIOM
* register must be configured to connect the block to the pins. Also the UART output
* pins must be configured in Strong Drive mode and UART input pins in
* Digital High-Z:
*
* \snippet SCB_CompDatasheet_sut_01_revA.cydsn\uart_snippets.c UART_CFG_PINS
*
* \note
* The SCB stops driving pins when it is disabled or enters low power mode (except
* Alternate Active or Sleep). To keep the pins' states, they should be reconfigured or
* be frozen.
*
* \subsection group_scb_uart_clock Assign Clock Divider
* The clock source must be connected to the SCB block to oversample input and
* output signals. You must use one of the 8-bit or 16-bit dividers (the
* source clock of this divider must be Clk_Peri). Use the \ref group_sysclk
* driver API to do that.
*
* \snippet SCB_CompDatasheet_sut_01_revA.cydsn\uart_snippets.c UART_CFG_ASSIGN_CLOCK
*
* \subsection group_scb_uart_data_rate Configure Baud Rate
* To get the UART to operate with the desired baud rate, the source clock frequency
* and the oversample must be configured. Use the \ref group_sysclk driver API
* to configure source clock frequency. Set the oversample parameter
* in configuration structure to define the number of the SCB clocks
* within one UART bit-time.
*
* \snippet SCB_CompDatasheet_sut_01_revA.cydsn\uart_snippets.c UART_CFG_DATA_RATE
*
* Refer to the technical reference manual (TRM) section UART sub-section
* Clocking and Oversampling to get information about how to configure the UART to run with
* desired baud rate.
*
* \subsection group_scb_uart_intr Configure Interrupt
* The interrupt is optional for the UART operation. To configure interrupt
* the \ref Cy_SCB_UART_Interrupt function must be called in the interrupt
* handler for the selected SCB instance. Also, this interrupt must be enabled
* in the NVIC.
*
* \snippet SCB_CompDatasheet_sut_01_revA.cydsn\uart_snippets.c UART_INTR_A
* \snippet SCB_CompDatasheet_sut_01_revA.cydsn\uart_snippets.c UART_INTR_B
*
* \subsection group_scb_uart_enable Enable UART
* Finally, enable the UART operation calling \ref Cy_SCB_UART_Enable.
*
* \snippet SCB_CompDatasheet_sut_01_revA.cydsn\uart_snippets.c UART_ENABLE

* \section group_scb_uart_use_cases Common Use Cases
* The UART API is divided into two categories: \ref group_scb_spi_low_level_functions
* and \ref group_scb_spi_high_level_functions. \n
* Do not mix High-Level and Low-Level API because a Low-Level
* API can adversely affect the operation of a High-Level API.
*
* \subsection group_scb_uart_ll Low-Level API
* The \ref group_scb_uart_low_level_functions API allows
* interacting directly with the hardware and do not use interrupt.
* These functions do not require context for operation, thus NULL can be
* passed in \ref Cy_SCB_UART_Init and \ref Cy_SCB_UART_Disable instead of
* a pointer to the context structure.
*
* * To write data into the TX FIFO, use one of the provided functions:
*   \ref Cy_SCB_UART_Put, \ref Cy_SCB_UART_PutArray,
*   \ref Cy_SCB_UART_PutArrayBlocking or \ref Cy_SCB_UART_PutString.
*   Note that putting data into the TX FIFO starts data transfer.
*
* * To read data from the RX FIFO, use one of the provided functions:
*   \ref Cy_SCB_UART_Get, \ref Cy_SCB_UART_GetArray or
*   \ref Cy_SCB_UART_GetArrayBlocking.
*
* * The statuses can be polled using: \ref Cy_SCB_UART_GetRxFifoStatus and
*   \ref Cy_SCB_UART_GetTxFifoStatus.
*   The statuses are W1C (Write 1 to Clear) and after a status
*   is set, it must be cleared. Note that there are statuses evaluated as level.
*   These statuses remain set until an event is true. Therefore, after the clear
*   operation, the status is cleared but then it is restored (if event is still
*   true).
*   For example: the TX FIFO empty interrupt source can be cleared when the
*   TX FIFO is not empty. Put at least two data elements (one goes to the
*   shifter and next to FIFO) before clearing this status. \n
*   Also, following functions can be used for polling as well
*   \ref Cy_SCB_UART_IsTxComplete, \ref Cy_SCB_UART_GetNumInRxFifo and
*   \ref Cy_SCB_UART_GetNumInTxFifo.
*
* \snippet SCB_CompDatasheet_sut_01_revA.cydsn\uart_snippets.c UART_TRANSMIT_DATA_LL
*
* \subsection group_scb_uart_hl High-Level API

* The \ref group_scb_uart_high_level_functions API uses an interrupt to
* execute transfer. Call \ref Cy_SCB_UART_Transmit to start transmission.
* Call \ref Cy_SCB_UART_Receive to start receive operation. After the
* operation is started the \ref Cy_SCB_UART_Interrupt handles the data
* transfer until its completion.
* Therefore \ref Cy_SCB_UART_Interrupt must be called inside the
* interrupt handler to make the High-Level API work. To monitor status
* of transmit operation, use \ref Cy_SCB_UART_GetTransmitStatus and
* \ref Cy_SCB_UART_GetReceiveStatus to monitor receive status appropriately.
* Alternatively use \ref Cy_SCB_UART_RegisterCallback to register callback
* function to be notified about \ref group_scb_uart_macros_callback_events.
*
* Receive Operation
* \snippet SCB_CompDatasheet_sut_01_revA.cydsn\uart_snippets.c UART_RECEIVE_DATA_HL
*
* Transmit Operation
* \snippet SCB_CompDatasheet_sut_01_revA.cydsn\uart_snippets.c UART_TRANSMIT_DATA_HL
*
* There is also capability to insert a receive ring buffer that operates between
* the RX FIFO and the user buffer. The received data is copied into the ring
* buffer from the RX FIFO. This process runs in the background after the ring
* buffer operation is started by \ref Cy_SCB_UART_StartRingBuffer.
* When \ref Cy_SCB_UART_Receive is called, it first reads data from the ring
* buffer and then sets up an interrupt to receive more data if the required
* amount has not yet been read.
*
* \section group_scb_uart_dma_trig DMA Trigger
* The SCB provides TX and RX output trigger signals that can be routed to the
* DMA controller inputs. These signals are assigned based on the data availability
* in the TX and RX FIFOs appropriately.
*
* * The RX trigger signal remains active until the number of data
*   elements in the RX FIFO is greater than the value of RX FIFO level. Use
*   function \ref Cy_SCB_SetRxFifoLevel or set configuration structure
*   rxFifoTriggerLevel parameter to configure RX FIFO level value. \n
*   For example, the RX FIFO has 8 data elements and the RX FIFO level is 0.
*   The RX trigger signal remains active until DMA does not read all data from
*   the RX FIFO.
*
* * The TX trigger signal remains active until the number of data elements
*   in the TX FIFO is less than the value of TX FIFO level. Use function
*   \ref Cy_SCB_SetTxFifoLevel or set configuration structure txFifoTriggerLevel
*   parameter to configure TX FIFO level value. \n
*   For example, the TX FIFO has 0 data elements (empty) and the TX FIFO level
*   is 7. The TX trigger signal remains active until DMA does not load TX FIFO
*   with 7 data elements (note that after the first TX load operation, the data
*   element goes to the shift register and TX FIFO remains empty).
*
* To route SCB TX or RX trigger signals to DMA controller use \ref group_trigmux
* driver API.
*
* \note
* To properly handle DMA level request signal activation and de-activation from the SCB
* peripheral block the DMA Descriptor typically must be configured to re-trigger
* after 16 Clk_Slow cycles.
*
* \section group_scb_uart_lp Low Power Support
* The UART driver provides the callback functions to handle power mode
* transition. The callback \ref Cy_SCB_UART_DeepSleepCallback must be called
* during execution of \ref Cy_SysPm_DeepSleep; \ref Cy_SCB_UART_HibernateCallback
* must be called during execution of \ref Cy_SysPm_Hibernate. To trigger the
* callback execution, the callback must be registered before calling the
* power mode transition function. Refer to \ref group_syspm driver for more
* information about power mode transitions and callback registration.
*
* The UART is disabled during Deep Sleep and Hibernate and stops driving
* the output pins. The state of the UART output pins TX and RTS is High-Z,
* which can cause unexpected behavior of the UART receiver due to possible
* glitches on these lines. These pins must be set to the inactive state before
* entering Deep Sleep or Hibernate mode. To do that, configure the UART
* pins output to drive the inactive state and High-Speed Input Output
* Multiplexer (HSIOM) to control output by GPIO (use \ref group_gpio
* driver API). The pins configuration must be restored after exiting Deep Sleep
* mode to return the UART control of the pins (after exiting Hibernate mode,
* the system init code does the same).
* Note that the UART must be enabled to drive the pins during configuration
* change not to cause glitches on the lines. Copy either or both
* \ref Cy_SCB_UART_DeepSleepCallback and \ref Cy_SCB_UART_HibernateCallback as
* appropriate, and make the changes described above inside the function.
* Alternately, external pull-up or pull-down resistors can be connected
* to the appropriate UART lines to keep them inactive during Deep-Sleep or
* Hibernate.
*
* \section group_scb_uart_more_information More Information
*
* For more information on the SCB peripheral, refer to the technical reference
* manual (TRM).
*
* \section group_scb_uart_MISRA MISRA-C Compliance
*

*

*     MISRA Rule
*     Rule Class (Required/Advisory)
*     Rule Description
*     Description of Deviation(s)
*

*

*     11.4
*     A
*     A cast should not be performed between a pointer to object type and
*         a different pointer to object type.
*
*         * The pointer to the buffer memory is void to allow handling different
*         different data types: uint8_t (4-8 bits) or uint16_t (9-16 bits).
*         The cast operation is safe because the configuration is verified
*         before operation is performed.
*         * The functions \ref Cy_SCB_UART_DeepSleepCallback and
*         \ref Cy_SCB_UART_HibernateCallback are callback of
*         \ref cy_en_syspm_status_t type. The cast operation safety in these
*         functions becomes the user's responsibility because pointers are
*         initialized when callback is registered in SysPm driver.
*

*

*     14.2
*     R
*     All non-null statements shall either: a) have at least one side-effect
*         however executed, or b) cause control flow to change.
*     The unused function parameters are cast to void. This statement
*         has no side-effect and is used to suppress a compiler warning.
*

*

*     14.7
*     R
*     A function shall have a single point of exit at the end of the
*         function.
*     The functions can return from several points. This is done to improve
*         code clarity when returning error status code if input parameters
*         validation fails.
*

*

*
* \section group_scb_uart_changelog Changelog
*

*
Version	Changes	Reason for Change

*

*     2.10
*     None.
*     SCB I2C driver updated.
*

*

*     2.0
*     Added parameters validation for public API.
*
*

*

*     Replaced variables that have limited range of values with enumerated
*         types.
*
*

*

*     Added missing "cy_cb_" to the callback function type names.
*
*

*

*     Added function \ref Cy_SCB_UART_SendBreakBlocking for break condition
*         generation.
*
*

*

*     Fixed low power callbacks \ref Cy_SCB_UART_DeepSleepCallback and
*         \ref Cy_SCB_UART_HibernateCallback to prevent the device from entering
*         low power mode when RX FIFO is not empty.
*     The callbacks allowed entering device into low power mode when RX FIFO
*         had data.
*

*

*     1.0
*     Initial version.
*
*

*

*
* \defgroup group_scb_uart_macros Macros
* \defgroup group_scb_uart_functions Functions
* \{
* \defgroup group_scb_uart_general_functions General
* \defgroup group_scb_uart_high_level_functions High-Level
* \defgroup group_scb_uart_low_level_functions Low-Level
* \defgroup group_scb_uart_interrupt_functions Interrupt
* \defgroup group_scb_uart_low_power_functions Low Power Callbacks
* \}
* \defgroup group_scb_uart_data_structures Data Structures
* \defgroup group_scb_uart_enums Enumerated Types
*/

#if !defined(CY_SCB_UART_H)
#define CY_SCB_UART_H

#include "cy_scb_common.h"

#if defined(__cplusplus)
extern "C" {
#endif

/***************************************
*          Enumerated Types
***************************************/

/**
* \addtogroup group_scb_uart_enums
* \{
*/

/** UART status codes */
typedef enum
{
    /** Operation completed successfully */
    CY_SCB_UART_SUCCESS = 0U,

    /** One or more of input parameters are invalid */
    CY_SCB_UART_BAD_PARAM = (CY_SCB_ID | CY_PDL_STATUS_ERROR | CY_SCB_UART_ID | 1U),

    /**
    * The UART is busy processing a transmit operation.
    * Call \ref Cy_SCB_UART_Receive function again once that operation
    * is completed or aborted.
    */
    CY_SCB_UART_RECEIVE_BUSY = (CY_SCB_ID | CY_PDL_STATUS_ERROR | CY_SCB_UART_ID | 2U),

    /**
    * The UART is busy processing a receive operation.
    * Call \ref Cy_SCB_UART_Transmit function again once that operation
    * is completed or aborted.
    */
    CY_SCB_UART_TRANSMIT_BUSY = (CY_SCB_ID | CY_PDL_STATUS_ERROR | CY_SCB_UART_ID | 3U)
} cy_en_scb_uart_status_t;

/** UART Mode */
typedef enum
{
    CY_SCB_UART_STANDARD  = 0U, /**< Configures the SCB for Standard UART operation */
    CY_SCB_UART_SMARTCARD = 1U, /**< Configures the SCB for SmartCard operation */
    CY_SCB_UART_IRDA      = 2U, /**< Configures the SCB for IrDA operation */
} cy_en_scb_uart_mode_t;

/** UART Stop Bits */
typedef enum
{
    CY_SCB_UART_STOP_BITS_1   = 2U,  /**< UART looks for 1 Stop Bit    */
    CY_SCB_UART_STOP_BITS_1_5 = 3U,  /**< UART looks for 1.5 Stop Bits */
    CY_SCB_UART_STOP_BITS_2   = 4U,  /**< UART looks for 2 Stop Bits   */
    CY_SCB_UART_STOP_BITS_2_5 = 5U,  /**< UART looks for 2.5 Stop Bits */
    CY_SCB_UART_STOP_BITS_3   = 6U,  /**< UART looks for 3 Stop Bits   */
    CY_SCB_UART_STOP_BITS_3_5 = 7U,  /**< UART looks for 3.5 Stop Bits */
    CY_SCB_UART_STOP_BITS_4   = 8U,  /**< UART looks for 4 Stop Bits   */
} cy_en_scb_uart_stop_bits_t;

/** UART Parity */
typedef enum
{
    CY_SCB_UART_PARITY_NONE = 0U,    /**< UART has no parity check   */
    CY_SCB_UART_PARITY_EVEN = 2U,    /**< UART has even parity check */
    CY_SCB_UART_PARITY_ODD  = 3U,    /**< UART has odd parity check  */
} cy_en_scb_uart_parity_t;

/** UART Polarity */
typedef enum
{
    CY_SCB_UART_ACTIVE_LOW  = 0U,   /**< Signal is active low */
    CY_SCB_UART_ACTIVE_HIGH = 1U,   /**< Signal is active high */
} cy_en_scb_uart_polarity_t;
/** \} group_scb_uart_enums */

/***************************************
*       Type Definitions
***************************************/

/**
* \addtogroup group_scb_uart_data_structures
* \{
*/

/**
* Provides the typedef for the callback function called in the
* \ref Cy_SCB_UART_Interrupt to notify the user about occurrences of
* \ref group_scb_uart_macros_callback_events.
*/
typedef void (* cy_cb_scb_uart_handle_events_t)(uint32_t event);

/** UART configuration structure */
typedef struct stc_scb_uart_config
{
    /** Specifies the UART's mode of operation */
    cy_en_scb_uart_mode_t    uartMode;

    /**
    * Oversample factor for UART.
    * * The UART baud rate is the SCB Clock frequency / oversample
    *  (valid range is 8-16).
    * * For IrDA, the oversample is always 16, unless
    * \ref irdaEnableLowPowerReceiver is enabled. Then the oversample is
    * reduced to the \ref group_scb_uart_macros_irda_lp_ovs set.
    */
    uint32_t    oversample;

    /** The width of UART data (valid range is 5 to 9) */
    uint32_t    dataWidth;

    /**
    * Enables the hardware to shift out data element MSB first; otherwise,
    * LSB first
    */
    bool        enableMsbFirst;

    /**
    * Specifies the number of stop bits in the UART transaction, in half-bit
    * increments
    */
    cy_en_scb_uart_stop_bits_t    stopBits;

    /** Configures the UART parity */
    cy_en_scb_uart_parity_t    parity;

    /**
    * Enables a digital 3-tap median filter to be applied to the input
    * of the RX FIFO to filter glitches on the line (for IrDA, this parameter
    * is ignored)
    *
    */
    bool        enableInputFilter;

    /**
    * Enables the hardware to drop data in the RX FIFO when a parity error is
    * detected
    */
    bool        dropOnParityError;

    /**
    * Enables the hardware to drop data in the RX FIFO when a frame error is
    * detected
    */
    bool        dropOnFrameError;

    /**
    * Enables the UART operation in Multi-Processor mode which requires
    * dataWidth to be 9 bits (the 9th bit is used to indicate address byte)
    */
    bool        enableMutliProcessorMode;

    /**
    * If Multi Processor mode is enabled, this is the address of the RX
    * FIFO. If the address matches, data is accepted into the FIFO. If
    * it does not match, the data is ignored.
    */
    uint32_t    receiverAddress;

    /**
    * This is the address mask for the Multi Processor address. 1 indicates
    * that the incoming address must match the corresponding bit in the slave
    * address. A 0 in the mask indicates that the incoming address does
    * not need to match.
    */
    uint32_t    receiverAddressMask;

    /**
    * Enables the hardware to accept the matching address in the RX FIFO.
    * This is useful when the device supports more than one address.
    */
    bool        acceptAddrInFifo;

    /** Inverts the IrDA RX input */
    bool        irdaInvertRx;

    /**
    * Enables the low-power receive for IrDA mode.
    * Note that the transmission must be disabled if this mode is enabled.
    */
    bool        irdaEnableLowPowerReceiver;

    /**
    * Enables retransmission of the frame placed in the TX FIFO when
    * NACK is received in SmartCard mode (for Standard and IrDA , this parameter
    * is ignored)
    */
    bool        smartCardRetryOnNack;

    /**
    * Enables the usage of the CTS input signal for the transmitter. The
    * transmitter waits for CTS to be active before sending data
    */
    bool        enableCts;

    /** Sets the CTS Polarity */
    cy_en_scb_uart_polarity_t    ctsPolarity;

    /**
    * When the RX FIFO has fewer entries than rtsRxFifoLevel, the
    * RTS signal is active (note to disable RTS, set this field to zero)
    */
    uint32_t    rtsRxFifoLevel;

    /** Sets the RTS Polarity */
    cy_en_scb_uart_polarity_t    rtsPolarity;

    /** Specifies the number of bits to detect a break condition */
    uint32_t    breakWidth;

    /**
    * When there are more entries in the RX FIFO than this level
    * the RX trigger output goes high. This output can be connected
    * to a DMA channel through a trigger mux.
    * Also, it controls the \ref CY_SCB_UART_RX_TRIGGER interrupt source.
    */
    uint32_t    rxFifoTriggerLevel;

    /**
    * The bits set in this mask allow the event to cause an interrupt
    * (See \ref group_scb_uart_macros_rx_fifo_status for the set of constants)
    */
    uint32_t    rxFifoIntEnableMask;

    /**
    * When there are fewer entries in the TX FIFO then this level
    * the TX trigger output goes high. This output can be connected
    * to a DMA channel through a trigger mux.
    * Also, it controls \ref CY_SCB_UART_TX_TRIGGER interrupt source.
    */
    uint32_t    txFifoTriggerLevel;

    /**
    * Bits set in this mask allows the event to cause an interrupt
    * (See \ref group_scb_uart_macros_tx_fifo_status for the set of constants)
    */
    uint32_t    txFifoIntEnableMask;
} cy_stc_scb_uart_config_t;

/** UART context structure.
* All fields for the context structure are internal. Firmware never reads or
* writes these values. Firmware allocates the structure and provides the
* address of the structure to the driver in function calls. Firmware must
* ensure that the defined instance of this structure remains in scope
* while the drive is in use.
*/
typedef struct cy_stc_scb_uart_context
{
    /** \cond INTERNAL */
    uint32_t volatile txStatus;         /**< The transmit status */
    uint32_t volatile rxStatus;         /**< The receive status */

    void     *rxRingBuf;                /**< The pointer to the ring buffer */
    uint32_t  rxRingBufSize;            /**< The ring buffer size */
    uint32_t volatile rxRingBufHead;    /**< The ring buffer head index */
    uint32_t volatile rxRingBufTail;    /**< The ring buffer tail index */

    void     *rxBuf;                    /**< The pointer to the receive buffer */
    uint32_t  rxBufSize;                /**< The receive buffer size */
    uint32_t volatile rxBufIdx;         /**< The current location in the receive buffer */

    void     *txBuf;                    /**< The pointer to the transmit buffer */
    uint32_t  txBufSize;                /**< The transmit buffer size */
    uint32_t volatile txLeftToTransmit; /**< The number of data elements left to be transmitted */

    /** The pointer to an event callback that is called when any of
    * \ref group_scb_uart_macros_callback_events occurs
    */
    cy_cb_scb_uart_handle_events_t cbEvents;

#if !defined(NDEBUG)
    uint32_t initKey;               /**< Tracks the context initialization */
#endif /* !(NDEBUG) */
    /** \endcond */
} cy_stc_scb_uart_context_t;
/** \} group_scb_uart_data_structures */

/***************************************
*        Function Prototypes
***************************************/

/**
* \addtogroup group_scb_uart_general_functions
* \{
*/
cy_en_scb_uart_status_t Cy_SCB_UART_Init(CySCB_Type *base, cy_stc_scb_uart_config_t const *config,
                                         cy_stc_scb_uart_context_t *context);
void Cy_SCB_UART_DeInit (CySCB_Type *base);
__STATIC_INLINE void Cy_SCB_UART_Enable(CySCB_Type *base);
void Cy_SCB_UART_Disable(CySCB_Type *base, cy_stc_scb_uart_context_t *context);

__STATIC_INLINE void     Cy_SCB_UART_EnableCts      (CySCB_Type *base);
__STATIC_INLINE void     Cy_SCB_UART_DisableCts     (CySCB_Type *base);
__STATIC_INLINE void     Cy_SCB_UART_SetRtsFifoLevel(CySCB_Type *base, uint32_t level);
__STATIC_INLINE uint32_t Cy_SCB_UART_GetRtsFifoLevel(CySCB_Type const *base);

__STATIC_INLINE void Cy_SCB_UART_EnableSkipStart (CySCB_Type *base);
__STATIC_INLINE void Cy_SCB_UART_DisableSkipStart(CySCB_Type *base);
/** \} group_scb_uart_general_functions */

/**
* \addtogroup group_scb_uart_high_level_functions
* \{
*/
void     Cy_SCB_UART_StartRingBuffer   (CySCB_Type *base, void *buffer, uint32_t size,
                                        cy_stc_scb_uart_context_t *context);
void     Cy_SCB_UART_StopRingBuffer    (CySCB_Type *base, cy_stc_scb_uart_context_t *context);
uint32_t Cy_SCB_UART_GetNumInRingBuffer(CySCB_Type const *base, cy_stc_scb_uart_context_t const *context);
void     Cy_SCB_UART_ClearRingBuffer   (CySCB_Type const *base, cy_stc_scb_uart_context_t *context);

cy_en_scb_uart_status_t Cy_SCB_UART_Receive(CySCB_Type *base, void *buffer, uint32_t size,
                                            cy_stc_scb_uart_context_t *context);
void     Cy_SCB_UART_AbortReceive    (CySCB_Type *base, cy_stc_scb_uart_context_t *context);
uint32_t Cy_SCB_UART_GetReceiveStatus(CySCB_Type const *base, cy_stc_scb_uart_context_t const *context);
uint32_t Cy_SCB_UART_GetNumReceived  (CySCB_Type const *base, cy_stc_scb_uart_context_t const *context);

cy_en_scb_uart_status_t Cy_SCB_UART_Transmit(CySCB_Type *base, void *buffer, uint32_t size,
                                             cy_stc_scb_uart_context_t *context);
void     Cy_SCB_UART_AbortTransmit       (CySCB_Type *base, cy_stc_scb_uart_context_t *context);
uint32_t Cy_SCB_UART_GetTransmitStatus   (CySCB_Type const *base, cy_stc_scb_uart_context_t const *context);
uint32_t Cy_SCB_UART_GetNumLeftToTransmit(CySCB_Type const *base, cy_stc_scb_uart_context_t const *context);
/** \} group_scb_uart_high_level_functions */

/**
* \addtogroup group_scb_uart_low_level_functions
* \{
*/
__STATIC_INLINE uint32_t Cy_SCB_UART_Put             (CySCB_Type *base, uint32_t data);
__STATIC_INLINE uint32_t Cy_SCB_UART_PutArray        (CySCB_Type *base, void *buffer, uint32_t size);
__STATIC_INLINE void     Cy_SCB_UART_PutArrayBlocking(CySCB_Type *base, void *buffer, uint32_t size);
__STATIC_INLINE void     Cy_SCB_UART_PutString       (CySCB_Type *base, char_t const string[]);
void Cy_SCB_UART_SendBreakBlocking(CySCB_Type *base, uint32_t breakWidth);

__STATIC_INLINE uint32_t Cy_SCB_UART_Get             (CySCB_Type const *base);
__STATIC_INLINE uint32_t Cy_SCB_UART_GetArray        (CySCB_Type const *base, void *buffer, uint32_t size);
__STATIC_INLINE void     Cy_SCB_UART_GetArrayBlocking(CySCB_Type const *base, void *buffer, uint32_t size);

__STATIC_INLINE uint32_t Cy_SCB_UART_GetTxFifoStatus  (CySCB_Type const *base);
__STATIC_INLINE void     Cy_SCB_UART_ClearTxFifoStatus(CySCB_Type *base, uint32_t clearMask);

__STATIC_INLINE uint32_t Cy_SCB_UART_GetRxFifoStatus  (CySCB_Type const *base);
__STATIC_INLINE void     Cy_SCB_UART_ClearRxFifoStatus(CySCB_Type *base, uint32_t clearMask);

__STATIC_INLINE uint32_t Cy_SCB_UART_GetNumInTxFifo   (CySCB_Type const *base);
__STATIC_INLINE bool     Cy_SCB_UART_IsTxComplete     (CySCB_Type const *base);

__STATIC_INLINE uint32_t Cy_SCB_UART_GetNumInRxFifo   (CySCB_Type const *base);

__STATIC_INLINE void     Cy_SCB_UART_ClearRxFifo      (CySCB_Type *base);
__STATIC_INLINE void     Cy_SCB_UART_ClearTxFifo      (CySCB_Type *base);
/** \} group_scb_uart_low_level_functions */

/**
* \addtogroup group_scb_uart_interrupt_functions
* \{
*/
void Cy_SCB_UART_Interrupt(CySCB_Type *base, cy_stc_scb_uart_context_t *context);

__STATIC_INLINE void Cy_SCB_UART_RegisterCallback(CySCB_Type const *base, cy_cb_scb_uart_handle_events_t callback,
                                                  cy_stc_scb_uart_context_t *context);
/** \} group_scb_uart_interrupt_functions */

/**
* \addtogroup group_scb_uart_low_power_functions
* \{
*/
cy_en_syspm_status_t Cy_SCB_UART_DeepSleepCallback(cy_stc_syspm_callback_params_t *callbackParams);
cy_en_syspm_status_t Cy_SCB_UART_HibernateCallback(cy_stc_syspm_callback_params_t *callbackParams);
/** \} group_scb_uart_low_power_functions */

/***************************************
*            API Constants
***************************************/

/**
* \addtogroup group_scb_uart_macros
* \{
*/

/**
* \defgroup group_scb_uart_macros_irda_lp_ovs UART IRDA Low Power Oversample factors
* \{
*/
#define CY_SCB_UART_IRDA_LP_OVS16      (1UL)   /**< IrDA in low-power mode oversampled by 16   */
#define CY_SCB_UART_IRDA_LP_OVS32      (2UL)   /**< IrDA in low-power mode oversampled by 32   */
#define CY_SCB_UART_IRDA_LP_OVS48      (3UL)   /**< IrDA in low-power mode oversampled by 48   */
#define CY_SCB_UART_IRDA_LP_OVS96      (4UL)   /**< IrDA in low-power mode oversampled by 96   */
#define CY_SCB_UART_IRDA_LP_OVS192     (5UL)   /**< IrDA in low-power mode oversampled by 192  */
#define CY_SCB_UART_IRDA_LP_OVS768     (6UL)   /**< IrDA in low-power mode oversampled by 768  */
#define CY_SCB_UART_IRDA_LP_OVS1536    (7UL)   /**< IrDA in low-power mode oversampled by 1536 */
/** \} group_scb_uart_macros_irda_lp_ovs */

/**
* \defgroup group_scb_uart_macros_rx_fifo_status UART Receive FIFO status.
* \{
*/
/** The number of entries in the RX FIFO is more than the RX FIFO trigger level
* value
*/
#define CY_SCB_UART_RX_TRIGGER         (SCB_INTR_RX_TRIGGER_Msk)

/** The RX FIFO is not empty, there is data to read */
#define CY_SCB_UART_RX_NOT_EMPTY       (SCB_INTR_RX_NOT_EMPTY_Msk)

/**
* The RX FIFO is full, there is no more space for additional data, and
* any additional data will be dropped
*/
#define CY_SCB_UART_RX_FULL            (SCB_INTR_RX_FULL_Msk)

/**
* The RX FIFO was full and there was an attempt to write to it.
* That additional data was dropped.
*/
#define CY_SCB_UART_RX_OVERFLOW        (SCB_INTR_RX_OVERFLOW_Msk)

/** An attempt to read from an empty RX FIFO */
#define CY_SCB_UART_RX_UNDERFLOW       (SCB_INTR_RX_UNDERFLOW_Msk)

/** The RX FIFO detected a frame error, either a stop or stop-bit error */
#define CY_SCB_UART_RX_ERR_FRAME       (SCB_INTR_RX_FRAME_ERROR_Msk)

/** The RX FIFO detected a parity error */
#define CY_SCB_UART_RX_ERR_PARITY      (SCB_INTR_RX_PARITY_ERROR_Msk)

/** The RX FIFO detected a break transmission from the transmitter */
#define CY_SCB_UART_RX_BREAK_DETECT    (SCB_INTR_RX_BREAK_DETECT_Msk)
/** \} group_scb_uart_macros_rx_fifo_status */

/**
* \defgroup group_scb_uart_macros_tx_fifo_status UART TX FIFO Statuses
* \{
*/
/** The number of entries in the TX FIFO is less than the TX FIFO trigger level
* value
*/
#define CY_SCB_UART_TX_TRIGGER     (SCB_INTR_TX_TRIGGER_Msk)

/** The TX FIFO is not full, there is a space for more data */
#define CY_SCB_UART_TX_NOT_FULL    (SCB_INTR_TX_NOT_FULL_Msk)

/** The TX FIFO is empty, note there may still be data in the shift register.*/
#define CY_SCB_UART_TX_EMPTY       (SCB_INTR_TX_EMPTY_Msk)

/** An attempt to write to the full TX FIFO */
#define CY_SCB_UART_TX_OVERFLOW    (SCB_INTR_TX_OVERFLOW_Msk)

/** An attempt to read from an empty transmitter FIFO (hardware reads). */
#define CY_SCB_UART_TX_UNDERFLOW (SCB_INTR_TX_UNDERFLOW_Msk)

/** All data has been transmitted out of the FIFO, including shifter */
#define CY_SCB_UART_TX_DONE        (SCB_INTR_TX_UART_DONE_Msk)

/** SmartCard only: the transmitter received a NACK */
#define CY_SCB_UART_TX_NACK        (SCB_INTR_TX_UART_NACK_Msk)

/** SmartCard only: the transmitter lost arbitration */
#define CY_SCB_UART_TX_ARB_LOST    (SCB_INTR_TX_UART_ARB_LOST_Msk)
/** \} group_scb_uart_macros_tx_fifo_status */

/**
* \defgroup group_scb_uart_macros_receive_status UART Receive Statuses
* \{
*/
/** The receive operation started by \ref Cy_SCB_UART_Receive is in progress */
#define CY_SCB_UART_RECEIVE_ACTIVE         (0x01UL)

/**
* The hardware RX FIFO was full and there was an attempt to write to it.
* That additional data was dropped.
*/
#define CY_SCB_UART_RECEIVE_OVERFLOW       (SCB_INTR_RX_OVERFLOW_Msk)

/** The receive hardware detected a frame error, either a start or
* stop bit error
*/
#define CY_SCB_UART_RECEIVE_ERR_FRAME      (SCB_INTR_RX_FRAME_ERROR_Msk)

/** The receive hardware detected a parity error */
#define CY_SCB_UART_RECEIVE_ERR_PARITY     (SCB_INTR_RX_PARITY_ERROR_Msk)

/** The receive hardware detected a break transmission from transmitter */
#define CY_SCB_UART_RECEIVE_BREAK_DETECT   (SCB_INTR_RX_BREAK_DETECT_Msk)
/** \} group_scb_uart_macros_receive_status */

/**
* \defgroup group_scb_uart_macros_transmit_status UART Transmit Status
* \{
*/
/** The transmit operation started by \ref Cy_SCB_UART_Transmit is in progress */
#define CY_SCB_UART_TRANSMIT_ACTIVE    (0x01UL)

/**
* All data elements specified by \ref Cy_SCB_UART_Transmit have been loaded
* into the TX FIFO
*/
#define CY_SCB_UART_TRANSMIT_IN_FIFO   (0x02UL)

/** SmartCard only: the transmitter received a NACK */
#define CY_SCB_UART_TRANSMIT_NACK      (SCB_INTR_TX_UART_NACK_Msk)

/** SmartCard only: the transmitter lost arbitration */
#define CY_SCB_UART_TRANSMIT_ARB_LOST  (SCB_INTR_TX_UART_ARB_LOST_Msk)
/** \} group_scb_uart_macros_transmit_status */

/**
* \defgroup group_scb_uart_macros_callback_events UART Callback Events
* \{
* Only single event is notified by the callback.
*/
/**
* All data elements specified by \ref Cy_SCB_UART_Transmit have been loaded
* into the TX FIFO
*/
#define CY_SCB_UART_TRANSMIT_IN_FIFO_EVENT (0x01UL)

/** The transmit operation started by \ref Cy_SCB_UART_Transmit is complete */
#define CY_SCB_UART_TRANSMIT_DONE_EVENT    (0x02UL)

/** The receive operation started by \ref Cy_SCB_UART_Receive is complete */
#define CY_SCB_UART_RECEIVE_DONE_EVENT     (0x04UL)

/**
* The ring buffer is full, there is no more space for additional data.
* Additional data is stored in the RX FIFO until it becomes full, at which
* point data is dropped.
*/
#define CY_SCB_UART_RB_FULL_EVENT          (0x08UL)

/**
* An error was detected during the receive operation. This includes overflow,
* frame error, or parity error. Check \ref Cy_SCB_UART_GetReceiveStatus to
* determine the source of the error.
*/
#define CY_SCB_UART_RECEIVE_ERR_EVENT      (0x10UL)

/**
* An error was detected during the transmit operation. This includes a NACK
* or lost arbitration. Check \ref Cy_SCB_UART_GetTransmitStatus to determine
* the source of the error
*/
#define CY_SCB_UART_TRANSMIT_ERR_EVENT     (0x20UL)
/** \} group_scb_uart_macros_callback_events */

/** Data returned by the hardware when an empty RX FIFO is read */
#define CY_SCB_UART_RX_NO_DATA         (0xFFFFFFFFUL)

/***************************************
*         Internal Constants
***************************************/

/** \cond INTERNAL */
#define CY_SCB_UART_TX_INTR_MASK    (CY_SCB_UART_TX_TRIGGER  | CY_SCB_UART_TX_NOT_FULL  | CY_SCB_UART_TX_EMPTY | \
                                     CY_SCB_UART_TX_OVERFLOW | CY_SCB_UART_TX_UNDERFLOW | CY_SCB_UART_TX_DONE  | \
                                     CY_SCB_UART_TX_NACK     | CY_SCB_UART_TX_ARB_LOST)

#define CY_SCB_UART_RX_INTR_MASK    (CY_SCB_UART_RX_TRIGGER    | CY_SCB_UART_RX_NOT_EMPTY | CY_SCB_UART_RX_FULL      | \
                                     CY_SCB_UART_RX_OVERFLOW   | CY_SCB_UART_RX_UNDERFLOW | CY_SCB_UART_RX_ERR_FRAME | \
                                     CY_SCB_UART_RX_ERR_PARITY | CY_SCB_UART_RX_BREAK_DETECT)

#define CY_SCB_UART_TX_INTR        (CY_SCB_TX_INTR_LEVEL | CY_SCB_TX_INTR_UART_NACK | CY_SCB_TX_INTR_UART_ARB_LOST)

#define CY_SCB_UART_RX_INTR        (CY_SCB_RX_INTR_LEVEL | CY_SCB_RX_INTR_OVERFLOW | CY_SCB_RX_INTR_UART_FRAME_ERROR | \
                                    CY_SCB_RX_INTR_UART_PARITY_ERROR | CY_SCB_RX_INTR_UART_BREAK_DETECT)

#define CY_SCB_UART_RECEIVE_ERR    (CY_SCB_RX_INTR_OVERFLOW | CY_SCB_RX_INTR_UART_FRAME_ERROR | \
                                    CY_SCB_RX_INTR_UART_PARITY_ERROR)

#define CY_SCB_UART_TRANSMIT_ERR   (CY_SCB_TX_INTR_UART_NACK | CY_SCB_TX_INTR_UART_ARB_LOST)

#define CY_SCB_UART_INIT_KEY       (0x00ABCDEFUL)

#define CY_SCB_UART_IS_MODE_VALID(mode)     ( (CY_SCB_UART_STANDARD  == (mode)) || \
                                              (CY_SCB_UART_SMARTCARD == (mode)) || \
                                              (CY_SCB_UART_IRDA      == (mode)) )

#define CY_SCB_UART_IS_STOP_BITS_VALID(stopBits)    ( (CY_SCB_UART_STOP_BITS_1   == (stopBits)) || \
                                                      (CY_SCB_UART_STOP_BITS_1_5 == (stopBits)) || \
                                                      (CY_SCB_UART_STOP_BITS_2   == (stopBits)) || \
                                                      (CY_SCB_UART_STOP_BITS_2_5 == (stopBits)) || \
                                                      (CY_SCB_UART_STOP_BITS_3   == (stopBits)) || \
                                                      (CY_SCB_UART_STOP_BITS_3_5 == (stopBits)) || \
                                                      (CY_SCB_UART_STOP_BITS_4   == (stopBits)) )

#define CY_SCB_UART_IS_PARITY_VALID(parity)         ( (CY_SCB_UART_PARITY_NONE == (parity)) || \
                                                      (CY_SCB_UART_PARITY_EVEN == (parity)) || \
                                                      (CY_SCB_UART_PARITY_ODD  == (parity)) )

#define CY_SCB_UART_IS_POLARITY_VALID(polarity)     ( (CY_SCB_UART_ACTIVE_LOW  == (polarity)) || \
                                                      (CY_SCB_UART_ACTIVE_HIGH == (polarity)) )

#define CY_SCB_UART_IS_IRDA_LP_OVS_VALID(ovs)       ( (CY_SCB_UART_IRDA_LP_OVS16   == (ovs)) || \
                                                      (CY_SCB_UART_IRDA_LP_OVS32   == (ovs)) || \
                                                      (CY_SCB_UART_IRDA_LP_OVS48   == (ovs)) || \
                                                      (CY_SCB_UART_IRDA_LP_OVS96   == (ovs)) || \
                                                      (CY_SCB_UART_IRDA_LP_OVS192  == (ovs)) || \
                                                      (CY_SCB_UART_IRDA_LP_OVS768  == (ovs)) || \
                                                      (CY_SCB_UART_IRDA_LP_OVS1536 == (ovs)) )

#define CY_SCB_UART_IS_ADDRESS_VALID(addr)          ((addr) <= 0xFFUL)
#define CY_SCB_UART_IS_ADDRESS_MASK_VALID(mask)     ((mask) <= 0xFFUL)
#define CY_SCB_UART_IS_DATA_WIDTH_VALID(width)      ( ((width) >= 5UL) && ((width) <= 9UL) )
#define CY_SCB_UART_IS_OVERSAMPLE_VALID(ovs, mode, lpRx)    ( ((CY_SCB_UART_STANDARD  == (mode)) || (CY_SCB_UART_SMARTCARD == (mode))) ? \
                                                              (((ovs) >= 8UL) && ((ovs) <= 16UL)) :                                      \
                                                              ((lpRx) ? CY_SCB_UART_IS_IRDA_LP_OVS_VALID(ovs) : true) )

#define CY_SCB_UART_IS_RX_BREAK_WIDTH_VALID(base, width)    ( ((width) >= (_FLD2VAL(SCB_RX_CTRL_DATA_WIDTH, (base)->RX_CTRL) + 3UL)) && \
                                                              ((width) <= 16UL) )
#define CY_SCB_UART_IS_TX_BREAK_WIDTH_VALID(width)          ( ((width) >= 4UL) && ((width) <= 16UL) )

#define CY_SCB_UART_IS_MUTLI_PROC_VALID(mp, mode, width, parity)    ( (mp) ? ((CY_SCB_UART_STANDARD  == (mode)) && ((width) == 9UL) && \
                                                                              (CY_SCB_UART_PARITY_NONE == (parity))) : true)
/** \endcond */

/** \} group_scb_uart_macros */

/***************************************
*    In-line Function Implementation
***************************************/

/**
* \addtogroup group_scb_uart_general_functions
* \{
*/

/*******************************************************************************
* Function Name: Cy_SCB_UART_Enable
****************************************************************************//**
*
* Enables the SCB block for the UART operation.
*
* \param base
* The pointer to the UART SCB instance.
*
*******************************************************************************/
__STATIC_INLINE void Cy_SCB_UART_Enable(CySCB_Type *base)
{
    base->CTRL |= SCB_CTRL_ENABLED_Msk;
}

/*******************************************************************************
* Function Name: Cy_SCB_UART_EnableCts
****************************************************************************//**
*
* Enables the Clear to Send (CTS) input for the UART. The UART will not transmit
* data while this signal is inactive.
*
* \param base
* The pointer to the UART SCB instance.
*
*******************************************************************************/
__STATIC_INLINE void Cy_SCB_UART_EnableCts(CySCB_Type *base)
{
    base->UART_FLOW_CTRL |= SCB_UART_FLOW_CTRL_CTS_ENABLED_Msk;
}

/*******************************************************************************
* Function Name: Cy_SCB_UART_DisableCts
****************************************************************************//**
*
* Disables the Clear to Send (CTS) input for the UART.
* See \ref Cy_SCB_UART_EnableCts for the details.
*
* \param base
* The pointer to the UART SCB instance.
*
*******************************************************************************/
__STATIC_INLINE void Cy_SCB_UART_DisableCts(CySCB_Type *base)
{
    base->UART_FLOW_CTRL &= (uint32_t) ~SCB_UART_FLOW_CTRL_CTS_ENABLED_Msk;
}

/*******************************************************************************
* Function Name: Cy_SCB_UART_SetRtsFifoLevel
****************************************************************************//**
*
* Sets a level for the Ready To Send (RTS) signal activation.
* When the number of data elements in the receive FIFO is below this level,
* then the RTS output is active. Otherwise, the RTS signal is inactive.
* To disable the RTS signal generation, set this level to zero.
*
* \param base
* The pointer to the UART SCB instance.
*
* \param level
* The level in the RX FIFO for RTS signal activation.
*
*******************************************************************************/
__STATIC_INLINE void Cy_SCB_UART_SetRtsFifoLevel(CySCB_Type *base, uint32_t level)
{
    CY_ASSERT_L2(CY_SCB_IS_TRIGGER_LEVEL_VALID(base, level));

    base->UART_FLOW_CTRL = _CLR_SET_FLD32U(base->UART_FLOW_CTRL, SCB_UART_FLOW_CTRL_TRIGGER_LEVEL, level);
}

/*******************************************************************************
* Function Name: Cy_SCB_UART_GetRtsFifoLevel
****************************************************************************//**
*
* Returns the level in the RX FIFO for the RTS signal activation.
*
* \param base
* The pointer to the UART SCB instance.
*
* \return
* The level in the RX FIFO for RTS signal activation.
*
*******************************************************************************/
__STATIC_INLINE uint32_t Cy_SCB_UART_GetRtsFifoLevel(CySCB_Type const *base)
{
    return _FLD2VAL(SCB_UART_FLOW_CTRL_TRIGGER_LEVEL, base->UART_FLOW_CTRL);
}

/*******************************************************************************
* Function Name: Cy_SCB_UART_EnableSkipStart
****************************************************************************//**
*
* Enables the skip start-bit functionality.
* The UART hardware does not synchronize to a start but synchronizes to
* the first rising edge. To create a rising edge, the first data bit must
* be a 1. This feature is useful when the Start edge is used to wake the
* device through a GPIO interrupt.
*
* \param base
* The pointer to the UART SCB instance.
*
* \note
* The skip start-bit feature is applied whenever the UART is disabled due
* to entrance into Deep Sleep or after calling \ref Cy_SCB_UART_Disable.
*
*******************************************************************************/
__STATIC_INLINE void Cy_SCB_UART_EnableSkipStart(CySCB_Type *base)
{
    base->UART_RX_CTRL |= SCB_UART_RX_CTRL_SKIP_START_Msk;
}

/*******************************************************************************
* Function Name: Cy_SCB_UART_DisableSkipStart
****************************************************************************//**
*
* Disable the skip start-bit functionality.
* See \ref Cy_SCB_UART_EnableSkipStart for the details.
*
* \param base
* The pointer to the UART SCB instance.
*
*******************************************************************************/
__STATIC_INLINE void Cy_SCB_UART_DisableSkipStart(CySCB_Type *base)
{
    base->UART_RX_CTRL &= (uint32_t) ~SCB_UART_RX_CTRL_SKIP_START_Msk;
}
/** \} group_scb_uart_general_functions */

/**
* \addtogroup group_scb_uart_low_level_functions
* \{
*/
/*******************************************************************************
* Function Name: Cy_SCB_UART_Get
****************************************************************************//**
*
* Reads a single data element from the UART RX FIFO.
* This function does not check whether the RX FIFO has data before reading it.
* If the RX FIFO is empty, the function returns \ref CY_SCB_UART_RX_NO_DATA.
*
* \param base
* The pointer to the UART SCB instance.
*
* \return
* Data from the RX FIFO.
* The data element size is defined by the configured data width.
*
*******************************************************************************/
__STATIC_INLINE uint32_t Cy_SCB_UART_Get(CySCB_Type const *base)
{
    return Cy_SCB_ReadRxFifo(base);
}

/*******************************************************************************
* Function Name: Cy_SCB_UART_GetArray
****************************************************************************//**
*
* Reads an array of data out of the UART RX FIFO.
* This function does not block. It returns how many data elements were read
* from the RX FIFO.
*
* \param base
* The pointer to the UART SCB instance.
*
* \param buffer
* The pointer to the location to place the data read from the RX FIFO.
* The item size is defined by the data type, which depends on the configured
* data width.
*
* \param size
* The number of data elements to read from the RX FIFO.
*
* \return
* The number of data elements read from the RX FIFO.
*
*******************************************************************************/
__STATIC_INLINE uint32_t Cy_SCB_UART_GetArray(CySCB_Type const *base, void *buffer, uint32_t size)
{
    CY_ASSERT_L1(CY_SCB_IS_BUFFER_VALID(buffer, size));

    return Cy_SCB_ReadArray(base, buffer, size);
}

/*******************************************************************************
* Function Name: Cy_SCB_UART_GetArrayBlocking
****************************************************************************//**
*
* Reads an array of data out of the UART RX FIFO.
* This function blocks until the number of data elements specified by the
* size has been read from the RX FIFO.
*
* \param base
* The pointer to the UART SCB instance.
*
* \param buffer
* The pointer to the location to place the data read from the RX FIFO.
* The item size is defined by the data type, which depends on the configured
* data width.
*
* \param size
* The number of data elements to read from the RX FIFO.
*
*******************************************************************************/
__STATIC_INLINE void Cy_SCB_UART_GetArrayBlocking(CySCB_Type const *base, void *buffer, uint32_t size)
{
    CY_ASSERT_L1(CY_SCB_IS_BUFFER_VALID(buffer, size));

    Cy_SCB_ReadArrayBlocking(base, buffer, size);
}

/*******************************************************************************
* Function Name: Cy_SCB_UART_GetRxFifoStatus
****************************************************************************//**
*
* Returns the current status of the RX FIFO.
* Clears the active statuses to let the SCB hardware update them.
*
* \param base
* The pointer to the UART SCB instance.
*
* \return
* \ref group_scb_uart_macros_rx_fifo_status
*
*******************************************************************************/
__STATIC_INLINE uint32_t Cy_SCB_UART_GetRxFifoStatus(CySCB_Type const *base)
{
    return (Cy_SCB_GetRxInterruptStatus(base) & CY_SCB_UART_RX_INTR_MASK);
}

/*******************************************************************************
* Function Name: Cy_SCB_UART_ClearRxFifoStatus
****************************************************************************//**
*
* Clears the selected statuses of the RX FIFO.
*
* \param base
* The pointer to the UART SCB instance.
*
* \param clearMask
* The mask whose statuses to clear.
* See \ref group_scb_uart_macros_rx_fifo_status for the set of constants.
*
* \note
* * This status is also used for interrupt generation, so clearing it also
*   clears the interrupt sources.
* * Level-sensitive statuses such as \ref CY_SCB_UART_RX_TRIGGER,
*   \ref CY_SCB_UART_RX_NOT_EMPTY and \ref CY_SCB_UART_RX_FULL are set high again after
*   being cleared if the condition remains true.
*
*******************************************************************************/
__STATIC_INLINE void Cy_SCB_UART_ClearRxFifoStatus(CySCB_Type *base, uint32_t clearMask)
{
    CY_ASSERT_L2(CY_SCB_IS_INTR_VALID(clearMask, CY_SCB_UART_RX_INTR_MASK));

    Cy_SCB_ClearRxInterrupt(base, clearMask);
}

/*******************************************************************************
* Function Name: Cy_SCB_UART_GetNumInRxFifo
****************************************************************************//**
*
* Returns the number of data elements in the UART RX FIFO.
*
* \param base
* The pointer to the UART SCB instance.
*
* \return
* The number of data elements in the RX FIFO.
* The size of date element defined by the configured data width.
*
*******************************************************************************/
__STATIC_INLINE uint32_t Cy_SCB_UART_GetNumInRxFifo(CySCB_Type const *base)
{
    return Cy_SCB_GetNumInRxFifo(base);
}

/*******************************************************************************
* Function Name: Cy_SCB_UART_ClearRxFifo
****************************************************************************//**
*
* Clears all data out of the UART RX FIFO.
*
* \param base
* The pointer to the UART SCB instance.
*
* \sideeffect
* Any data currently in the shifter is cleared and lost.
*
*******************************************************************************/
__STATIC_INLINE void Cy_SCB_UART_ClearRxFifo(CySCB_Type *base)
{
    Cy_SCB_ClearRxFifo(base);
}

/*******************************************************************************
* Function Name: Cy_SCB_UART_Put
****************************************************************************//**
*
* Places a single data element in the UART TX FIFO.
* This function does not block and returns how many data elements were placed
* in the TX FIFO.
*
* \param base
* The pointer to the UART SCB instance.
*
* \param data
* Data to put in the TX FIFO.
* The item size is defined by the data type, which depends on the configured
* data width.
*
* \return
* The number of data elements placed in the TX FIFO: 0 or 1.
*
*******************************************************************************/
__STATIC_INLINE uint32_t Cy_SCB_UART_Put(CySCB_Type *base, uint32_t data)
{
    return Cy_SCB_Write(base, data);
}

/*******************************************************************************
* Function Name: Cy_SCB_UART_PutArray
****************************************************************************//**
*
* Places an array of data in the UART TX FIFO.
* This function does not block. It returns how many data elements were
* placed in the TX FIFO.
*
* \param base
* The pointer to the UART SCB instance.
*
* \param buffer
* The pointer to data to place in the TX FIFO.
* The item size is defined by the data type, which depends on the configured
* TX data width.
*
* \param size
* The number of data elements to TX.
*
* \return
* The number of data elements placed in the TX FIFO.
*
*******************************************************************************/
__STATIC_INLINE uint32_t Cy_SCB_UART_PutArray(CySCB_Type *base, void *buffer, uint32_t size)
{
    CY_ASSERT_L1(CY_SCB_IS_BUFFER_VALID(buffer, size));

    return Cy_SCB_WriteArray(base, buffer, size);
}

/*******************************************************************************
* Function Name: Cy_SCB_UART_PutArrayBlocking
****************************************************************************//**
*
* Places an array of data in the UART TX FIFO.
* This function blocks until the number of data elements specified by the size
* is placed in the TX FIFO.
*
* \param base
* The pointer to the UART SCB instance.
*
* \param buffer
* The pointer to data to place in the TX FIFO.
* The item size is defined by the data type, which depends on the configured
* data width.
*
* \param size
* The number of data elements to write into the TX FIFO.
*
*******************************************************************************/
__STATIC_INLINE void Cy_SCB_UART_PutArrayBlocking(CySCB_Type *base, void *buffer, uint32_t size)
{
    CY_ASSERT_L1(CY_SCB_IS_BUFFER_VALID(buffer, size));

    Cy_SCB_WriteArrayBlocking(base, buffer, size);
}

/*******************************************************************************
* Function Name: Cy_SCB_UART_PutString
****************************************************************************//**
*
* Places a NULL terminated string in the UART TX FIFO.
* This function blocks until the entire string is placed in the TX FIFO.
*
* \param base
* The pointer to the UART SCB instance.
*
* \param string
* The pointer to the null terminated string array.
*
*******************************************************************************/
__STATIC_INLINE void Cy_SCB_UART_PutString(CySCB_Type *base, char_t const string[])
{
    CY_ASSERT_L1(CY_SCB_IS_BUFFER_VALID(string, 1UL));

    Cy_SCB_WriteString(base, string);
}

/*******************************************************************************
* Function Name: Cy_SCB_UART_GetTxFifoStatus
****************************************************************************//**
*
* Returns the current status of the TX FIFO.
* Clear the active statuses to let the SCB hardware update them.
*
* \param base
* The pointer to the UART SCB instance.
*
* \return
* \ref group_scb_uart_macros_tx_fifo_status
*
*******************************************************************************/
__STATIC_INLINE uint32_t Cy_SCB_UART_GetTxFifoStatus(CySCB_Type const *base)
{
    return (Cy_SCB_GetTxInterruptStatus(base) & CY_SCB_UART_TX_INTR_MASK);
}

/*******************************************************************************
* Function Name: Cy_SCB_UART_ClearTxFifoStatus
****************************************************************************//**
*
* Clears the selected statuses of the TX FIFO.
*
* \param base
* The pointer to the UART SCB instance.
*
* \param clearMask
* The mask whose statuses to clear.
* See \ref group_scb_uart_macros_tx_fifo_status for the set of constants.
*
* \note
* * The status is also used for interrupt generation, so clearing it also
*   clears the interrupt sources.
* * Level-sensitive statuses such as \ref CY_SCB_UART_TX_TRIGGER,
*   \ref CY_SCB_UART_TX_EMPTY and \ref CY_SCB_UART_TX_NOT_FULL are set high again after
*   being cleared if the condition remains true.
*
*******************************************************************************/
__STATIC_INLINE void Cy_SCB_UART_ClearTxFifoStatus(CySCB_Type *base, uint32_t clearMask)
{
    CY_ASSERT_L2(CY_SCB_IS_INTR_VALID(clearMask, CY_SCB_UART_TX_INTR_MASK));

    Cy_SCB_ClearTxInterrupt(base, clearMask);
}

/*******************************************************************************
* Function Name: Cy_SCB_UART_GetNumInTxFifo
****************************************************************************//**
*
* Returns the number of data elements in the UART TX FIFO.
*
* \param base
* The pointer to the UART SCB instance.
*
* \return
* The number of data elements in the TX FIFO.
* The size of date element defined by the configured data width.
*
* \note
* This number does not include any data currently in the TX shifter.
*
*******************************************************************************/
__STATIC_INLINE uint32_t Cy_SCB_UART_GetNumInTxFifo(CySCB_Type const *base)
{
    return Cy_SCB_GetNumInTxFifo(base);
}

/*******************************************************************************
* Function Name: Cy_SCB_UART_IsTxComplete
****************************************************************************//**
*
* Checks whether the TX FIFO and Shifter are empty and there is no more data to send
*
* \param base
* Pointer to the UART SCB instance.
*
* \return
* If true, transmission complete. If false, transmission is not complete.
*
*******************************************************************************/
__STATIC_INLINE bool Cy_SCB_UART_IsTxComplete(CySCB_Type const *base)
{
    return Cy_SCB_IsTxComplete(base);
}

/*******************************************************************************
* Function Name: Cy_SCB_UART_ClearTxFifo
****************************************************************************//**
*
* Clears all data out of the UART TX FIFO.
*
* \param base
* The pointer to the UART SCB instance.
*
* \sideeffect
* The TX FIFO clear operation also clears the shift register, so that
* the shifter could be cleared in the middle of a data element transfer,
* corrupting it. The data element corruption means that all bits that have
* not been transmitted are transmitted as 1s on the bus.
*
*******************************************************************************/
__STATIC_INLINE void Cy_SCB_UART_ClearTxFifo(CySCB_Type *base)
{
    Cy_SCB_ClearTxFifo(base);
}
/** \} group_scb_uart_low_level_functions */

/**
* \addtogroup group_scb_uart_interrupt_functions
* \{
*/
/*******************************************************************************
* Function Name: Cy_SCB_UART_RegisterCallback
****************************************************************************//**
*
* Registers a callback function that notifies that
* \ref group_scb_uart_macros_callback_events occurred in the
* \ref Cy_SCB_UART_Interrupt.
*
* \param base
* The pointer to the UART SCB instance.
*
* \param callback
* The pointer to the callback function.
* See \ref cy_cb_scb_uart_handle_events_t for the function prototype.
*
* \param context
* The pointer to the context structure \ref cy_stc_scb_uart_context_t allocated
* by the user. The structure is used during the UART operation for internal
* configuration and data retention. The user should not modify anything
* in this structure.
*
* \note
* To remove the callback, pass NULL as the pointer to the callback function.
*
*******************************************************************************/
__STATIC_INLINE void Cy_SCB_UART_RegisterCallback(CySCB_Type const *base,
          cy_cb_scb_uart_handle_events_t callback, cy_stc_scb_uart_context_t *context)
{
    /* Suppress a compiler warning about unused variables */
    (void) base;

    context->cbEvents = callback;
}
/** \} group_scb_uart_interrupt_functions */

#if defined(__cplusplus)
}
#endif

/** \} group_scb_uart */

#endif /* (CY_SCB_UART_H) */

/* [] END OF FILE */

redpajama_set_name: RedPajamaGithub


Customer Conveyer offers a variety of conveyors to allow quick and efficient transportation for a wide variety of materials in your packaging industries.
Alibaba.com offers 4,757 pallet conveyor products. About 25% of these are conveyors, 1% are other packaging machines, and 1% are crusher. A wide variety of pallet conveyor options are available to you, such as roller conveyor, conveyor system, and chain conveyor.
Pallet Handling Equipment - Cisco-Eagle, Inc.
Professional Grade Pallet Handling - LEWCO Inc.
Pallet roller conveyors - BCK Holland B.V.
The pallet roller conveyors are used for pallets up to 1.500 kg per meter. By standardization, the pallet roller conveyors can be delivered in various widths and types.
PALLET HANDLING SYSTEMS A COMPLETE RANGE OF CUSTOMISIBLE PALLET CONVEYING SOLUTIONS. Sidel´s portfolio of pallet conveyors, tables and elevators comprises a variety of high-quality solutions.
Simplimatic's Excellerator® Pallet Conveyor uses low-back pressure roller chain to reliably transport a wide variety of products and carriers within industries such as appliance manufacturers, consumer electronics, automotive assembly, and many others.
Welcome to the premier industrial Pallet Conveyors resource. A wide variety of manufacturers, distributors and service companies are featured in our extensive vertical directory to allow ease sourcing and research for Pallet Conveyors.
Kornylak manufactures a variety of pallet conveyor equipment for horizontal and vertical conveyors.
Easily handle a wide variety of pallet sizes and weights with New London Engineering's Pallet Handling Conveyors.
Dematic's pallet conveyors are versatile with high throughput rates and support a variety of load weights and sizes.
Dematic pallet conveyors are heavy unit load conveyor systems that have the durability and versatility to work efficiently in a wide variety of applications and industries.
Professional Pallet Handling Systems - LEWCO Inc.
Choose Your System. Twin-Strand Work Pallet Handling System. ... Transport conveyors connect in multiple ways to suit a variety of assembly system requirements.
Videos . Over/Under Pallet ... Convey a Large Variety of Part Sizes on One Conveyor. ... Dual Lane Part or Pallet Conveyor with Double Plus Chain.